aboutsummaryrefslogtreecommitdiff
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 73becd28a..bce43ab3f 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -1,4 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2
3/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
4
2#include <stdlib.h> 5#include <stdlib.h>
3#include <string.h> 6#include <string.h>
4#include <stdio.h> 7#include <stdio.h>
@@ -6,8 +9,11 @@
6 9
7extern int length_main(int argc, char **argv) 10extern int length_main(int argc, char **argv)
8{ 11{
9 if (argc != 2 || **(argv + 1) == '-') 12 if ((argc != 2) || (**(++argv) == '-')) {
10 show_usage(); 13 bb_show_usage();
11 printf("%lu\n", (long)strlen(argv[1])); 14 }
12 return EXIT_SUCCESS; 15
16 bb_printf("%lu\n", (unsigned long)strlen(*argv));
17
18 bb_fflush_stdout_and_exit(EXIT_SUCCESS);
13} 19}