rpm2cpio: handle bz2 too; code shrink
[oweals/busybox.git] / coreutils / length.c
index 6413be007f95c30d63c4902a617a2951ddd0f1ef..43a0f59880097e73d8db3df23a4e178077d5db1f 100644 (file)
@@ -1,19 +1,22 @@
 /* vi: set sw=4 ts=4: */
+/*
+ * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ */
 
 /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
 
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "busybox.h"
+#include "libbb.h"
 
+/* This is a NOFORK applet. Be very careful! */
+
+int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int length_main(int argc, char **argv)
 {
-       if ((argc != 2) ||  (**(++argv) == '-')) {
-           bb_show_usage();
+       if ((argc != 2) || (**(++argv) == '-')) {
+               bb_show_usage();
        }
 
-       printf("%lu\n", (unsigned long)strlen(*argv));
+       printf("%u\n", (unsigned)strlen(*argv));
 
-       fflush_stdout_and_exit(EXIT_SUCCESS);
+       return fflush(stdout);
 }