Lines 31-37
Link Here
|
31 |
|
31 |
|
32 |
static const char *dowork(const char *, int *, char ***, int); |
32 |
static const char *dowork(const char *, int *, char ***, int); |
33 |
static const char *getanarg(FILE *, struct work *, char **); |
33 |
static const char *getanarg(FILE *, struct work *, char **); |
34 |
static char *getline(FILE *, char *, size_t); |
34 |
static char *osw_getline(FILE *, char *, size_t); |
35 |
|
35 |
|
36 |
/* |
36 |
/* |
37 |
- optionsfrom - add some options, taken from a file, to argc/argv |
37 |
- optionsfrom - add some options, taken from a file, to argc/argv |
Lines 149-155
Link Here
|
149 |
char *endp; |
149 |
char *endp; |
150 |
|
150 |
|
151 |
while (w->pending == NULL) { /* no pending line */ |
151 |
while (w->pending == NULL) { /* no pending line */ |
152 |
if ((w->line = getline(f, w->buf, sizeof(w->buf))) == NULL) |
152 |
if ((w->line = osw_getline(f, w->buf, sizeof(w->buf))) == NULL) |
153 |
return "error in line read"; /* caller checks EOF */ |
153 |
return "error in line read"; /* caller checks EOF */ |
154 |
if (w->line[0] != '#' && |
154 |
if (w->line[0] != '#' && |
155 |
*(w->line + strspn(w->line, " \t")) != '\0') |
155 |
*(w->line + strspn(w->line, " \t")) != '\0') |
Lines 171-177
Link Here
|
171 |
if (*linep == NULL) |
171 |
if (*linep == NULL) |
172 |
return "out of memory for new line"; |
172 |
return "out of memory for new line"; |
173 |
strcpy(*linep, p); |
173 |
strcpy(*linep, p); |
174 |
} else /* getline already malloced it */ |
174 |
} else /* osw_getline already malloced it */ |
175 |
*linep = p; |
175 |
*linep = p; |
176 |
return NULL; |
176 |
return NULL; |
177 |
} |
177 |
} |
Lines 203-212
Link Here
|
203 |
} |
203 |
} |
204 |
|
204 |
|
205 |
/* |
205 |
/* |
206 |
- getline - read a line from the file, trim newline off |
206 |
- osw_getline - read a line from the file, trim newline off |
207 |
*/ |
207 |
*/ |
208 |
static char * /* pointer to line, NULL for eof/error */ |
208 |
static char * /* pointer to line, NULL for eof/error */ |
209 |
getline(f, buf, bufsize) |
209 |
osw_getline(f, buf, bufsize) |
210 |
FILE *f; |
210 |
FILE *f; |
211 |
char *buf; /* buffer to use, if convenient */ |
211 |
char *buf; /* buffer to use, if convenient */ |
212 |
size_t bufsize; /* size of buf */ |
212 |
size_t bufsize; /* size of buf */ |