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:
parent
88aa558e5c
commit
5749328b56
@ -20,14 +20,12 @@ static const char head_opts[] ALIGN1 =
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
#if ENABLE_FEATURE_FANCY_HEAD
|
|
||||||
static const struct suffix_mult head_suffixes[] = {
|
static const struct suffix_mult head_suffixes[] = {
|
||||||
{ "b", 512 },
|
{ "b", 512 },
|
||||||
{ "k", 1024 },
|
{ "k", 1024 },
|
||||||
{ "m", 1024*1024 },
|
{ "m", 1024*1024 },
|
||||||
{ "", 0 }
|
{ "", 0 }
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
|
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
|
#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
|
||||||
GET_COUNT:
|
GET_COUNT:
|
||||||
#endif
|
#endif
|
||||||
#if !ENABLE_FEATURE_FANCY_HEAD
|
|
||||||
count = xatoul(p);
|
|
||||||
#else
|
|
||||||
count = xatoul_sfx(p, head_suffixes);
|
count = xatoul_sfx(p, head_suffixes);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
@ -1659,19 +1659,47 @@
|
|||||||
"[OPTIONS] [FILE]..."
|
"[OPTIONS] [FILE]..."
|
||||||
#define head_full_usage "\n\n" \
|
#define head_full_usage "\n\n" \
|
||||||
"Print first 10 lines of each FILE (or stdin) to stdout.\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:" \
|
"\nOptions:" \
|
||||||
"\n -n N Print first N lines instead of first 10" \
|
"\n -n N[kbm] Print first N lines" \
|
||||||
IF_FEATURE_FANCY_HEAD( \
|
IF_FEATURE_FANCY_HEAD( \
|
||||||
"\n -c N Output the first N bytes" \
|
"\n -c N[kbm] Print first N bytes" \
|
||||||
"\n -q Never output headers giving file names" \
|
"\n -q Never print headers" \
|
||||||
"\n -v Always output headers giving file names") \
|
"\n -v Always print headers" \
|
||||||
|
) \
|
||||||
|
"\n" \
|
||||||
|
"\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \
|
||||||
|
|
||||||
#define head_example_usage \
|
#define head_example_usage \
|
||||||
"$ head -n 2 /etc/passwd\n" \
|
"$ head -n 2 /etc/passwd\n" \
|
||||||
"root:x:0:0:root:/root:/bin/bash\n" \
|
"root:x:0:0:root:/root:/bin/bash\n" \
|
||||||
"daemon:x:1:1:daemon:/usr/sbin:/bin/sh\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 \
|
#define hexdump_trivial_usage \
|
||||||
"[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
|
"[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
|
||||||
#define hexdump_full_usage "\n\n" \
|
#define hexdump_full_usage "\n\n" \
|
||||||
@ -4390,29 +4418,6 @@
|
|||||||
#define tac_full_usage "\n\n" \
|
#define tac_full_usage "\n\n" \
|
||||||
"Concatenate FILEs and print them in reverse"
|
"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 \
|
#define tar_trivial_usage \
|
||||||
"-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \
|
"-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \
|
||||||
IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \
|
IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user