length.c 387 B

12345678910111213141516171819
  1. /* vi: set sw=4 ts=4: */
  2. /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <stdio.h>
  6. #include "busybox.h"
  7. int length_main(int argc, char **argv)
  8. {
  9. if ((argc != 2) || (**(++argv) == '-')) {
  10. bb_show_usage();
  11. }
  12. bb_printf("%lu\n", (unsigned long)strlen(*argv));
  13. bb_fflush_stdout_and_exit(EXIT_SUCCESS);
  14. }