ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/header.c
(Generate patch)

Comparing ray/src/common/header.c (file contents):
Revision 2.6 by greg, Mon Oct 16 10:53:46 1995 UTC vs.
Revision 2.7 by greg, Tue Mar 12 11:29:16 1996 UTC

# Line 218 | Line 218 | char   *pat, *str;
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   */
# Line 230 | Line 231 | char  *fmt;
231   FILE  *fout;
232   {
233          struct check    cdat;
234 +        register char   *cp;
235  
236          cdat.fp = fout;
237          cdat.fs[0] = '\0';
# Line 237 | Line 239 | FILE  *fout;
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines