> If you send in a new patch that addresses Robert's concerns +
> Changelog entry, I will go over it ASAP :-).  Giving the same comments
> as Robert does seems like a waste of time for everyone.  Is this ok
> for you?

Here is the patch that makes FAT fs case insensitive.

Tristan.
2008-01-28  Tristan Gingold  <[EMAIL PROTECTED]>

        * kern/misc.c (grub_strcasecmp): New function.

        * include/grub/misc.h: Declare grub_strcasecmp.

        * fs/fat.c (grub_fat_find_dir): Use case insensitive string
        compare as filenames are not case sensitive.

diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure 
grub2.orig/kern/misc.c grub2/kern/misc.c
--- grub2.orig/kern/misc.c      2008-01-15 18:22:09.000000000 +0100
+++ grub2/kern/misc.c   2008-01-28 16:29:58.000000000 +0100
@@ -193,6 +193,26 @@ grub_strcmp (const char *s1, const char 
 }
 
 int
+grub_strcasecmp (const char *s1, const char *s2)
+{
+  char c1, c2;
+
+  while (*s1 && *s2)
+    {
+      c1 = grub_tolower (*s1);
+      c2 = grub_tolower (*s2);
+      if (c1 != c2)
+       return (int) c1 - (int) c2;
+      
+      s1++;
+      s2++;
+    }
+
+  /* One of these is 0!  */
+  return (int) *s1 - (int) *s2;
+}
+
+int
 grub_strncmp (const char *s1, const char *s2, grub_size_t n)
 {
   if (n == 0)
diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure 
grub2.orig/include/grub/misc.h grub2/include/grub/misc.h
--- grub2.orig/include/grub/misc.h      2007-11-05 15:54:00.000000000 +0100
+++ grub2/include/grub/misc.h   2008-01-28 16:29:57.000000000 +0100
@@ -46,6 +46,7 @@ int EXPORT_FUNC(grub_memcmp) (const void
 int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
 int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
 int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, int c);
+int EXPORT_FUNC(grub_strcasecmp) (const char *s1, const char *s2);
 char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
 char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
 int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure 
grub2.orig/fs/fat.c grub2/fs/fat.c
--- grub2.orig/fs/fat.c 2007-08-02 20:40:36.000000000 +0200
+++ grub2/fs/fat.c      2008-01-28 16:29:57.000000000 +0100
@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, str
                  continue;
                }
 
-             if (grub_strcmp (dirname, filename) == 0)
+             if (grub_strcasecmp (dirname, filename) == 0)
                {
                  if (call_hook)
                    hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY);
@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, str
          if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY))
            break;
        }
-      else if (grub_strcmp (dirname, filename) == 0)
+      else if (grub_strcasecmp (dirname, filename) == 0)
        {
          if (call_hook)
            hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY);

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to