X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Flength.c;h=55fef131b5c3febe917c633aec0d0867d87c532c;hb=5929edc1fac4340f99ed84e92bf3a2bedd4177c2;hp=284bbfdf96ac29b40ad69f871ad25b54bed292ad;hpb=cc8ed39b240180b58810784f844e253263594ac3;p=oweals%2Fbusybox.git diff --git a/coreutils/length.c b/coreutils/length.c index 284bbfdf9..55fef131b 100644 --- a/coreutils/length.c +++ b/coreutils/length.c @@ -1,13 +1,19 @@ -#include "internal.h" +/* vi: set sw=4 ts=4: */ + +/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ + #include #include #include +#include "busybox.h" -const char length_usage[] = "length string"; - -int -length_main(struct FileInfo * i, int argc, char * * argv) +int length_main(int argc, char **argv) { - printf("%d\n", strlen(argv[1])); - return 0; + if ((argc != 2) || (**(++argv) == '-')) { + bb_show_usage(); + } + + bb_printf("%lu\n", (unsigned long)strlen(*argv)); + + bb_fflush_stdout_and_exit(EXIT_SUCCESS); }