head,tail: trim help text; make suffixes unconditional for head too

function                                             old     new   delta
packed_usage                                       26411   26375     -36

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-03-02 16:18:14 +01:00
parent 88aa558e5c
commit 5749328b56
2 changed files with 33 additions and 34 deletions

View File

@ -20,14 +20,12 @@ static const char head_opts[] ALIGN1 =
#endif
;
#if ENABLE_FEATURE_FANCY_HEAD
static const struct suffix_mult head_suffixes[] = {
{ "b", 512 },
{ "k", 1024 },
{ "m", 1024*1024 },
{ "", 0 }
};
#endif
static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
@ -78,11 +76,7 @@ int head_main(int argc, char **argv)
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
GET_COUNT:
#endif
#if !ENABLE_FEATURE_FANCY_HEAD
count = xatoul(p);
#else
count = xatoul_sfx(p, head_suffixes);
#endif
break;
default:
bb_show_usage();

View File

@ -1659,19 +1659,47 @@
"[OPTIONS] [FILE]..."
#define head_full_usage "\n\n" \
"Print first 10 lines of each FILE (or stdin) to stdout.\n" \
"With more than one FILE, precede each with a header giving the file name.\n" \
"With more than one FILE, precede each with a filename header.\n" \
"\nOptions:" \
"\n -n N Print first N lines instead of first 10" \
"\n -n N[kbm] Print first N lines" \
IF_FEATURE_FANCY_HEAD( \
"\n -c N Output the first N bytes" \
"\n -q Never output headers giving file names" \
"\n -v Always output headers giving file names") \
"\n -c N[kbm] Print first N bytes" \
"\n -q Never print headers" \
"\n -v Always print headers" \
) \
"\n" \
"\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \
#define head_example_usage \
"$ head -n 2 /etc/passwd\n" \
"root:x:0:0:root:/root:/bin/bash\n" \
"daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
#define tail_trivial_usage \
"[OPTIONS] [FILE]..."
#define tail_full_usage "\n\n" \
"Print last 10 lines of each FILE (or stdin) to stdout.\n" \
"With more than one FILE, precede each with a filename header.\n" \
"\nOptions:" \
"\n -f Print data as file grows" \
IF_FEATURE_FANCY_TAIL( \
"\n -s SECONDS Wait SECONDS between reads with -f" \
) \
"\n -n N[kbm] Print last N lines" \
IF_FEATURE_FANCY_TAIL( \
"\n -c N[kbm] Print last N bytes" \
"\n -q Never print headers" \
"\n -v Always print headers" \
"\n" \
"\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \
"\nIf N starts with a '+', output begins with the Nth item from the start" \
"\nof each file, not from the end." \
) \
#define tail_example_usage \
"$ tail -n 1 /etc/resolv.conf\n" \
"nameserver 10.0.0.1\n"
#define hexdump_trivial_usage \
"[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
#define hexdump_full_usage "\n\n" \
@ -4390,29 +4418,6 @@
#define tac_full_usage "\n\n" \
"Concatenate FILEs and print them in reverse"
#define tail_trivial_usage \
"[OPTIONS] [FILE]..."
#define tail_full_usage "\n\n" \
"Print last 10 lines of each FILE (or stdin) to stdout.\n" \
"With more than one FILE, precede each with a header giving the file name.\n" \
"\nOptions:" \
IF_FEATURE_FANCY_TAIL( \
"\n -c N[kbm] Output last N bytes") \
"\n -n N[kbm] Print last N lines instead of last 10" \
"\n -f Output data as the file grows" \
IF_FEATURE_FANCY_TAIL( \
"\n -q Never output headers giving file names" \
"\n -s SEC Wait SEC seconds between reads with -f" \
"\n -v Always output headers giving file names" \
"\n" \
"\nIf the first character of N (bytes or lines) is a '+', output begins with" \
"\nthe Nth item from the start of each file, otherwise, print the last N items" \
"\nin the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." ) \
#define tail_example_usage \
"$ tail -n 1 /etc/resolv.conf\n" \
"nameserver 10.0.0.1\n"
#define tar_trivial_usage \
"-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \
IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \