aboutsummaryrefslogtreecommitdiff
path: root/coreutils/length.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/length.c')
-rw-r--r--coreutils/length.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/coreutils/length.c b/coreutils/length.c
new file mode 100644
index 000000000..6413be007
--- /dev/null
+++ b/coreutils/length.c
@@ -0,0 +1,19 @@
1/* vi: set sw=4 ts=4: */
2
3/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
4
5#include <stdlib.h>
6#include <string.h>
7#include <stdio.h>
8#include "busybox.h"
9
10int length_main(int argc, char **argv)
11{
12 if ((argc != 2) || (**(++argv) == '-')) {
13 bb_show_usage();
14 }
15
16 printf("%lu\n", (unsigned long)strlen(*argv));
17
18 fflush_stdout_and_exit(EXIT_SUCCESS);
19}