aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-01-17 00:34:31 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-01-17 00:34:31 +0000
commit2faf306c732609a2fb32a196a1bade1b4f44aa12 (patch)
treef75c6681a480f4551729048f2dbcd872bfd6a8e5
parent16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4 (diff)
downloadbusybox-2faf306c732609a2fb32a196a1bade1b4f44aa12.tar.gz
Use bb_get_chomped_line_from_file
-rw-r--r--networking/inetd.c21
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, ...)
}
static FILE *fconfig;
-static char line[256];
static FILE *
setconfig(void)
@@ -320,20 +319,6 @@ setconfig(void)
}
static char *
-nextline(void)
-{
- char *cp;
- FILE *fd = fconfig;
-
- if (fgets(line, sizeof (line), fd) == NULL)
- return ((char *)0);
- cp = strchr(line, '\n');
- if (cp)
- *cp = '\0';
- return (line);
-}
-
-static char *
skip(char **cpp)
{
char *cp = *cpp;
@@ -351,7 +336,8 @@ again:
c = getc(fconfig);
(void) ungetc(c, fconfig);
if (c == ' ' || c == '\t')
- if ((cp = nextline()) != NULL)
+ cp = bb_get_chomped_line_from_file(fconfig);
+ if (cp != NULL)
goto again;
*cpp = NULL;
return NULL;
@@ -385,8 +371,7 @@ getconfigent(void)
char *cp, *arg;
more:
- while ((cp = nextline()) && *cp == '#')
- ;
+ while ((cp = bb_get_chomped_line_from_file(fconfig)) && *cp == '#');
if (cp == NULL)
return ((struct servtab *)0);
memset((char *)sep, 0, sizeof *sep);