diff options
author | Jeremie Le Hen <jlh@FreeBSD.org> | 2013-02-08 22:23:22 +0000 |
---|---|---|
committer | Jeremie Le Hen <jlh@FreeBSD.org> | 2013-02-08 22:23:22 +0000 |
commit | 097e26837dbe8db1057b1cd0f1b513107995b8fa (patch) | |
tree | 54abaab91884da8fa826bd0e7e3580d231fa6e86 /usr.bin | |
parent | 184f46a4ce5694d9de947218a34fd945a98cd652 (diff) | |
download | src-097e26837dbe8db1057b1cd0f1b513107995b8fa.tar.gz src-097e26837dbe8db1057b1cd0f1b513107995b8fa.zip |
MFC r245418:
Allow commands without any additional arguments, as stated in the
manpage. While here, exit early when there is nothing to do.
PR: 168415
Submitted by: Zhihao Yuan (initial version)
MFC r245419:
Remove stray tabs.
Submitted by: kib
Notes
Notes:
svn path=/stable/8/; revision=246567
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/stdbuf/stdbuf.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/stdbuf/stdbuf.c b/usr.bin/stdbuf/stdbuf.c index 3831b5e3ba66..4346cc85f1a1 100644 --- a/usr.bin/stdbuf/stdbuf.c +++ b/usr.bin/stdbuf/stdbuf.c @@ -39,7 +39,7 @@ extern char *__progname; 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 @@ main(int argc, char *argv[]) } 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 @@ main(int argc, char *argv[]) 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); |