summaryrefslogtreecommitdiff
path: root/coreutils/length.c
diff options
context:
space:
mode:
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);
}