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.46 by greg, Mon Mar 14 19:25:56 2022 UTC vs.
Revision 2.50 by greg, Fri Jun 6 19:11:21 2025 UTC

# Line 30 | Line 30 | static const char      RCSid[] = "$Id$";
30   #include  <ctype.h>
31  
32   #include  "tiff.h"      /* for int32 */
33 + #include  "paths.h"     /* for fixargv0() */
34   #include  "rtio.h"
35   #include  "color.h"
36   #include  "resolu.h"
# Line 162 | Line 163 | fputnow(                       /* write out the current time */
163  
164  
165   void
166 < printargs(              /* print arguments to a file */
166 > printargs(              /* print command arguments to a file */
167          int  ac,
168          char  **av,
169          FILE  *fp
170   )
171   {
172 < #if defined(_WIN32) || defined(_WIN64)
173 <        extern char     *fixargv0(char *arg0);
174 <        char            myav0[128];
175 <                                /* clean up Windows executable path */
176 <        if (ac-- <= 0) return;
177 <        fputs(fixargv0(strcpy(myav0, *av++)), fp);
178 <        fputc(ac ? ' ' : '\n', fp);
179 < #endif
180 <        while (ac-- > 0) {
181 <                fputword(*av++, fp);
182 <                fputc(ac ? ' ' : '\n', fp);
172 >        if (ac <= 0)
173 >                return;
174 >        if (progname == NULL)
175 >                fixargv0(av[0]);        /* sets global progname */
176 >
177 >        if (progname >= av[0] && progname - av[0] < strlen(av[0]))
178 >                fputword(progname, fp);
179 >        else
180 >                fputword(av[0], fp);
181 >        while (--ac > 0) {
182 >                fputc(' ', fp);
183 >                fputword(*++av, fp);
184          }
185 +        fputc('\n', fp);
186   }
187  
188  
# Line 191 | Line 194 | formatval(                     /* get format value (return true if forma
194   {
195          const char  *cp = FMTSTR;
196          char  *r = fmt;
197 <
197 >                                /* check against format string */
198          while (*cp) if (*cp++ != *s++) return(0);
199          while (isspace(*s)) s++;
200          if (!*s) return(0);
201 <        if (r == NULL) return(1);
202 <        do
201 >        if (r == NULL)          /* just checking if format? */
202 >                return(1);
203 >        do                      /* copy format ID */
204                  *r++ = *s++;
205 <        while (*s && !isspace(*s) && r-fmt < MAXFMTLEN-1);
206 <        *r = '\0';
205 >        while (*s && r-fmt < MAXFMTLEN-1);
206 >
207 >        do                      /* remove trailing white space */
208 >                *r-- = '\0';
209 >        while (r > fmt && isspace(*r));
210 >
211          return(1);
212   }
213  
# Line 381 | Line 389 | globmatch(                     /* check for match of s against pattern p
389                          s++;
390                          break;
391                  case '\\':                      /* literal next */
392 <                        p++;
392 >                        if (!*++p)
393 >                                return(0);
394                  /* fall through */
395                  default:                        /* normal character */
396 <                        if (!*s | (*p != *s))
396 >                        if (*p != *s)
397                                  return(0);
398                          s++;
399                          break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines