--- ray/src/common/header.c 2009/05/21 18:08:43 2.25 +++ ray/src/common/header.c 2012/08/09 23:15:38 2.28 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: header.c,v 2.25 2009/05/21 18:08:43 greg Exp $"; +static const char RCSid[] = "$Id: header.c,v 2.28 2012/08/09 23:15:38 greg Exp $"; #endif /* * header.c - routines for reading and writing information headers. @@ -31,6 +31,8 @@ static const char RCSid[] = "$Id: header.c,v 2.25 2009 #define MAXLINE 2048 +extern time_t timegm(struct tm *tm); + const char HDRSTR[] = "#?"; /* information header magic number */ const char FMTSTR[] = "FORMAT="; /* format identifier */ @@ -180,7 +182,7 @@ formatval( /* get format value (return true if forma if (r == NULL) return(1); do *r++ = *s++; - while(*s && !isspace(*s)); + while (*s && !isspace(*s)); *r = '\0'; return(1); } @@ -211,12 +213,8 @@ getheader( /* get header from file */ buf[MAXLINE-2] = '\n'; if (fgets(buf, MAXLINE, fp) == NULL) return(-1); - if (buf[0] == '\n') + if (buf[buf[0]=='\r'] == '\n') return(0); -#ifdef MSDOS - if (buf[0] == '\r' && buf[1] == '\n') - return(0); -#endif if (buf[MAXLINE-2] != '\n') { ungetc(buf[MAXLINE-2], fp); /* prevent false end */ buf[MAXLINE-2] = '\0'; @@ -264,7 +262,7 @@ globmatch( /* check for match of s against pattern p case '*': /* match any string */ while (p[1] == '*') p++; do - if ( (p[1]=='?' || p[1]==*s) && + if ( (p[1]=='?') | (p[1]==*s) && globmatch(p+1,s) ) return(1); while (*s++); @@ -277,11 +275,11 @@ globmatch( /* check for match of s against pattern p if (!*p) return(0); if (*p == '-') { - setmatch += p[-1] <= *s && *s <= p[1]; + setmatch += (p[-1] <= *s && *s <= p[1]); if (!*++p) break; } else - setmatch += *p == *s; + setmatch += (*p == *s); } if (!setmatch) return(0);