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, 8 insertions, 6 deletions
diff --git a/coreutils/length.c b/coreutils/length.c
index 284bbfd..f2dadd2 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -3,11 +3,13 @@
#include <string.h>
#include <stdio.h>
-const char length_usage[] = "length string";
-
-int
-length_main(struct FileInfo * i, int argc, char * * argv)
+extern int
+length_main(int argc, char * * argv)
{
- printf("%d\n", strlen(argv[1]));
- return 0;
+ if ( **(argv+1) == '-' ) {
+ fprintf(stderr, "Usage: length string\n");
+ exit(FALSE);
+ }
+ printf("%d\n", strlen(argv[1]));
+ return( TRUE);
}