diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/fnmatch | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to '')
-rw-r--r-- | src/regress/lib/libc/fnmatch/Makefile | 10 | ||||
-rw-r--r-- | src/regress/lib/libc/fnmatch/fnm_test.c | 62 | ||||
-rw-r--r-- | src/regress/lib/libc/fnmatch/fnm_test.in | 260 |
3 files changed, 0 insertions, 332 deletions
diff --git a/src/regress/lib/libc/fnmatch/Makefile b/src/regress/lib/libc/fnmatch/Makefile deleted file mode 100644 index 4acdd351bc..0000000000 --- a/src/regress/lib/libc/fnmatch/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # $OpenBSD: Makefile,v 1.2 2011/09/17 15:12:38 stsp Exp $ | ||
2 | |||
3 | PROG= fnm_test | ||
4 | LDADD+= -lutil | ||
5 | DPADD+= ${LIBUTIL} | ||
6 | |||
7 | run-regress-${PROG}: | ||
8 | ./${PROG} ${.CURDIR}/${PROG}.in | ||
9 | |||
10 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/fnmatch/fnm_test.c b/src/regress/lib/libc/fnmatch/fnm_test.c deleted file mode 100644 index ee04f6335e..0000000000 --- a/src/regress/lib/libc/fnmatch/fnm_test.c +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* $OpenBSD: fnm_test.c,v 1.3 2019/01/25 00:19:26 millert Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Public domain, 2008, Todd C. Miller <millert@openbsd.org> | ||
5 | */ | ||
6 | |||
7 | #include <err.h> | ||
8 | #include <fnmatch.h> | ||
9 | #include <stdio.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <util.h> | ||
12 | |||
13 | int | ||
14 | main(int argc, char **argv) | ||
15 | { | ||
16 | FILE *fp = stdin; | ||
17 | char pattern[1024], string[1024]; | ||
18 | char *line; | ||
19 | const char delim[3] = {'\0', '\0', '#'}; | ||
20 | int errors = 0, flags, got, want; | ||
21 | |||
22 | if (argc > 1) { | ||
23 | if ((fp = fopen(argv[1], "r")) == NULL) | ||
24 | err(1, "%s", argv[1]); | ||
25 | } | ||
26 | |||
27 | /* | ||
28 | * Read in test file, which is formatted thusly: | ||
29 | * | ||
30 | * pattern string flags expected_result | ||
31 | * | ||
32 | * lines starting with '#' are comments | ||
33 | */ | ||
34 | for (;;) { | ||
35 | line = fparseln(fp, NULL, NULL, delim, 0); | ||
36 | if (!line) | ||
37 | break; | ||
38 | got = sscanf(line, "%s %s 0x%x %d", pattern, string, &flags, | ||
39 | &want); | ||
40 | if (got == EOF) { | ||
41 | free(line); | ||
42 | break; | ||
43 | } | ||
44 | if (pattern[0] == '#') { | ||
45 | free(line); | ||
46 | continue; | ||
47 | } | ||
48 | if (got == 4) { | ||
49 | got = fnmatch(pattern, string, flags); | ||
50 | if (got != want) { | ||
51 | warnx("%s %s %d: want %d, got %d", pattern, | ||
52 | string, flags, want, got); | ||
53 | errors++; | ||
54 | } | ||
55 | } else { | ||
56 | warnx("unrecognized line '%s'\n", line); | ||
57 | errors++; | ||
58 | } | ||
59 | free(line); | ||
60 | } | ||
61 | exit(errors); | ||
62 | } | ||
diff --git a/src/regress/lib/libc/fnmatch/fnm_test.in b/src/regress/lib/libc/fnmatch/fnm_test.in deleted file mode 100644 index c2f218ae1b..0000000000 --- a/src/regress/lib/libc/fnmatch/fnm_test.in +++ /dev/null | |||
@@ -1,260 +0,0 @@ | |||
1 | /bin/[[:alpha:][:alnum:]]* /bin/ls 0x2 0 | ||
2 | /bin/[[:upper:]][[:alnum:]] /bin/ls 0x10 0 | ||
3 | /bin/[[:opper:][:alnum:]]* /bin/ls 0x0 1 | ||
4 | [[:alpha:][:alnum:]]*.c foo1.c 0x4 0 | ||
5 | [[:upper:]]* FOO 0x0 0 | ||
6 | [![:space:]]* bar 0x0 0 | ||
7 | # 'te\st' 'test'; no match if FNM_NOESCAPE | ||
8 | te\st test 0x0 0 | ||
9 | te\st test 0x1 1 | ||
10 | te\st test 0x1e 0 | ||
11 | # 'te\\st' 'te\st'; no match if FNM_NOESCAPE | ||
12 | te\\st te\st 0x0 0 | ||
13 | te\\st te\st 0x1 1 | ||
14 | te\\st te\st 0x1e 0 | ||
15 | # 'te\*t' 'te*t'; no match if FNM_NOESCAPE | ||
16 | te\*t te*t 0x0 0 | ||
17 | te\*t te*t 0x1 1 | ||
18 | te\*t te*t 0x1e 0 | ||
19 | # 'te\*t' 'test'; no match | ||
20 | te\*t test 0x0 1 | ||
21 | te\*t test 0x1f 1 | ||
22 | # 'te\?t' 'te?t'; no match if FNM_NOESCAPE | ||
23 | te\?t te?t 0x0 0 | ||
24 | te\?t te?t 0x1 1 | ||
25 | te\?t te?t 0x1e 0 | ||
26 | # 'te\?t' 'test'; no match | ||
27 | te\?t test 0x0 1 | ||
28 | te\?t test 0x1f 1 | ||
29 | # 'tesT' 'test'; match if FNM_CASEFOLD | ||
30 | tesT test 0x0 1 | ||
31 | tesT test 0xf 1 | ||
32 | tesT test 0x10 0 | ||
33 | # 'test' 'Test'; match if FNM_CASEFOLD | ||
34 | test Test 0x0 1 | ||
35 | test Test 0xf 1 | ||
36 | test Test 0x10 0 | ||
37 | # 'tEst' 'teSt'; match if FNM_CASEFOLD | ||
38 | tEst teSt 0x0 1 | ||
39 | tEst teSt 0xf 1 | ||
40 | tEst teSt 0x10 0 | ||
41 | # '?est' 'test'; match always | ||
42 | ?est test 0x0 0 | ||
43 | ?est test 0x1f 0 | ||
44 | # 'te?t' 'test'; match always | ||
45 | te?t test 0x0 0 | ||
46 | te?t test 0x1f 0 | ||
47 | # 'tes?' 'test'; match always | ||
48 | tes? test 0x0 0 | ||
49 | tes? test 0x1f 0 | ||
50 | # 'test?' 'test'; no match | ||
51 | test? test 0x0 1 | ||
52 | test? test 0x1f 1 | ||
53 | # '*' always matches anything | ||
54 | * test 0x0 0 | ||
55 | * test 0x1f 0 | ||
56 | # '*test' 'test'; match always | ||
57 | *test test 0x0 0 | ||
58 | *test test 0x1f 0 | ||
59 | # '*est' 'test'; match always | ||
60 | *est test 0x0 0 | ||
61 | *est test 0x1f 0 | ||
62 | # '*st' 'test'; match always | ||
63 | *st test 0x0 0 | ||
64 | *st test 0x1f 0 | ||
65 | # 't*t' 'test'; match always | ||
66 | t*t test 0x0 0 | ||
67 | t*t test 0x1f 0 | ||
68 | # 'te*t' 'test'; match always | ||
69 | te*t test 0x0 0 | ||
70 | te*t test 0x1f 0 | ||
71 | # 'te*st' 'test'; match always | ||
72 | te*st test 0x0 0 | ||
73 | te*st test 0x1f 0 | ||
74 | # 'te*' 'test'; match always | ||
75 | te* test 0x0 0 | ||
76 | te* test 0x1f 0 | ||
77 | # 'tes*' 'test'; match always | ||
78 | tes* test 0x0 0 | ||
79 | tes* test 0x1f 0 | ||
80 | # 'test*' 'test'; match always | ||
81 | test* test 0x0 0 | ||
82 | test* test 0x1f 0 | ||
83 | # '.[\-\t]' '.t'; match always | ||
84 | .[\-\t] .t 0x0 0 | ||
85 | .[\-\t] .t 0x1f 0 | ||
86 | # 'test*?*[a-z]*' 'testgoop'; match always | ||
87 | test*?*[a-z]* testgoop 0x0 0 | ||
88 | test*?*[a-z]* testgoop 0x1f 0 | ||
89 | # 'te[^abc]t' 'test'; match always | ||
90 | te[^abc]t test 0x0 0 | ||
91 | te[^abc]t test 0x1f 0 | ||
92 | # 'te[^x]t' 'test'; match always | ||
93 | te[^x]t test 0x0 0 | ||
94 | te[^x]t test 0x1f 0 | ||
95 | # 'te[!x]t' 'test'; match always | ||
96 | te[!x]t test 0x0 0 | ||
97 | te[^x]t test 0x1f 0 | ||
98 | # 'te[^x]t' 'text'; no match | ||
99 | te[^x]t text 0x0 1 | ||
100 | te[^x]t text 0x1f 1 | ||
101 | # 'te[^\x]t' 'text'; no match | ||
102 | te[^\x]t text 0x0 1 | ||
103 | te[^\x]t text 0x1f 1 | ||
104 | # 'te[^\x' 'text'; no match | ||
105 | te[^\x text 0x0 1 | ||
106 | te[^\x text 0x1f 1 | ||
107 | # 'te[/]t' 'text'; no match | ||
108 | te[/]t text 0x0 1 | ||
109 | te[/]t text 0x1f 1 | ||
110 | # 'te[S]t' 'test'; match if FNM_CASEFOLD | ||
111 | te[S]t test 0x0 1 | ||
112 | te[S]t test 0xf 1 | ||
113 | te[S]t test 0x10 0 | ||
114 | # 'te[r-t]t' 'test'; match always | ||
115 | te[r-t]t test 0x0 0 | ||
116 | te[r-t]t test 0x1f 0 | ||
117 | # 'te[r-t]t' 'teSt'; match if FNM_CASEFOLD | ||
118 | te[r-t]t teSt 0x0 1 | ||
119 | te[r-t]t teSt 0xf 1 | ||
120 | te[r-t]t teSt 0x10 0 | ||
121 | # 'te[r-T]t' 'test'; match if FNM_CASEFOLD | ||
122 | te[r-T]t test 0x0 1 | ||
123 | te[r-T]t test 0xf 1 | ||
124 | te[r-T]t test 0x10 0 | ||
125 | # 'te[R-T]t' 'test'; match if FNM_CASEFOLD | ||
126 | te[R-T]t test 0x0 1 | ||
127 | te[R-T]t test 0xf 1 | ||
128 | te[R-T]t test 0x10 0 | ||
129 | # 'te[r-Tz]t' 'tezt'; match always | ||
130 | te[r-Tz]t tezt 0x0 0 | ||
131 | te[r-Tz]t tezt 0x1f 0 | ||
132 | # 'te[R-T]t' 'tent'; no match | ||
133 | te[R-T]t tent 0x0 1 | ||
134 | te[R-T]t tent 0x1f 1 | ||
135 | # 'tes[]t]' 'test'; match always | ||
136 | tes[]t] test 0x0 0 | ||
137 | tes[]t] test 0x1f 0 | ||
138 | # 'tes[t-]' 'test'; match always | ||
139 | tes[t-] test 0x0 0 | ||
140 | tes[t-] test 0x1f 0 | ||
141 | # 'tes[t-]]' 'test]'; match always | ||
142 | tes[t-]] test] 0x0 0 | ||
143 | tes[t-]] test] 0x1f 0 | ||
144 | # 'tes[t-]]' 'test'; no match | ||
145 | tes[t-]] test 0x0 1 | ||
146 | tes[t-]] test 0x1f 1 | ||
147 | # 'tes[u-]' 'test'; no match | ||
148 | tes[u-] test 0x0 1 | ||
149 | tes[u-] test 0x1f 1 | ||
150 | # 'tes[t-]' 'tes[t-]'; no match | ||
151 | tes[t-] test[t-] 0x0 1 | ||
152 | tes[t-] test[t-] 0x1f 1 | ||
153 | # 'test[/-/]' 'test[/-/]'; no match | ||
154 | test[/-/] test/-/ 0x0 1 | ||
155 | test[/-/] test/-/ 0x1f 1 | ||
156 | # 'test[\/-/]' 'test[/-/]'; no match | ||
157 | test[\/-/] test/-/ 0x0 1 | ||
158 | test[\/-/] test/-/ 0x1f 1 | ||
159 | # 'test[/-\/]' 'test[/-/]'; no match | ||
160 | test[/-\/] test/-/ 0x0 1 | ||
161 | test[/-\/] test/-/ 0x1f 1 | ||
162 | # 'test[/-/]' 'test/'; no match if APR_FNM_PATHNAME | ||
163 | test[/-/] test/ 0x0 0 | ||
164 | test[/-/] test/ 0x2 1 | ||
165 | test[/-/] test/ 0x1d 0 | ||
166 | # 'test[\/-/]' 'test/'; no match if APR_FNM_PATHNAME | ||
167 | test[\/-/] test/ 0x0 0 | ||
168 | test[\/-/] test/ 0x2 1 | ||
169 | test[\/-/] test/ 0x1d 0 | ||
170 | # 'test[/-\/]' 'test/'; no match if APR_FNM_PATHNAME | ||
171 | test[/-\/] test/ 0x0 0 | ||
172 | test[/-\/] test/ 0x2 1 | ||
173 | test[/-\/] test/ 0x1d 0 | ||
174 | # '/test' 'test'; no match | ||
175 | /test test 0x0 1 | ||
176 | /test test 0x1f 1 | ||
177 | # 'test' '/test'; no match | ||
178 | test /test 0x0 1 | ||
179 | test /test 0x1f 1 | ||
180 | # 'test/' 'test'; no match | ||
181 | test/ test 0x0 1 | ||
182 | test/ test 0x1f 1 | ||
183 | # 'test' 'test/'; match if FNM_LEADING_DIR | ||
184 | test test/ 0x0 1 | ||
185 | test test/ 0x17 1 | ||
186 | test test/ 0x8 0 | ||
187 | # '\/test' '/test'; match unless FNM_NOESCAPE | ||
188 | \/test /test 0x0 0 | ||
189 | \/test /test 0x1 1 | ||
190 | \/test /test 0x1e 0 | ||
191 | # '*test' '/test'; match unless FNM_PATHNAME | ||
192 | *test /test 0x0 0 | ||
193 | *test /test 0x2 1 | ||
194 | *test /test 0x1d 0 | ||
195 | # '/*/test' '/test'; no match | ||
196 | /*/test /test 0x0 1 | ||
197 | /*/test /test 0x1f 1 | ||
198 | # '/*/test' '/test/test'; match always | ||
199 | /*/test /test/test 0x0 0 | ||
200 | /*/test /test/test 0x1f 0 | ||
201 | # 'test/this' 'test/'; match never | ||
202 | test/this test/ 0x0 1 | ||
203 | test/this test/ 0x1f 1 | ||
204 | # 'test/' 'test/this'; match never | ||
205 | test/ test/this 0x0 1 | ||
206 | test/ test/this 0x1f 1 | ||
207 | # 'test*/this' 'test/this'; match always | ||
208 | test*/this test/this 0x0 0 | ||
209 | test*/this test/this 0x1f 0 | ||
210 | # 'test*/this' 'test/that'; match never | ||
211 | test*/this test/that 0x0 1 | ||
212 | test*/this test/that 0x1f 1 | ||
213 | # 'test/*this' 'test/this'; match always | ||
214 | test/*this test/this 0x0 0 | ||
215 | test/*this test/this 0x1f 0 | ||
216 | # '.*' '.this'; match always | ||
217 | .* .this 0x0 0 | ||
218 | .* .this 0x1f 0 | ||
219 | # '*' '.this'; fails if FNM_PERIOD | ||
220 | * .this 0x0 0 | ||
221 | * .this 0x4 1 | ||
222 | * .this 0x1b 0 | ||
223 | # '?this' '.this'; fails if FNM_PERIOD | ||
224 | ?this .this 0x0 0 | ||
225 | ?this .this 0x4 1 | ||
226 | ?this .this 0x1b 0 | ||
227 | # '[.]this' '.this'; fails if FNM_PERIOD | ||
228 | [.]this .this 0x0 0 | ||
229 | [.]this .this 0x4 1 | ||
230 | [.]this .this 0x1b 0 | ||
231 | # 'test/this' 'test/this'; match always | ||
232 | test/this test/this 0x0 0 | ||
233 | test/this test/this 0x1f 0 | ||
234 | # 'test?this' 'test/this'; fails if FNM_PATHNAME | ||
235 | test?this test/this 0x0 0 | ||
236 | test?this test/this 0x2 1 | ||
237 | test?this test/this 0x1d 0 | ||
238 | # 'test*this' 'test/this'; fails if FNM_PATHNAME | ||
239 | test*this test/this 0x0 0 | ||
240 | test*this test/this 0x2 1 | ||
241 | test*this test/this 0x1d 0 | ||
242 | # 'test[/]this' 'test/this'; fails if FNM_PATHNAME | ||
243 | test[/]this test/this 0x0 0 | ||
244 | test[/]this test/this 0x2 1 | ||
245 | test[/]this test/this 0x1d 0 | ||
246 | # 'test/.*' 'test/.this'; match always | ||
247 | test/.* test/.this 0x0 0 | ||
248 | test/.* test/.this 0x1f 0 | ||
249 | # 'test/*' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME | ||
250 | test/* test/.this 0x0 0 | ||
251 | test/* test/.this 0x6 1 | ||
252 | test/* test/.this 0x19 0 | ||
253 | # 'test/?' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME | ||
254 | test/?this test/.this 0x0 0 | ||
255 | test/?this test/.this 0x6 1 | ||
256 | test/?this test/.this 0x19 0 | ||
257 | # 'test/[.]this' 'test/.this'; fails if FNM_PERIOD and FNM_PATHNAME | ||
258 | test/[.]this test/.this 0x0 0 | ||
259 | test/[.]this test/.this 0x6 1 | ||
260 | test/[.]this test/.this 0x19 0 | ||