--- ray/src/common/wordfile.c 1992/11/03 19:34:00 2.4 +++ ray/src/common/wordfile.c 2004/03/28 20:33:12 2.13 @@ -1,23 +1,29 @@ -/* 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.13 2004/03/28 20:33:12 schorsch 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 +#include +#include +#include +#include +#include -#define NULL 0 +#include "platform.h" +#include "standard.h" + #define MAXFLEN 8192 /* file must be smaller than this */ -extern char *bmalloc(); - int wordfile(words, fname) /* get words from fname, put in words */ char **words; @@ -27,6 +33,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 +70,7 @@ char *str; if (!*cp) /* all done? */ break; *ap++ = cp; /* add argument to list */ - while (*cp && !isspace(*cp++)) + while (*++cp && !isspace(*cp)) ; } *ap = NULL;