projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- spelling
[oweals/busybox.git]
/
coreutils
/
length.c
diff --git
a/coreutils/length.c
b/coreutils/length.c
index 284bbfdf96ac29b40ad69f871ad25b54bed292ad..55fef131b5c3febe917c633aec0d0867d87c532c 100644
(file)
--- 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 <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#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);
}
}