218 |
|
* if any input format is found (or there is an error), and 0 otherwise. |
219 |
|
* If fmt contains any '*' or '?' characters, then checkheader |
220 |
|
* does wildcard expansion and copies a matching result into fmt. |
221 |
< |
* Be sure that fmt is big enough to hold the match in such cases! |
221 |
> |
* Be sure that fmt is big enough to hold the match in such cases, |
222 |
> |
* and that it is not a static, read-only string! |
223 |
|
* The input header (minus any format lines) is copied to fout |
224 |
|
* if fout is not NULL. |
225 |
|
*/ |
231 |
|
FILE *fout; |
232 |
|
{ |
233 |
|
struct check cdat; |
234 |
+ |
register char *cp; |
235 |
|
|
236 |
|
cdat.fp = fout; |
237 |
|
cdat.fs[0] = '\0'; |
239 |
|
return(-1); |
240 |
|
if (!cdat.fs[0]) |
241 |
|
return(0); |
242 |
< |
if (globmatch(fmt, cdat.fs)) { |
243 |
< |
strcpy(fmt, cdat.fs); |
244 |
< |
return(1); |
245 |
< |
} |
246 |
< |
return(-1); |
242 |
> |
for (cp = fmt; *cp; cp++) /* check for globbing */ |
243 |
> |
if (*cp == '?' | *cp == '*') |
244 |
> |
if (globmatch(fmt, cdat.fs)) { |
245 |
> |
strcpy(fmt, cdat.fs); |
246 |
> |
return(1); |
247 |
> |
} else |
248 |
> |
return(-1); |
249 |
> |
return(strcmp(fmt, cdat.fs) ? -1 : 1); /* literal match */ |
250 |
|
} |