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 |
|
|
15 |
|
#define NULL 0 |
28 |
|
char buf[MAXFLEN]; |
29 |
|
register int n; |
30 |
|
/* load file into buffer */ |
31 |
+ |
if (fname == NULL) |
32 |
+ |
return(-1); /* no filename */ |
33 |
|
if ((fd = open(fname, 0)) < 0) |
34 |
|
return(-1); /* open error */ |
35 |
|
n = read(fd, buf, MAXFLEN); |
65 |
|
if (!*cp) /* all done? */ |
66 |
|
break; |
67 |
|
*ap++ = cp; /* add argument to list */ |
68 |
< |
while (*cp && !isspace(*cp)) |
69 |
< |
cp++; |
68 |
> |
while (*++cp && !isspace(*cp)) |
69 |
> |
; |
70 |
|
} |
71 |
|
*ap = NULL; |
72 |
|
return(ap - avl); |