diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-17 00:34:31 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-17 00:34:31 +0000 |
commit | 2faf306c732609a2fb32a196a1bade1b4f44aa12 (patch) | |
tree | f75c6681a480f4551729048f2dbcd872bfd6a8e5 /networking/inetd.c | |
parent | 16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4 (diff) | |
download | busybox-w32-2faf306c732609a2fb32a196a1bade1b4f44aa12.tar.gz busybox-w32-2faf306c732609a2fb32a196a1bade1b4f44aa12.tar.bz2 busybox-w32-2faf306c732609a2fb32a196a1bade1b4f44aa12.zip |
Use bb_get_chomped_line_from_file
Diffstat (limited to 'networking/inetd.c')
-rw-r--r-- | networking/inetd.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 4c46495a6..4e3c3431e 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -302,7 +302,6 @@ syslog_err_and_discard_dg(int se_socktype, const char *msg, ...) | |||
302 | } | 302 | } |
303 | 303 | ||
304 | static FILE *fconfig; | 304 | static FILE *fconfig; |
305 | static char line[256]; | ||
306 | 305 | ||
307 | static FILE * | 306 | static FILE * |
308 | setconfig(void) | 307 | setconfig(void) |
@@ -320,20 +319,6 @@ setconfig(void) | |||
320 | } | 319 | } |
321 | 320 | ||
322 | static char * | 321 | static char * |
323 | nextline(void) | ||
324 | { | ||
325 | char *cp; | ||
326 | FILE *fd = fconfig; | ||
327 | |||
328 | if (fgets(line, sizeof (line), fd) == NULL) | ||
329 | return ((char *)0); | ||
330 | cp = strchr(line, '\n'); | ||
331 | if (cp) | ||
332 | *cp = '\0'; | ||
333 | return (line); | ||
334 | } | ||
335 | |||
336 | static char * | ||
337 | skip(char **cpp) | 322 | skip(char **cpp) |
338 | { | 323 | { |
339 | char *cp = *cpp; | 324 | char *cp = *cpp; |
@@ -351,7 +336,8 @@ again: | |||
351 | c = getc(fconfig); | 336 | c = getc(fconfig); |
352 | (void) ungetc(c, fconfig); | 337 | (void) ungetc(c, fconfig); |
353 | if (c == ' ' || c == '\t') | 338 | if (c == ' ' || c == '\t') |
354 | if ((cp = nextline()) != NULL) | 339 | cp = bb_get_chomped_line_from_file(fconfig); |
340 | if (cp != NULL) | ||
355 | goto again; | 341 | goto again; |
356 | *cpp = NULL; | 342 | *cpp = NULL; |
357 | return NULL; | 343 | return NULL; |
@@ -385,8 +371,7 @@ getconfigent(void) | |||
385 | char *cp, *arg; | 371 | char *cp, *arg; |
386 | 372 | ||
387 | more: | 373 | more: |
388 | while ((cp = nextline()) && *cp == '#') | 374 | while ((cp = bb_get_chomped_line_from_file(fconfig)) && *cp == '#'); |
389 | ; | ||
390 | if (cp == NULL) | 375 | if (cp == NULL) |
391 | return ((struct servtab *)0); | 376 | return ((struct servtab *)0); |
392 | memset((char *)sep, 0, sizeof *sep); | 377 | memset((char *)sep, 0, sizeof *sep); |