[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#536484: didiwiki: search text case insensitive



Package: didiwiki
Version: 0.5-6
Severity: wishlist

*** Please type your report below this line ***

The didiwiki search is case sensitive and if you search a word that is also a page name you go directly to it, without view the other results.

Regards
Carlo

--- wiki.c.orig    2009-07-10 11:16:38.000000000 +0200
+++ wiki.c    2009-07-10 11:44:06.000000000 +0200
@@ -636,6 +636,27 @@
 
 
 
+static int stristr(const char *text, const char *word)
+{
+    while (*text++)
+    {
+       if ( toupper(*text) == toupper(*word) )
+       {
+          const char *t = text;
+          const char *w = word;
+
+          while (*t++ && *w++)
+          {
+             if ( toupper(*t) != toupper(*w) )
+                break;
+          }
+          if ( !*w )
+             return 1;
+       }
+    }
+    return 0;
+}
+
 WikiPageList**
 wiki_get_pages(int  *n_pages, char *expr)
 {
@@ -658,7 +679,7 @@
     {             /* Super Simple Search */
       char *data = "">       if ((data = "" != NULL)
-        if (strstr(data, expr) == NULL)
+        if (!stristr(data, expr))
           if (strcmp(namelist[n]->d_name, expr) != 0)
         goto cleanup;
     }
@@ -736,10 +757,6 @@
 
   if (pages)
     {
-      for (i=0; i<n_pages; i++)
-    if (!strcmp(pages[i]->name, expr)) /* redirect on page name match */
-      wiki_redirect(res, pages[i]->name);
-
       wiki_show_header(res, "Search", FALSE);
 
       for (i=0; i<n_pages; i++)


-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages didiwiki depends on:
ii  adduser                       3.110      add and remove users and groups
ii  libc6                         2.7-18     GNU C Library: Shared libraries

didiwiki recommends no packages.

didiwiki suggests no packages.

-- no debconf information

Reply to: