aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-02 16:18:14 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-02 16:18:14 +0100
commit5749328b5634918888474222732572a3e0c97f70 (patch)
tree7690a296f44bc15c7215b0c3d805cedc7c70375b
parent88aa558e5cf31d1b390d68fc40f55b47beac246e (diff)
downloadbusybox-w32-5749328b5634918888474222732572a3e0c97f70.tar.gz
busybox-w32-5749328b5634918888474222732572a3e0c97f70.tar.bz2
busybox-w32-5749328b5634918888474222732572a3e0c97f70.zip
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>
-rw-r--r--coreutils/head.c6
-rw-r--r--include/usage.h61
2 files changed, 33 insertions, 34 deletions
diff --git a/coreutils/head.c b/coreutils/head.c
index 0fab8a8ae..75189eda8 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -20,14 +20,12 @@ static const char head_opts[] ALIGN1 =
20#endif 20#endif
21 ; 21 ;
22 22
23#if ENABLE_FEATURE_FANCY_HEAD
24static const struct suffix_mult head_suffixes[] = { 23static const struct suffix_mult head_suffixes[] = {
25 { "b", 512 }, 24 { "b", 512 },
26 { "k", 1024 }, 25 { "k", 1024 },
27 { "m", 1024*1024 }, 26 { "m", 1024*1024 },
28 { "", 0 } 27 { "", 0 }
29}; 28};
30#endif
31 29
32static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n"; 30static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
33 31
@@ -78,11 +76,7 @@ int head_main(int argc, char **argv)
78#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD 76#if ENABLE_INCLUDE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
79 GET_COUNT: 77 GET_COUNT:
80#endif 78#endif
81#if !ENABLE_FEATURE_FANCY_HEAD
82 count = xatoul(p);
83#else
84 count = xatoul_sfx(p, head_suffixes); 79 count = xatoul_sfx(p, head_suffixes);
85#endif
86 break; 80 break;
87 default: 81 default:
88 bb_show_usage(); 82 bb_show_usage();
diff --git a/include/usage.h b/include/usage.h
index fb983c1cd..4af90c47f 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1659,19 +1659,47 @@
1659 "[OPTIONS] [FILE]..." 1659 "[OPTIONS] [FILE]..."
1660#define head_full_usage "\n\n" \ 1660#define head_full_usage "\n\n" \
1661 "Print first 10 lines of each FILE (or stdin) to stdout.\n" \ 1661 "Print first 10 lines of each FILE (or stdin) to stdout.\n" \
1662 "With more than one FILE, precede each with a header giving the file name.\n" \ 1662 "With more than one FILE, precede each with a filename header.\n" \
1663 "\nOptions:" \ 1663 "\nOptions:" \
1664 "\n -n N Print first N lines instead of first 10" \ 1664 "\n -n N[kbm] Print first N lines" \
1665 IF_FEATURE_FANCY_HEAD( \ 1665 IF_FEATURE_FANCY_HEAD( \
1666 "\n -c N Output the first N bytes" \ 1666 "\n -c N[kbm] Print first N bytes" \
1667 "\n -q Never output headers giving file names" \ 1667 "\n -q Never print headers" \
1668 "\n -v Always output headers giving file names") \ 1668 "\n -v Always print headers" \
1669 ) \
1670 "\n" \
1671 "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \
1669 1672
1670#define head_example_usage \ 1673#define head_example_usage \
1671 "$ head -n 2 /etc/passwd\n" \ 1674 "$ head -n 2 /etc/passwd\n" \
1672 "root:x:0:0:root:/root:/bin/bash\n" \ 1675 "root:x:0:0:root:/root:/bin/bash\n" \
1673 "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n" 1676 "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
1674 1677
1678#define tail_trivial_usage \
1679 "[OPTIONS] [FILE]..."
1680#define tail_full_usage "\n\n" \
1681 "Print last 10 lines of each FILE (or stdin) to stdout.\n" \
1682 "With more than one FILE, precede each with a filename header.\n" \
1683 "\nOptions:" \
1684 "\n -f Print data as file grows" \
1685 IF_FEATURE_FANCY_TAIL( \
1686 "\n -s SECONDS Wait SECONDS between reads with -f" \
1687 ) \
1688 "\n -n N[kbm] Print last N lines" \
1689 IF_FEATURE_FANCY_TAIL( \
1690 "\n -c N[kbm] Print last N bytes" \
1691 "\n -q Never print headers" \
1692 "\n -v Always print headers" \
1693 "\n" \
1694 "\nN may be suffixed by k (x1024), b (x512), or m (x1024^2)." \
1695 "\nIf N starts with a '+', output begins with the Nth item from the start" \
1696 "\nof each file, not from the end." \
1697 ) \
1698
1699#define tail_example_usage \
1700 "$ tail -n 1 /etc/resolv.conf\n" \
1701 "nameserver 10.0.0.1\n"
1702
1675#define hexdump_trivial_usage \ 1703#define hexdump_trivial_usage \
1676 "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." 1704 "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
1677#define hexdump_full_usage "\n\n" \ 1705#define hexdump_full_usage "\n\n" \
@@ -4390,29 +4418,6 @@
4390#define tac_full_usage "\n\n" \ 4418#define tac_full_usage "\n\n" \
4391 "Concatenate FILEs and print them in reverse" 4419 "Concatenate FILEs and print them in reverse"
4392 4420
4393#define tail_trivial_usage \
4394 "[OPTIONS] [FILE]..."
4395#define tail_full_usage "\n\n" \
4396 "Print last 10 lines of each FILE (or stdin) to stdout.\n" \
4397 "With more than one FILE, precede each with a header giving the file name.\n" \
4398 "\nOptions:" \
4399 IF_FEATURE_FANCY_TAIL( \
4400 "\n -c N[kbm] Output last N bytes") \
4401 "\n -n N[kbm] Print last N lines instead of last 10" \
4402 "\n -f Output data as the file grows" \
4403 IF_FEATURE_FANCY_TAIL( \
4404 "\n -q Never output headers giving file names" \
4405 "\n -s SEC Wait SEC seconds between reads with -f" \
4406 "\n -v Always output headers giving file names" \
4407 "\n" \
4408 "\nIf the first character of N (bytes or lines) is a '+', output begins with" \
4409 "\nthe Nth item from the start of each file, otherwise, print the last N items" \
4410 "\nin the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2)." ) \
4411
4412#define tail_example_usage \
4413 "$ tail -n 1 /etc/resolv.conf\n" \
4414 "nameserver 10.0.0.1\n"
4415
4416#define tar_trivial_usage \ 4421#define tar_trivial_usage \
4417 "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \ 4422 "-[" IF_FEATURE_TAR_CREATE("c") "xt" IF_FEATURE_SEAMLESS_GZ("z") \
4418 IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \ 4423 IF_FEATURE_SEAMLESS_BZ2("j") IF_FEATURE_SEAMLESS_LZMA("a") \