[Midnightbsd-cvs] src [8765] trunk/usr.bin/stdbuf/stdbuf.c: Allow commands without any additional arguments, as stated in teh manpage.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 25 22:44:11 EDT 2016


Revision: 8765
          http://svnweb.midnightbsd.org/src/?rev=8765
Author:   laffer1
Date:     2016-09-25 22:44:11 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
Allow commands without any additional arguments, as stated in teh manpage.

Modified Paths:
--------------
    trunk/usr.bin/stdbuf/stdbuf.c

Modified: trunk/usr.bin/stdbuf/stdbuf.c
===================================================================
--- trunk/usr.bin/stdbuf/stdbuf.c	2016-09-26 02:43:38 UTC (rev 8764)
+++ trunk/usr.bin/stdbuf/stdbuf.c	2016-09-26 02:44:11 UTC (rev 8765)
@@ -39,7 +39,7 @@
 static void
 usage(int s)
 {
-	
+
 	fprintf(stderr, "Usage: %s [-e 0|L|<sz>] [-i 0|L|<sz>] [-o 0|L|<sz>] "
 	    "<cmd> [args ...]\n", __progname);
 	exit(s);
@@ -72,8 +72,8 @@
 	}
 	argc -= optind;
 	argv += optind;
-	if (argc < 2)
-		usage(0);
+	if (argc == 0)
+		exit(0);
 
 	if (ibuf != NULL && setenv("_STDBUF_I", ibuf, 1) == -1)
 		warn("Failed to set environment variable: %s=%s",
@@ -94,7 +94,7 @@
 
 	if (i < 0 || putenv(preload1) == -1)
 		warn("Failed to set environment variable: LD_PRELOAD");
-	
+
 	preload0 = getenv("LD_32_PRELOAD");
 	if (preload0 == NULL)
 		i = asprintf(&preload1, "LD_32_PRELOAD=" LIBSTDBUF32);



More information about the Midnightbsd-cvs mailing list