gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / unzip-case-insensitive.patch
CommitLineData
31d289a4
LLB
1diff --git a/match.c b/match.c
2index 6cd656f..4e569f5 100644
3--- a/match.c
4+++ b/match.c
5@@ -190,10 +190,10 @@ char *___tmp_ptr;
6
7 #endif
8
9-static int recmatch(p, s, cs)
10+static int recmatch(p, s, ci)
11 ZCONST char *p; /* sh pattern to match */
12 ZCONST char *s; /* string to match it to */
13-int cs; /* flag: force case-sensitive matching */
14+int ci; /* flag: force case-insensitive matching */
15 /* Recursively compare the sh pattern p with the string s and return 1 if
16 they match, and 0 or 2 if they don't or if there is a syntax error in the
17 pattern. This routine recurses on itself no deeper than the number of
18@@ -214,7 +214,7 @@ int cs; /* flag: force case-sensitive matching */
19 if (CLEN(p) == 2) {
20 if (CLEN(s) == 2) {
21 return (*p == *s && *(p+1) == *(s+1)) ?
22- recmatch(p + 2, s + 2, cs) : 0;
23+ recmatch(p + 2, s + 2, ci) : 0;
24 } else {
25 return 0;
26 }
27@@ -230,9 +230,9 @@ int cs; /* flag: force case-sensitive matching */
28 /* '?' (or '%' or '#') matches any character (but not an empty string) */
29 if (c == WILDCHR_SINGLE) {
30 if (wild_stop_at_dir)
31- return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), cs) : 0;
32+ return (*s && *s != DIRSEP_CHR) ? recmatch(p, s + CLEN(s), ci) : 0;
33 else
34- return *s ? recmatch(p, s + CLEN(s), cs) : 0;
35+ return *s ? recmatch(p, s + CLEN(s), ci) : 0;
36 }
37
38 /* WILDCHR_MULTI ('*') matches any number of characters, including zero */
39@@ -253,14 +253,14 @@ int cs; /* flag: force case-sensitive matching */
40 # endif /* ?AMIGA */
41 /* Single WILDCHR_MULTI ('*'): this doesn't match slashes */
42 for (; *s && *s != DIRSEP_CHR; INCSTR(s))
43- if ((c = recmatch(p, s, cs)) != 0)
44+ if ((c = recmatch(p, s, ci)) != 0)
45 return c;
46 /* end of pattern: matched if at end of string, else continue */
47 if (*p == 0)
48 return (*s == 0);
49 /* continue to match if at DIRSEP_CHR in pattern, else give up */
50 return (*p == DIRSEP_CHR || (*p == '\\' && p[1] == DIRSEP_CHR))
51- ? recmatch(p, s, cs) : 2;
52+ ? recmatch(p, s, ci) : 2;
53 }
54 /* Two consecutive WILDCHR_MULTI ("**"): this matches DIRSEP_CHR ('/') */
55 p++; /* move p past the second WILDCHR_MULTI */
56@@ -308,17 +308,17 @@ int cs; /* flag: force case-sensitive matching */
57 */
58 if (q != srest)
59 return 0;
60- return ((cs ? strcmp(p, q) : namecmp(p, q)) == 0);
61+ return ((!ci ? strcmp(p, q) : namecmp(p, q)) == 0);
62 }
63 #else /* !_MBCS */
64- return ((cs ? strcmp(p, srest) : namecmp(p, srest)) == 0);
65+ return ((!ci ? strcmp(p, srest) : namecmp(p, srest)) == 0);
66 #endif /* ?_MBCS */
67 }
68 else
69 {
70 /* pattern contains more wildcards, continue with recursion... */
71 for (; *s; INCSTR(s))
72- if ((c = recmatch(p, s, cs)) != 0)
73+ if ((c = recmatch(p, s, ci)) != 0)
74 return c;
75 return 2; /* 2 means give up--shmatch will return false */
76 }
77@@ -353,17 +353,17 @@ int cs; /* flag: force case-sensitive matching */
78 c = *(p-1);
79 else
80 {
81- uch cc = (cs ? (uch)*s : case_map((uch)*s));
82+ uch cc = (!ci ? (uch)*s : to_up((uch)*s));
83 uch uc = (uch) c;
84 if (*(p+1) != '-')
85 for (uc = uc ? uc : (uch)*p; uc <= (uch)*p; uc++)
86 /* compare range */
87- if ((cs ? uc : case_map(uc)) == cc)
88- return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), cs);
89+ if ((!ci ? uc : to_up(uc)) == cc)
90+ return r ? 0 : recmatch(q + CLEN(q), s + CLEN(s), ci);
91 c = e = 0; /* clear range, escape flags */
92 }
93 }
94- return r ? recmatch(q + CLEN(q), s + CLEN(s), cs) : 0;
95+ return r ? recmatch(q + CLEN(q), s + CLEN(s), ci) : 0;
96 /* bracket match failed */
97 }
98 #endif /* !VMS */
99@@ -382,18 +382,18 @@ int cs; /* flag: force case-sensitive matching */
100 {
101 /* Match "...]" with "]". Continue after "]" in both. */
102 if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
103- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
104+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
105
106 /* Else, look for a reduced match in s, until "]" in or end of s. */
107 for (; *s && (*s != ']'); INCSTR(s))
108 if (*s == '.')
109 /* If reduced match, then continue after "..." in p, "." in s. */
110- if ((c = recmatch( (p+ CLEN( p)), s, cs)) != 0)
111+ if ((c = recmatch( (p+ CLEN( p)), s, ci)) != 0)
112 return (int)c;
113
114 /* Match "...]" with "]". Continue after "]" in both. */
115 if ((*(p+ 2* CLEN( p)) == ']') && (*s == ']'))
116- return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), cs);
117+ return recmatch( (p+ 3* CLEN( p)), (s+ CLEN( s)), ci);
118
119 /* No reduced match. Quit. */
120 return 2;
121@@ -402,8 +402,8 @@ int cs; /* flag: force case-sensitive matching */
122 #endif /* def VMS */
123
124 /* Just a character--compare it */
125- return (cs ? c == *s : case_map((uch)c) == case_map((uch)*s)) ?
126- recmatch(p, s + CLEN(s), cs) : 0;
127+ return (!ci ? c == *s : to_up((uch)c) == to_up((uch)*s)) ?
128+ recmatch(p, s + CLEN(s), ci) : 0;
129 }
130
131