diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/du.c | 4 | ||||
-rw-r--r-- | coreutils/head.c | 28 | ||||
-rw-r--r-- | coreutils/mkdir.c | 3 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/uniq.c | 4 | ||||
-rw-r--r-- | coreutils/wc.c | 1 |
6 files changed, 23 insertions, 21 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index ec03afd95..79b553643 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -35,7 +35,7 @@ | |||
35 | typedef void (Display)(size_t, char *); | 35 | typedef void (Display)(size_t, char *); |
36 | 36 | ||
37 | static const char du_usage[] = | 37 | static const char du_usage[] = |
38 | "Usage: du [OPTION]... [FILE]...\n\n" | 38 | "du [OPTION]... [FILE]...\n\n" |
39 | "\t-s\tdisplay only a total for each argument\n" | 39 | "\t-s\tdisplay only a total for each argument\n" |
40 | ; | 40 | ; |
41 | 41 | ||
@@ -140,4 +140,4 @@ du_main(int argc, char **argv) | |||
140 | exit(0); | 140 | exit(0); |
141 | } | 141 | } |
142 | 142 | ||
143 | /* $Id: du.c,v 1.8 1999/12/17 18:44:15 erik Exp $ */ | 143 | /* $Id: du.c,v 1.9 2000/01/23 18:19:02 erik Exp $ */ |
diff --git a/coreutils/head.c b/coreutils/head.c index 7f08a8041..4e58bdcd7 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -26,10 +26,12 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | 27 | ||
28 | const char head_usage[] = | 28 | const char head_usage[] = |
29 | "Usage: head [FILE]...\n\n" | 29 | "head [OPTION] [FILE]...\n\n" |
30 | "Print first 10 lines of each FILE to standard output.\n" | 30 | "Print first 10 lines of each FILE to standard output.\n" |
31 | "With more than one FILE, precede each with a header giving the\n" | 31 | "With more than one FILE, precede each with a header giving the\n" |
32 | "file name. With no FILE, or when FILE is -, read standard input.\n"; | 32 | "file name. With no FILE, or when FILE is -, read standard input.\n\n" |
33 | "Options:\n" | ||
34 | "\t-n NUM\t\tPrint first NUM lines instead of first 10\n"; | ||
33 | 35 | ||
34 | int | 36 | int |
35 | head(int len, FILE *src) | 37 | head(int len, FILE *src) |
@@ -49,22 +51,22 @@ head(int len, FILE *src) | |||
49 | int | 51 | int |
50 | head_main(int argc, char **argv) | 52 | head_main(int argc, char **argv) |
51 | { | 53 | { |
52 | int i = 1; | ||
53 | char opt; | 54 | char opt; |
54 | int len = 10; | 55 | int len = 10, tmplen, i; |
55 | |||
56 | /* 1st option is potentially special */ | ||
57 | if ((argc > 1) && (argv[1][0] == '-') && isDecimal(argv[1][1])) { | ||
58 | int tmplen = atoi(&argv[1][1]); | ||
59 | if (tmplen) { len = tmplen; } | ||
60 | i = 2; | ||
61 | } | ||
62 | 56 | ||
63 | /* parse argv[] */ | 57 | /* parse argv[] */ |
64 | for ( ; i < argc; i++) { | 58 | for (i = 1; i < argc; i++) { |
65 | if (argv[i][0] == '-') { | 59 | if (argv[i][0] == '-') { |
66 | opt = argv[i][1]; | 60 | opt = argv[i][1]; |
67 | switch (opt) { | 61 | switch (opt) { |
62 | case 'n': | ||
63 | tmplen = 0; | ||
64 | if (i++ < argc) | ||
65 | tmplen = atoi(argv[i]); | ||
66 | if (tmplen < 1) | ||
67 | usage(head_usage); | ||
68 | len = tmplen; | ||
69 | break; | ||
68 | case '-': | 70 | case '-': |
69 | case 'h': | 71 | case 'h': |
70 | usage(head_usage); | 72 | usage(head_usage); |
@@ -103,4 +105,4 @@ head_main(int argc, char **argv) | |||
103 | exit(0); | 105 | exit(0); |
104 | } | 106 | } |
105 | 107 | ||
106 | /* $Id: head.c,v 1.4 1999/12/17 18:52:06 erik Exp $ */ | 108 | /* $Id: head.c,v 1.5 2000/01/23 18:19:02 erik Exp $ */ |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index dc245a18e..017ef9b08 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -26,7 +26,8 @@ | |||
26 | #include <errno.h> | 26 | #include <errno.h> |
27 | #include <sys/param.h> | 27 | #include <sys/param.h> |
28 | 28 | ||
29 | static const char mkdir_usage[] = "Usage: mkdir [OPTION] DIRECTORY...\n\n" | 29 | static const char mkdir_usage[] = |
30 | "mkdir [OPTION] DIRECTORY...\n\n" | ||
30 | "Create the DIRECTORY(ies), if they do not already exist\n\n" | 31 | "Create the DIRECTORY(ies), if they do not already exist\n\n" |
31 | "Options:\n" | 32 | "Options:\n" |
32 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" | 33 | "\t-m\tset permission mode (as in chmod), not rwxrwxrwx - umask\n" |
diff --git a/coreutils/sort.c b/coreutils/sort.c index 0fe7bf99b..4df5627ac 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | static const char sort_usage[] = | 31 | static const char sort_usage[] = |
32 | "Usage: sort [OPTION]... [FILE]...\n\n" | 32 | "sort [OPTION]... [FILE]...\n\n" |
33 | ; | 33 | ; |
34 | 34 | ||
35 | /* typedefs _______________________________________________________________ */ | 35 | /* typedefs _______________________________________________________________ */ |
@@ -309,4 +309,4 @@ sort_main(int argc, char **argv) | |||
309 | exit(0); | 309 | exit(0); |
310 | } | 310 | } |
311 | 311 | ||
312 | /* $Id: sort.c,v 1.8 1999/12/23 22:46:10 beppu Exp $ */ | 312 | /* $Id: sort.c,v 1.9 2000/01/23 18:19:02 erik Exp $ */ |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 034ea316e..a7bff54ec 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | 28 | ||
29 | static const char uniq_usage[] = | 29 | static const char uniq_usage[] = |
30 | "Usage: uniq [OPTION]... [INPUT [OUTPUT]]\n" | 30 | "uniq [OPTION]... [INPUT [OUTPUT]]\n" |
31 | "Discard all but one of successive identical lines from INPUT (or\n" | 31 | "Discard all but one of successive identical lines from INPUT (or\n" |
32 | "standard input), writing to OUTPUT (or standard output).\n" | 32 | "standard input), writing to OUTPUT (or standard output).\n" |
33 | "\n" | 33 | "\n" |
@@ -193,4 +193,4 @@ uniq_main(int argc, char **argv) | |||
193 | exit(0); | 193 | exit(0); |
194 | } | 194 | } |
195 | 195 | ||
196 | /* $Id: uniq.c,v 1.4 2000/01/07 01:57:32 beppu Exp $ */ | 196 | /* $Id: uniq.c,v 1.5 2000/01/23 18:19:02 erik Exp $ */ |
diff --git a/coreutils/wc.c b/coreutils/wc.c index a1e2fca56..e69f0d899 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -28,7 +28,6 @@ static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" | |||
28 | "\t-c\tprint the byte counts\n" | 28 | "\t-c\tprint the byte counts\n" |
29 | "\t-l\tprint the newline counts\n" | 29 | "\t-l\tprint the newline counts\n" |
30 | "\t-L\tprint the length of the longest line\n" | 30 | "\t-L\tprint the length of the longest line\n" |
31 | "\t-L\tprint the length of the longest line\n" | ||
32 | "\t-w\tprint the word counts\n"; | 31 | "\t-w\tprint the word counts\n"; |
33 | 32 | ||
34 | static int total_lines, total_words, total_chars, max_length; | 33 | static int total_lines, total_words, total_chars, max_length; |