Use bb_get_chomped_line_from_file
This commit is contained in:
parent
16f94a6722
commit
2faf306c73
@ -302,7 +302,6 @@ syslog_err_and_discard_dg(int se_socktype, const char *msg, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static FILE *fconfig;
|
static FILE *fconfig;
|
||||||
static char line[256];
|
|
||||||
|
|
||||||
static FILE *
|
static FILE *
|
||||||
setconfig(void)
|
setconfig(void)
|
||||||
@ -319,20 +318,6 @@ setconfig(void)
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 *
|
static char *
|
||||||
skip(char **cpp)
|
skip(char **cpp)
|
||||||
{
|
{
|
||||||
@ -351,7 +336,8 @@ again:
|
|||||||
c = getc(fconfig);
|
c = getc(fconfig);
|
||||||
(void) ungetc(c, fconfig);
|
(void) ungetc(c, fconfig);
|
||||||
if (c == ' ' || c == '\t')
|
if (c == ' ' || c == '\t')
|
||||||
if ((cp = nextline()) != NULL)
|
cp = bb_get_chomped_line_from_file(fconfig);
|
||||||
|
if (cp != NULL)
|
||||||
goto again;
|
goto again;
|
||||||
*cpp = NULL;
|
*cpp = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -385,8 +371,7 @@ getconfigent(void)
|
|||||||
char *cp, *arg;
|
char *cp, *arg;
|
||||||
|
|
||||||
more:
|
more:
|
||||||
while ((cp = nextline()) && *cp == '#')
|
while ((cp = bb_get_chomped_line_from_file(fconfig)) && *cp == '#');
|
||||||
;
|
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
return ((struct servtab *)0);
|
return ((struct servtab *)0);
|
||||||
memset((char *)sep, 0, sizeof *sep);
|
memset((char *)sep, 0, sizeof *sep);
|
||||||
|
Loading…
Reference in New Issue
Block a user