--- ray/src/common/wordfile.c 1992/11/03 19:34:00 2.4 +++ ray/src/common/wordfile.c 2003/02/25 02:47:22 2.9 @@ -1,14 +1,15 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: wordfile.c,v 2.9 2003/02/25 02:47:22 greg Exp $"; #endif - /* * Load whitespace separated words from a file into an array. * Assume the passed pointer array is big enough to hold them all. + * + * External symbols declared in standard.h */ +#include "copyright.h" + #include #define NULL 0 @@ -27,6 +28,8 @@ char *fname; char buf[MAXFLEN]; register int n; /* load file into buffer */ + if (fname == NULL) + return(-1); /* no filename */ if ((fd = open(fname, 0)) < 0) return(-1); /* open error */ n = read(fd, buf, MAXFLEN); @@ -62,7 +65,7 @@ char *str; if (!*cp) /* all done? */ break; *ap++ = cp; /* add argument to list */ - while (*cp && !isspace(*cp++)) + while (*++cp && !isspace(*cp)) ; } *ap = NULL;