forked from gooselinux/grub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrub-0.97-fat-lowercase.patch
73 lines (68 loc) · 2.2 KB
/
grub-0.97-fat-lowercase.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
From: Peter Jones <[email protected]>
diff -urpN grub-0.97/stage2/char_io.c.lowercase grub-0.97/stage2/char_io.c
--- grub-0.97/stage2/char_io.c.lowercase 2009-04-07 15:06:37.000000000 -0400
+++ grub-0.97/stage2/char_io.c 2009-04-07 15:07:19.000000000 -0400
@@ -1346,6 +1346,26 @@ substring (const char *s1, const char *s
return 1;
}
+int
+subcasestring (const char *s1, const char *s2)
+{
+ while (tolower(*s1) == tolower(*s2))
+ {
+ /* The strings match exactly. */
+ if (! *(s1++))
+ return 0;
+ s2 ++;
+ }
+
+ /* S1 is a substring of S2. */
+ if (*s1 == 0)
+ return -1;
+
+ /* S1 isn't a substring. */
+ return 1;
+}
+
+
#ifndef STAGE1_5
/* Terminate the string STR with NUL. */
int
diff -urpN grub-0.97/stage2/fsys_fat.c.lowercase grub-0.97/stage2/fsys_fat.c
--- grub-0.97/stage2/fsys_fat.c.lowercase 2009-04-07 15:06:21.000000000 -0400
+++ grub-0.97/stage2/fsys_fat.c 2009-04-07 15:06:56.000000000 -0400
@@ -435,7 +435,7 @@ fat_dir (char *dirname)
goto print_filename;
# endif /* STAGE1_5 */
- if (substring (dirname, filename) == 0)
+ if (subcasestring (dirname, filename) == 0)
break;
}
}
@@ -462,7 +462,7 @@ fat_dir (char *dirname)
if (do_possibilities)
{
print_filename:
- if (substring (dirname, filename) <= 0)
+ if (subcasestring (dirname, filename) <= 0)
{
if (print_possibilities > 0)
print_possibilities = -print_possibilities;
@@ -472,7 +472,7 @@ fat_dir (char *dirname)
}
# endif /* STAGE1_5 */
- if (substring (dirname, filename) == 0)
+ if (subcasestring (dirname, filename) == 0)
break;
}
diff -urpN grub-0.97/stage2/shared.h.lowercase grub-0.97/stage2/shared.h
--- grub-0.97/stage2/shared.h.lowercase 2009-04-07 15:06:29.000000000 -0400
+++ grub-0.97/stage2/shared.h 2009-04-07 15:07:01.000000000 -0400
@@ -941,6 +941,7 @@ char *convert_to_ascii (char *buf, int c
int get_cmdline (char *prompt, char *cmdline, int maxlen,
int echo_char, int history);
int substring (const char *s1, const char *s2);
+int subcasestring (const char *s1, const char *s2);
int nul_terminate (char *str);
int get_based_digit (int c, int base);
int safe_parse_maxint (char **str_ptr, int *myint_ptr);