blob: 82f50c159cd813bf03b4ab2abfaeb5d50b728c59 [file] [log] [blame]
Erik Andersene49d5ec2000-02-08 19:58:47 +00001/* vi: set sw=4 ts=4: */
Eric Andersencc8ed391999-10-05 16:24:54 +00002#include "internal.h"
3#include <stdlib.h>
4#include <string.h>
5#include <stdio.h>
6
Matt Kraai3bd8bd82000-07-14 23:28:47 +00007const char length_usage[] =
8 "length STRING\n"
9#ifndef BB_FEATURE_TRIVIAL_HELP
10 "\nPrints out the length of the specified STRING.\n"
11#endif
12 ;
13
Erik Andersene49d5ec2000-02-08 19:58:47 +000014extern int length_main(int argc, char **argv)
Eric Andersencc8ed391999-10-05 16:24:54 +000015{
Matt Kraai3bd8bd82000-07-14 23:28:47 +000016 if (argc != 2 || **(argv + 1) == '-')
17 usage(length_usage);
Erik Andersen1d1d9502000-04-21 01:26:49 +000018 printf("%lu\n", (long)strlen(argv[1]));
Erik Andersene49d5ec2000-02-08 19:58:47 +000019 return (TRUE);
Eric Andersencc8ed391999-10-05 16:24:54 +000020}