[BusyBox-cvs] busybox/networking inetd.c,1.6,1.7

Glenn McGrath bug1 at busybox.net
Sat Jan 17 00:34:34 UTC 2004


Update of /var/cvs/busybox/networking
In directory nail:/tmp/cvs-serv30647

Modified Files:
	inetd.c 
Log Message:
Use bb_get_chomped_line_from_file


Index: inetd.c
===================================================================
RCS file: /var/cvs/busybox/networking/inetd.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- inetd.c	28 Jul 2003 09:31:27 -0000	1.6
+++ inetd.c	17 Jan 2004 00:34:31 -0000	1.7
@@ -302,7 +302,6 @@
 }
 
 static FILE *fconfig;
-static char line[256];
 
 static FILE *
 setconfig(void)
@@ -320,20 +319,6 @@
 }
 
 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 @@
 		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 @@
 	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);




More information about the busybox-cvs mailing list