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 1.3 by greg, Fri Apr 19 10:33:25 1991 UTC vs.
Revision 2.2 by greg, Thu Feb 20 11:40:36 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1988 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ LBL";
24  
25   #define  MAXLINE        512
26  
27 + #ifndef BSD
28 + #define  index  strchr
29 + #endif
30 +
31 + extern char  *index();
32 +
33   char  FMTSTR[] = "FORMAT=";
34   int  FMTSTRL = 7;
35  
# Line 31 | Line 37 | int  FMTSTRL = 7;
37   printargs(ac, av, fp)           /* print arguments to a file */
38   int  ac;
39   char  **av;
40 < FILE  *fp;
40 > register FILE  *fp;
41   {
42 +        int  quote;
43 +
44          while (ac-- > 0) {
45 <                fputs(*av++, fp);
45 >                if (index(*av, ' ') != NULL) {          /* quote it */
46 >                        if (index(*av, '\'') != NULL)
47 >                                quote = '"';
48 >                        else
49 >                                quote = '\'';
50 >                        putc(quote, fp);
51 >                        fputs(*av++, fp);
52 >                        putc(quote, fp);
53 >                } else
54 >                        fputs(*av++, fp);
55                  putc(' ', fp);
56          }
57          putc('\n', fp);
# Line 134 | Line 151 | char   *pat, *str;
151                  case '*':                       /* match any string */
152                          while (p[1] == '*') p++;
153                          do
154 <                                if ( (p[1] == '?' || p[1] == *s)
154 >                                if ( (p[1]=='?' || p[1]==*s)
155                                                  && copymatch(p+1,s) ) {
156                                          strcpy(pat, str);
157                                          return(1);
# Line 164 | Line 181 | char   *pat, *str;
181   * Checkheader(fin,fmt,fout) returns a value of 1 if the input format
182   * matches the specification in fmt, 0 if no input format was found,
183   * and -1 if the input format does not match or there is an
184 < * error reading the header.  If fmt is NULL, then -1 is returned
184 > * error reading the header.  If fmt is empty, then -1 is returned
185   * if any input format is found (or there is an error), and 0 otherwise.
186   * If fmt contains any '*' or '?' characters, then checkheader
187   * does wildcard expansion and copies a matching result into fmt.
# Line 183 | Line 200 | FILE  *fout;
200          cdat.fp = fout;
201          cdat.fs[0] = '\0';
202          if (getheader(fin, mycheck, &cdat) < 0)
186                return(-1);
187        if (fmt == NULL && cdat.fs[0] != '\0')
203                  return(-1);
204          if (cdat.fs[0] != '\0')
205                  return(copymatch(fmt, cdat.fs) ? 1 : -1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines