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.9 by gregl, Fri Oct 31 11:40:52 1997 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1994 Regents of the University of California */
1 > /* Copyright (c) 1996 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 57 | Line 57 | register char  *r, *s;
57  
58          while (*cp) if (*cp++ != *s++) return(0);
59          if (r == NULL) return(1);
60 <        while (*s) *r++ = *s++;
60 >        while (*s && !isspace(*s)) *r++ = *s++;
61          *r = '\0';
62          return(1);
63   }
# Line 89 | Line 89 | register FILE  *fp;
89                          putc(quote, fp);
90                  } else
91                          fputs(*av++, fp);
92 <                putc(' ', fp);
92 >                putc(ac ? ' ' : '\n', fp);
93          }
94        putc('\n', fp);
94   }
95  
96  
# Line 218 | Line 217 | char   *pat, *str;
217   * if any input format is found (or there is an error), and 0 otherwise.
218   * If fmt contains any '*' or '?' characters, then checkheader
219   * does wildcard expansion and copies a matching result into fmt.
220 < * Be sure that fmt is big enough to hold the match in such cases!
220 > * Be sure that fmt is big enough to hold the match in such cases,
221 > * and that it is not a static, read-only string!
222   * The input header (minus any format lines) is copied to fout
223   * if fout is not NULL.
224   */
# Line 230 | Line 230 | char  *fmt;
230   FILE  *fout;
231   {
232          struct check    cdat;
233 +        register char   *cp;
234  
235          cdat.fp = fout;
236          cdat.fs[0] = '\0';
# Line 237 | Line 238 | FILE  *fout;
238                  return(-1);
239          if (!cdat.fs[0])
240                  return(0);
241 <        if (globmatch(fmt, cdat.fs)) {
242 <                strcpy(fmt, cdat.fs);
243 <                return(1);
244 <        }
245 <        return(-1);
241 >        for (cp = fmt; *cp; cp++)               /* check for globbing */
242 >                if (*cp == '?' | *cp == '*')
243 >                        if (globmatch(fmt, cdat.fs)) {
244 >                                strcpy(fmt, cdat.fs);
245 >                                return(1);
246 >                        } else
247 >                                return(-1);
248 >        return(strcmp(fmt, cdat.fs) ? -1 : 1);  /* literal match */
249   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines