ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/wordfile.c
(Generate patch)

Comparing ray/src/common/wordfile.c (file contents):
Revision 2.4 by greg, Tue Nov 3 19:34:00 1992 UTC vs.
Revision 2.13 by schorsch, Sun Mar 28 20:33:12 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Load whitespace separated words from a file into an array.
6   * Assume the passed pointer array is big enough to hold them all.
7 + *
8 + * External symbols declared in standard.h
9   */
10  
11 + #include "copyright.h"
12 +
13   #include <ctype.h>
14 + #include <string.h>
15 + #include <stdio.h>
16 + #include <sys/types.h>
17 + #include <sys/stat.h>
18 + #include <fcntl.h>
19  
20 < #define NULL            0
20 > #include "platform.h"
21 > #include "standard.h"
22  
23 +
24   #define MAXFLEN         8192            /* file must be smaller than this */
25  
18 extern char     *bmalloc();
26  
20
27   int
28   wordfile(words, fname)          /* get words from fname, put in words */
29   char    **words;
# Line 27 | Line 33 | char   *fname;
33          char    buf[MAXFLEN];
34          register int    n;
35                                          /* load file into buffer */
36 +        if (fname == NULL)
37 +                return(-1);                     /* no filename */
38          if ((fd = open(fname, 0)) < 0)
39                  return(-1);                     /* open error */
40          n = read(fd, buf, MAXFLEN);
# Line 62 | Line 70 | char   *str;
70                  if (!*cp)               /* all done? */
71                          break;
72                  *ap++ = cp;             /* add argument to list */
73 <                while (*cp && !isspace(*cp++))
73 >                while (*++cp && !isspace(*cp))
74                          ;
75          }
76          *ap = NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines