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.3 by greg, Sat Oct 17 08:08:02 1992 UTC vs.
Revision 2.7 by greg, Fri Jun 18 09:00:22 1993 UTC

# Line 27 | Line 27 | char   *fname;
27          char    buf[MAXFLEN];
28          register int    n;
29                                          /* load file into buffer */
30 +        if (fname == NULL)
31 +                return(-1);                     /* no filename */
32          if ((fd = open(fname, 0)) < 0)
33                  return(-1);                     /* open error */
34          n = read(fd, buf, MAXFLEN);
# Line 55 | Line 57 | char   *str;
57          if (cp == NULL)                 /* ENOMEM */
58                  return(-1);
59          strcpy(cp, str);
60 <        for (ap = avl; *cp; *cp++ = '\0') {
61 <                while (isspace(*cp))    /* skip leading space */
62 <                        cp++;
63 <                if (*cp) {              /* add argument to list */
64 <                        *ap++ = cp;
65 <                        while (*cp && !isspace(*cp))
66 <                                cp++;
67 <                }
60 >        ap = avl;               /* parse into words */
61 >        for ( ; ; ) {
62 >                while (isspace(*cp))    /* nullify spaces */
63 >                        *cp++ = '\0';
64 >                if (!*cp)               /* all done? */
65 >                        break;
66 >                *ap++ = cp;             /* add argument to list */
67 >                while (*++cp && !isspace(*cp))
68 >                        ;
69          }
70          *ap = NULL;
71          return(ap - avl);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines