CONFIG

Denys Vlasenko vda.linux at googlemail.com
Thu Jul 24 23:46:15 UTC 2008


On Thursday 24 July 2008 22:41, dronnikov at gmail.com wrote:
> inetd converted, first draft: -290 bytes.

+ 	if (!config_read(parser, token, 6+MAXARGV, 6, "# \t", 0)) {
 		free(sep);
 		return NULL;
 	}
 
-	arg = next_word(&cp);
-	if (arg == NULL) /* a blank line. */
-		goto more;
-
 	/* [host:]service socktype proto wait user[:group] prog [args] */
 	/* Check for "host:...." line */
+	arg = token[0];
 	hostdelim = strrchr(arg, ':');
 	if (hostdelim) {
 		*hostdelim = '\0';
 		sep->se_local_hostname = xstrdup(arg);
 		arg = hostdelim + 1;
-		if (*arg == '\0') {
-			arg = next_word(&cp);
-			if (arg == NULL) {
-				/* Line has just "host:", change the
-				 * default host for the following lines. */
-				free(default_local_hostname);
-				default_local_hostname = sep->se_local_hostname;
-				goto more;
-			}
+		if (*arg == '\0' && !token[1]) {
+			/* Line has just "host:", change the
+			 * default host for the following lines. */
+			free(default_local_hostname);
+			default_local_hostname = sep->se_local_hostname;
+			goto more;
 		}

!token[1] is never true. You asked for minimum 6 tokens.
--
vda



More information about the busybox mailing list