--- ray/src/common/header.c 2022/03/14 19:25:56 2.46 +++ ray/src/common/header.c 2025/06/04 22:34:27 2.49 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: header.c,v 2.46 2022/03/14 19:25:56 greg Exp $"; +static const char RCSid[] = "$Id: header.c,v 2.49 2025/06/04 22:34:27 greg Exp $"; #endif /* * header.c - routines for reading and writing information headers. @@ -168,14 +168,6 @@ printargs( /* print arguments to a file */ FILE *fp ) { -#if defined(_WIN32) || defined(_WIN64) - extern char *fixargv0(char *arg0); - char myav0[128]; - /* clean up Windows executable path */ - if (ac-- <= 0) return; - fputs(fixargv0(strcpy(myav0, *av++)), fp); - fputc(ac ? ' ' : '\n', fp); -#endif while (ac-- > 0) { fputword(*av++, fp); fputc(ac ? ' ' : '\n', fp); @@ -191,15 +183,20 @@ formatval( /* get format value (return true if forma { const char *cp = FMTSTR; char *r = fmt; - + /* check against format string */ while (*cp) if (*cp++ != *s++) return(0); while (isspace(*s)) s++; if (!*s) return(0); - if (r == NULL) return(1); - do + if (r == NULL) /* just checking if format? */ + return(1); + do /* copy format ID */ *r++ = *s++; - while (*s && !isspace(*s) && r-fmt < MAXFMTLEN-1); - *r = '\0'; + while (*s && r-fmt < MAXFMTLEN-1); + + do /* remove trailing white space */ + *r-- = '\0'; + while (r > fmt && isspace(*r)); + return(1); } @@ -381,10 +378,11 @@ globmatch( /* check for match of s against pattern p s++; break; case '\\': /* literal next */ - p++; + if (!*++p) + return(0); /* fall through */ default: /* normal character */ - if (!*s | (*p != *s)) + if (*p != *s) return(0); s++; break;