blob: 43a0f59880097e73d8db3df23a4e178077d5db1f [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Denis Vlasenkodb12d1d2008-12-07 00:52:58 +00002/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details.
4 */
Manuel Novoa III cad53642003-03-19 09:13:01 +00005
6/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
7
Denis Vlasenkob6adbf12007-05-26 19:00:18 +00008#include "libbb.h"
Eric Andersencc8ed391999-10-05 16:24:54 +00009
Denis Vlasenko99912ca2007-04-10 15:43:37 +000010/* This is a NOFORK applet. Be very careful! */
11
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000012int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Rob Landleydfba7412006-03-06 20:47:33 +000013int length_main(int argc, char **argv)
Eric Andersencc8ed391999-10-05 16:24:54 +000014{
Denis Vlasenko99912ca2007-04-10 15:43:37 +000015 if ((argc != 2) || (**(++argv) == '-')) {
16 bb_show_usage();
Manuel Novoa III cad53642003-03-19 09:13:01 +000017 }
18
Denis Vlasenko99912ca2007-04-10 15:43:37 +000019 printf("%u\n", (unsigned)strlen(*argv));
Manuel Novoa III cad53642003-03-19 09:13:01 +000020
Denis Vlasenko99912ca2007-04-10 15:43:37 +000021 return fflush(stdout);
Eric Andersencc8ed391999-10-05 16:24:54 +000022}