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.45 by greg, Sun Mar 6 16:33:44 2022 UTC vs.
Revision 2.51 by greg, Sat Jun 7 05:09:45 2025 UTC

# Line 12 | Line 12 | static const char      RCSid[] = "$Id$";
12   *  gmtval(t,s)         get GMT as UTC
13   *  fputdate(t,fp)      put out the given UTC
14   *  fputnow(fp)         put out the current date and time
15 *  printargs(ac,av,fp) print an argument list to fp, followed by '\n'
15   *  formatval(r,s)      copy the format value in s to r
16   *  fputformat(s,fp)    write "FORMAT=%s" to fp
17   *  nativebigendian()   are we native on big-endian machine?
# Line 161 | Line 160 | fputnow(                       /* write out the current time */
160   }
161  
162  
164 void
165 printargs(              /* print arguments to a file */
166        int  ac,
167        char  **av,
168        FILE  *fp
169 )
170 {
171 #if defined(_WIN32) || defined(_WIN64)
172        extern char     *fixargv0(char *arg0);
173        char            myav0[128];
174                                /* clean up Windows executable path */
175        if (ac-- <= 0) return;
176        fputs(fixargv0(strcpy(myav0, *av++)), fp);
177        fputc(ac ? ' ' : '\n', fp);
178 #endif
179        while (ac-- > 0) {
180                fputword(*av++, fp);
181                fputc(ac ? ' ' : '\n', fp);
182        }
183 }
184
185
163   int
164   formatval(                      /* get format value (return true if format) */
165          char  fmt[MAXFMTLEN],
# Line 191 | Line 168 | formatval(                     /* get format value (return true if forma
168   {
169          const char  *cp = FMTSTR;
170          char  *r = fmt;
171 <
171 >                                /* check against format string */
172          while (*cp) if (*cp++ != *s++) return(0);
173          while (isspace(*s)) s++;
174          if (!*s) return(0);
175 <        if (r == NULL) return(1);
176 <        do
175 >        if (r == NULL)          /* just checking if format? */
176 >                return(1);
177 >        do                      /* copy format ID */
178                  *r++ = *s++;
179 <        while (*s && !isspace(*s) && r-fmt < MAXFMTLEN-1);
180 <        *r = '\0';
179 >        while (*s && r-fmt < MAXFMTLEN-1);
180 >
181 >        do                      /* remove trailing white space */
182 >                *r-- = '\0';
183 >        while (r > fmt && isspace(*r));
184 >
185          return(1);
186   }
187  
# Line 363 | Line 345 | globmatch(                     /* check for match of s against pattern p
345                          while (*s++);
346                          return(0);
347                  case '[':                       /* character set */
348 <                        setmatch = *s == *++p;
348 >                        setmatch = (*s == *++p);
349                          if (!*p)
350                                  return(0);
351                          while (*++p != ']') {
# Line 381 | Line 363 | globmatch(                     /* check for match of s against pattern p
363                          s++;
364                          break;
365                  case '\\':                      /* literal next */
366 <                        p++;
366 >                        if (!*++p)
367 >                                return(0);
368                  /* fall through */
369                  default:                        /* normal character */
370                          if (*p != *s)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines