length.c 408 B

12345678910111213141516171819
  1. /* vi: set sw=4 ts=4: */
  2. /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
  3. #include "libbb.h"
  4. /* This is a NOFORK applet. Be very careful! */
  5. int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  6. int length_main(int argc, char **argv)
  7. {
  8. if ((argc != 2) || (**(++argv) == '-')) {
  9. bb_show_usage();
  10. }
  11. printf("%u\n", (unsigned)strlen(*argv));
  12. return fflush(stdout);
  13. }