summaryrefslogtreecommitdiff
path: root/coreutils/length.c
diff options
context:
space:
mode:
authorManuel Novoa III2003-03-19 09:13:01 +0000
committerManuel Novoa III2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /coreutils/length.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
busybox-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
Major coreutils update.
Diffstat (limited to 'coreutils/length.c')
-rw-r--r--coreutils/length.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/coreutils/length.c b/coreutils/length.c
index 73becd2..bce43ab 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -1,4 +1,7 @@
/* vi: set sw=4 ts=4: */
+
+/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -6,8 +9,11 @@
extern int length_main(int argc, char **argv)
{
- if (argc != 2 || **(argv + 1) == '-')
- show_usage();
- printf("%lu\n", (long)strlen(argv[1]));
- return EXIT_SUCCESS;
+ if ((argc != 2) || (**(++argv) == '-')) {
+ bb_show_usage();
+ }
+
+ bb_printf("%lu\n", (unsigned long)strlen(*argv));
+
+ bb_fflush_stdout_and_exit(EXIT_SUCCESS);
}