blob: c7523a02a1756840c6acc1f8286dcf539a33c3e6 [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Manuel Novoa III cad53642003-03-19 09:13:01 +00002
3/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
4
Denis Vlasenkob6adbf12007-05-26 19:00:18 +00005#include "libbb.h"
Eric Andersencc8ed391999-10-05 16:24:54 +00006
Denis Vlasenko99912ca2007-04-10 15:43:37 +00007/* This is a NOFORK applet. Be very careful! */
8
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +00009int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Rob Landleydfba7412006-03-06 20:47:33 +000010int length_main(int argc, char **argv)
Eric Andersencc8ed391999-10-05 16:24:54 +000011{
Denis Vlasenko99912ca2007-04-10 15:43:37 +000012 if ((argc != 2) || (**(++argv) == '-')) {
13 bb_show_usage();
Manuel Novoa III cad53642003-03-19 09:13:01 +000014 }
15
Denis Vlasenko99912ca2007-04-10 15:43:37 +000016 printf("%u\n", (unsigned)strlen(*argv));
Manuel Novoa III cad53642003-03-19 09:13:01 +000017
Denis Vlasenko99912ca2007-04-10 15:43:37 +000018 return fflush(stdout);
Eric Andersencc8ed391999-10-05 16:24:54 +000019}