diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-05-10 05:05:45 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-05-10 05:05:45 +0000 |
commit | 59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c (patch) | |
tree | 8db9c40b68387c1017007f5265e45c2a66ccfb0d | |
parent | ac130e1dca289c431c43b6efee4b3d9f2b367c87 (diff) | |
download | busybox-w32-59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c.tar.gz busybox-w32-59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c.tar.bz2 busybox-w32-59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c.zip |
* cp -fa now works as expected for symlinks (it didn't before)
* zcat works again (wasn't working since option parsing was broken)
* more doc updates/more support for BB_FEATURE_SIMPLE_HELP
-Erik
-rw-r--r-- | Changelog | 3 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | archival/gunzip.c | 9 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 6 | ||||
-rw-r--r-- | coreutils/dd.c | 18 | ||||
-rw-r--r-- | coreutils/df.c | 7 | ||||
-rw-r--r-- | coreutils/dirname.c | 6 | ||||
-rw-r--r-- | coreutils/du.c | 11 | ||||
-rw-r--r-- | coreutils/echo.c | 9 | ||||
-rw-r--r-- | cp_mv.c | 7 | ||||
-rw-r--r-- | dd.c | 18 | ||||
-rw-r--r-- | deallocvt.c | 6 | ||||
-rw-r--r-- | df.c | 7 | ||||
-rw-r--r-- | dirname.c | 6 | ||||
-rw-r--r-- | dmesg.c | 10 | ||||
-rw-r--r-- | du.c | 11 | ||||
-rw-r--r-- | dutmp.c | 9 | ||||
-rw-r--r-- | echo.c | 9 | ||||
-rw-r--r-- | gunzip.c | 9 | ||||
-rw-r--r-- | internal.h | 4 | ||||
-rw-r--r-- | miscutils/dutmp.c | 9 | ||||
-rw-r--r-- | util-linux/dmesg.c | 10 | ||||
-rw-r--r-- | utility.c | 20 |
24 files changed, 135 insertions, 73 deletions
@@ -27,6 +27,9 @@ | |||
27 | * Fixed basename to support stripping of suffixes. Patch thanks | 27 | * Fixed basename to support stripping of suffixes. Patch thanks |
28 | to xiong jianxin <jxiong@uiuc.edu> | 28 | to xiong jianxin <jxiong@uiuc.edu> |
29 | * More doc updates | 29 | * More doc updates |
30 | * cp -fa now works as expected for symlinks (it didn't before) | ||
31 | * zcat now works (wasn't working since option parsing was broken) | ||
32 | |||
30 | 33 | ||
31 | -Erik | 34 | -Erik |
32 | 35 | ||
@@ -26,7 +26,7 @@ export VERSION | |||
26 | # Set the following to `true' to make a debuggable build. | 26 | # Set the following to `true' to make a debuggable build. |
27 | # Leave this set to `false' for production use. | 27 | # Leave this set to `false' for production use. |
28 | # eg: `make DODEBUG=true tests' | 28 | # eg: `make DODEBUG=true tests' |
29 | DODEBUG = false | 29 | DODEBUG = true |
30 | 30 | ||
31 | # If you want a static binary, turn this on. | 31 | # If you want a static binary, turn this on. |
32 | DOSTATIC = false | 32 | DOSTATIC = false |
@@ -17,8 +17,6 @@ around to it some time. If you have any good ideas, please let me know. | |||
17 | 17 | ||
18 | Bugs that need fixing as of Mon May 8 17:22:06 MDT 2000 | 18 | Bugs that need fixing as of Mon May 8 17:22:06 MDT 2000 |
19 | 19 | ||
20 | - zcat option parsing broke (maybe replace zcat binary with a shell script?) | ||
21 | - cp -fa doesn't work (-a option parsing probably overrides everything) | ||
22 | - 'grep foo$ file' doesn't work | 20 | - 'grep foo$ file' doesn't work |
23 | - 'grep *foo file' segfaults | 21 | - 'grep *foo file' segfaults |
24 | - ps dirent race bug (need to stat the file before attempting chdir) | 22 | - ps dirent race bug (need to stat the file before attempting chdir) |
diff --git a/archival/gunzip.c b/archival/gunzip.c index 97ab84e2d..bdf8dc293 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -715,11 +715,12 @@ int gunzip_main(int argc, char **argv) | |||
715 | char ifname[MAX_PATH_LEN + 1]; /* input file name */ | 715 | char ifname[MAX_PATH_LEN + 1]; /* input file name */ |
716 | char ofname[MAX_PATH_LEN + 1]; /* output file name */ | 716 | char ofname[MAX_PATH_LEN + 1]; /* output file name */ |
717 | 717 | ||
718 | if (argc == 1) | 718 | if (strcmp(*argv, "zcat") == 0) { |
719 | usage(gunzip_usage); | ||
720 | |||
721 | if (strcmp(*argv, "zcat") == 0) | ||
722 | to_stdout = 1; | 719 | to_stdout = 1; |
720 | if (argc == 1) { | ||
721 | fromstdin = 1; | ||
722 | } | ||
723 | } | ||
723 | 724 | ||
724 | /* Parse any options */ | 725 | /* Parse any options */ |
725 | while (--argc > 0 && **(++argv) == '-') { | 726 | while (--argc > 0 && **(++argv) == '-') { |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index ee858797c..a1b8e4eea 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -19,7 +19,11 @@ int deallocvt_main(int argc, char *argv[]) | |||
19 | 19 | ||
20 | if ((argc != 2) || (**(argv + 1) == '-')) { | 20 | if ((argc != 2) || (**(argv + 1) == '-')) { |
21 | usage | 21 | usage |
22 | ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); | 22 | ("deallocvt N\n" |
23 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
24 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
25 | #endif | ||
26 | ); | ||
23 | } | 27 | } |
24 | 28 | ||
25 | progname = argv[0]; | 29 | progname = argv[0]; |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 303500008..5d9993d8b 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -41,17 +41,19 @@ typedef unsigned long long int uintmax_t; | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | static const char dd_usage[] = | 43 | static const char dd_usage[] = |
44 | "dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]\n\n" | 44 | "dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n" |
45 | "Copy a file, converting and formatting according to options\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
46 | "\nCopy a file, converting and formatting according to options\n\n" | ||
46 | "\tif=FILE\tread from FILE instead of stdin\n" | 47 | "\tif=FILE\tread from FILE instead of stdin\n" |
47 | "\tof=FILE\twrite to FILE instead of stdout\n" | 48 | "\tof=FILE\twrite to FILE instead of stdout\n" |
48 | "\tbs=n\tread and write n bytes at a time\n" | 49 | "\tbs=N\tread and write N bytes at a time\n" |
49 | "\tcount=n\tcopy only n input blocks\n" | 50 | "\tcount=N\tcopy only N input blocks\n" |
50 | "\tskip=n\tskip n input blocks\n" | 51 | "\tskip=N\tskip N input blocks\n" |
51 | "\tseek=n\tskip n output blocks\n" | 52 | "\tseek=N\tskip N output blocks\n" |
52 | |||
53 | "\n" | 53 | "\n" |
54 | "Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n"; | 54 | "Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n" |
55 | #endif | ||
56 | ; | ||
55 | 57 | ||
56 | 58 | ||
57 | 59 | ||
diff --git a/coreutils/df.c b/coreutils/df.c index c38720454..417065943 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -28,8 +28,11 @@ | |||
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #include <sys/vfs.h> | 29 | #include <sys/vfs.h> |
30 | 30 | ||
31 | static const char df_usage[] = "df [filesystem ...]\n\n" | 31 | static const char df_usage[] = "df [filesystem ...]\n" |
32 | "Print the filesystem space used and space available.\n"; | 32 | #ifndef BB_FEATURE_TRIVIAL_HELP |
33 | "\nPrint the filesystem space used and space available.\n" | ||
34 | #endif | ||
35 | ; | ||
33 | 36 | ||
34 | extern const char mtab_file[]; /* Defined in utility.c */ | 37 | extern const char mtab_file[]; /* Defined in utility.c */ |
35 | 38 | ||
diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 528b89a56..ce3cd6f03 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c | |||
@@ -28,7 +28,11 @@ extern int dirname_main(int argc, char **argv) | |||
28 | char* s; | 28 | char* s; |
29 | 29 | ||
30 | if ((argc < 2) || (**(argv + 1) == '-')) { | 30 | if ((argc < 2) || (**(argv + 1) == '-')) { |
31 | usage("dirname [file ...]\n"); | 31 | usage("dirname [FILENAME ...]\n" |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nStrips non-directory suffix from FILENAME\n" | ||
34 | #endif | ||
35 | ); | ||
32 | } | 36 | } |
33 | argv++; | 37 | argv++; |
34 | 38 | ||
diff --git a/coreutils/du.c b/coreutils/du.c index c4fb3a38d..9c699978e 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -36,12 +36,15 @@ | |||
36 | typedef void (Display) (long, char *); | 36 | typedef void (Display) (long, char *); |
37 | 37 | ||
38 | static const char du_usage[] = | 38 | static const char du_usage[] = |
39 | "du [OPTION]... [FILE]...\n\n" | 39 | "du [OPTION]... [FILE]...\n" |
40 | "Summarize disk space used for each FILE and/or directory.\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
41 | "\nSummarizes disk space used for each FILE and/or directory.\n" | ||
41 | "Disk space is printed in units of 1024 bytes.\n\n" | 42 | "Disk space is printed in units of 1024 bytes.\n\n" |
42 | "Options:\n" | 43 | "Options:\n" |
43 | "\t-l\tcount sizes many times if hard linked\n" | 44 | "\t-l\tcount sizes many times if hard linked\n" |
44 | "\t-s\tdisplay only a total for each argument\n"; | 45 | "\t-s\tdisplay only a total for each argument\n" |
46 | #endif | ||
47 | ; | ||
45 | 48 | ||
46 | static int du_depth = 0; | 49 | static int du_depth = 0; |
47 | static int count_hardlinks = 0; | 50 | static int count_hardlinks = 0; |
@@ -181,7 +184,7 @@ int du_main(int argc, char **argv) | |||
181 | exit(0); | 184 | exit(0); |
182 | } | 185 | } |
183 | 186 | ||
184 | /* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */ | 187 | /* $Id: du.c,v 1.19 2000/05/10 05:05:45 erik Exp $ */ |
185 | /* | 188 | /* |
186 | Local Variables: | 189 | Local Variables: |
187 | c-file-style: "linux" | 190 | c-file-style: "linux" |
diff --git a/coreutils/echo.c b/coreutils/echo.c index 2405d0ae1..b31f2229b 100644 --- a/coreutils/echo.c +++ b/coreutils/echo.c | |||
@@ -26,12 +26,15 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | 27 | ||
28 | static const char uname_usage[] = | 28 | static const char uname_usage[] = |
29 | "echo [-neE] [ARG ...]\n\n" | 29 | "echo [-neE] [ARG ...]\n" |
30 | "Prints the specified ARGs to stdout\n\n" | 30 | #ifndef BB_FEATURE_TRIVIAL_HELP |
31 | "\nPrints the specified ARGs to stdout\n\n" | ||
31 | "Options:\n" | 32 | "Options:\n" |
32 | "\t-n\tsuppress trailing newline\n" | 33 | "\t-n\tsuppress trailing newline\n" |
33 | "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" | 34 | "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" |
34 | "\t-E\tdisable interpretation of backslash-escaped characters\n"; | 35 | "\t-E\tdisable interpretation of backslash-escaped characters\n" |
36 | #endif | ||
37 | ; | ||
35 | 38 | ||
36 | extern int | 39 | extern int |
37 | echo_main(int argc, char** argv) | 40 | echo_main(int argc, char** argv) |
@@ -70,6 +70,7 @@ static const char *cp_mv_usage[] = /* .rodata */ | |||
70 | static int recursiveFlag; | 70 | static int recursiveFlag; |
71 | static int followLinks; | 71 | static int followLinks; |
72 | static int preserveFlag; | 72 | static int preserveFlag; |
73 | static int forceFlag; | ||
73 | 74 | ||
74 | static const char *baseSrcName; | 75 | static const char *baseSrcName; |
75 | static int srcDirFlag; | 76 | static int srcDirFlag; |
@@ -167,7 +168,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
167 | add_to_ino_dev_hashtable(statbuf, destName); | 168 | add_to_ino_dev_hashtable(statbuf, destName); |
168 | } | 169 | } |
169 | } | 170 | } |
170 | return copyFile(fileName, destName, preserveFlag, followLinks); | 171 | return copyFile(fileName, destName, preserveFlag, followLinks, forceFlag); |
171 | } | 172 | } |
172 | 173 | ||
173 | static int | 174 | static int |
@@ -200,7 +201,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
200 | argv++; | 201 | argv++; |
201 | 202 | ||
202 | if (dz_i == is_cp) { | 203 | if (dz_i == is_cp) { |
203 | recursiveFlag = preserveFlag = FALSE; | 204 | recursiveFlag = preserveFlag = forceFlag = FALSE; |
204 | followLinks = TRUE; | 205 | followLinks = TRUE; |
205 | while (**argv == '-') { | 206 | while (**argv == '-') { |
206 | while (*++(*argv)) { | 207 | while (*++(*argv)) { |
@@ -220,7 +221,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
220 | recursiveFlag = TRUE; | 221 | recursiveFlag = TRUE; |
221 | break; | 222 | break; |
222 | case 'f': | 223 | case 'f': |
223 | /* for compatibility; busybox cp/mv always does force */ | 224 | forceFlag = TRUE; |
224 | break; | 225 | break; |
225 | default: | 226 | default: |
226 | usage(cp_mv_usage[is_cp]); | 227 | usage(cp_mv_usage[is_cp]); |
@@ -41,17 +41,19 @@ typedef unsigned long long int uintmax_t; | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | static const char dd_usage[] = | 43 | static const char dd_usage[] = |
44 | "dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]\n\n" | 44 | "dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n" |
45 | "Copy a file, converting and formatting according to options\n\n" | 45 | #ifndef BB_FEATURE_TRIVIAL_HELP |
46 | "\nCopy a file, converting and formatting according to options\n\n" | ||
46 | "\tif=FILE\tread from FILE instead of stdin\n" | 47 | "\tif=FILE\tread from FILE instead of stdin\n" |
47 | "\tof=FILE\twrite to FILE instead of stdout\n" | 48 | "\tof=FILE\twrite to FILE instead of stdout\n" |
48 | "\tbs=n\tread and write n bytes at a time\n" | 49 | "\tbs=N\tread and write N bytes at a time\n" |
49 | "\tcount=n\tcopy only n input blocks\n" | 50 | "\tcount=N\tcopy only N input blocks\n" |
50 | "\tskip=n\tskip n input blocks\n" | 51 | "\tskip=N\tskip N input blocks\n" |
51 | "\tseek=n\tskip n output blocks\n" | 52 | "\tseek=N\tskip N output blocks\n" |
52 | |||
53 | "\n" | 53 | "\n" |
54 | "Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n"; | 54 | "Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n" |
55 | #endif | ||
56 | ; | ||
55 | 57 | ||
56 | 58 | ||
57 | 59 | ||
diff --git a/deallocvt.c b/deallocvt.c index ee858797c..a1b8e4eea 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
@@ -19,7 +19,11 @@ int deallocvt_main(int argc, char *argv[]) | |||
19 | 19 | ||
20 | if ((argc != 2) || (**(argv + 1) == '-')) { | 20 | if ((argc != 2) || (**(argv + 1) == '-')) { |
21 | usage | 21 | usage |
22 | ("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n"); | 22 | ("deallocvt N\n" |
23 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
24 | "\nDeallocate unused virtual terminal /dev/ttyN\n" | ||
25 | #endif | ||
26 | ); | ||
23 | } | 27 | } |
24 | 28 | ||
25 | progname = argv[0]; | 29 | progname = argv[0]; |
@@ -28,8 +28,11 @@ | |||
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #include <sys/vfs.h> | 29 | #include <sys/vfs.h> |
30 | 30 | ||
31 | static const char df_usage[] = "df [filesystem ...]\n\n" | 31 | static const char df_usage[] = "df [filesystem ...]\n" |
32 | "Print the filesystem space used and space available.\n"; | 32 | #ifndef BB_FEATURE_TRIVIAL_HELP |
33 | "\nPrint the filesystem space used and space available.\n" | ||
34 | #endif | ||
35 | ; | ||
33 | 36 | ||
34 | extern const char mtab_file[]; /* Defined in utility.c */ | 37 | extern const char mtab_file[]; /* Defined in utility.c */ |
35 | 38 | ||
@@ -28,7 +28,11 @@ extern int dirname_main(int argc, char **argv) | |||
28 | char* s; | 28 | char* s; |
29 | 29 | ||
30 | if ((argc < 2) || (**(argv + 1) == '-')) { | 30 | if ((argc < 2) || (**(argv + 1) == '-')) { |
31 | usage("dirname [file ...]\n"); | 31 | usage("dirname [FILENAME ...]\n" |
32 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
33 | "\nStrips non-directory suffix from FILENAME\n" | ||
34 | #endif | ||
35 | ); | ||
32 | } | 36 | } |
33 | argv++; | 37 | argv++; |
34 | 38 | ||
@@ -34,7 +34,15 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len); | |||
34 | # include <sys/klog.h> | 34 | # include <sys/klog.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n"; | 37 | static const char dmesg_usage[] = "dmesg [-c] [-n LEVEL] [-s SIZE]\n" |
38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
39 | "\nPrints or controls the kernel ring buffer\n\n" | ||
40 | "Options:\n" | ||
41 | "\t-c\t\tClears the ring buffer's contents after printing\n" | ||
42 | "\t-n LEVEL\tSets console logging level\n" | ||
43 | "\t-s SIZE\t\tUse a buffer of size SIZE\n" | ||
44 | #endif | ||
45 | ; | ||
38 | 46 | ||
39 | int dmesg_main(int argc, char **argv) | 47 | int dmesg_main(int argc, char **argv) |
40 | { | 48 | { |
@@ -36,12 +36,15 @@ | |||
36 | typedef void (Display) (long, char *); | 36 | typedef void (Display) (long, char *); |
37 | 37 | ||
38 | static const char du_usage[] = | 38 | static const char du_usage[] = |
39 | "du [OPTION]... [FILE]...\n\n" | 39 | "du [OPTION]... [FILE]...\n" |
40 | "Summarize disk space used for each FILE and/or directory.\n" | 40 | #ifndef BB_FEATURE_TRIVIAL_HELP |
41 | "\nSummarizes disk space used for each FILE and/or directory.\n" | ||
41 | "Disk space is printed in units of 1024 bytes.\n\n" | 42 | "Disk space is printed in units of 1024 bytes.\n\n" |
42 | "Options:\n" | 43 | "Options:\n" |
43 | "\t-l\tcount sizes many times if hard linked\n" | 44 | "\t-l\tcount sizes many times if hard linked\n" |
44 | "\t-s\tdisplay only a total for each argument\n"; | 45 | "\t-s\tdisplay only a total for each argument\n" |
46 | #endif | ||
47 | ; | ||
45 | 48 | ||
46 | static int du_depth = 0; | 49 | static int du_depth = 0; |
47 | static int count_hardlinks = 0; | 50 | static int count_hardlinks = 0; |
@@ -181,7 +184,7 @@ int du_main(int argc, char **argv) | |||
181 | exit(0); | 184 | exit(0); |
182 | } | 185 | } |
183 | 186 | ||
184 | /* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */ | 187 | /* $Id: du.c,v 1.19 2000/05/10 05:05:45 erik Exp $ */ |
185 | /* | 188 | /* |
186 | Local Variables: | 189 | Local Variables: |
187 | c-file-style: "linux" | 190 | c-file-style: "linux" |
@@ -26,9 +26,12 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | 28 | ||
29 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" | 29 | static const char dutmp_usage[] = "dutmp [FILE]\n" |
30 | "Dump utmp file format (pipe delimited) from FILE\n" | 30 | #ifndef BB_FEATURE_TRIVIAL_HELP |
31 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; | 31 | "\nDump utmp file format (pipe delimited) from FILE\n" |
32 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n" | ||
33 | #endif | ||
34 | ; | ||
32 | 35 | ||
33 | extern int dutmp_main(int argc, char **argv) | 36 | extern int dutmp_main(int argc, char **argv) |
34 | { | 37 | { |
@@ -26,12 +26,15 @@ | |||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
27 | 27 | ||
28 | static const char uname_usage[] = | 28 | static const char uname_usage[] = |
29 | "echo [-neE] [ARG ...]\n\n" | 29 | "echo [-neE] [ARG ...]\n" |
30 | "Prints the specified ARGs to stdout\n\n" | 30 | #ifndef BB_FEATURE_TRIVIAL_HELP |
31 | "\nPrints the specified ARGs to stdout\n\n" | ||
31 | "Options:\n" | 32 | "Options:\n" |
32 | "\t-n\tsuppress trailing newline\n" | 33 | "\t-n\tsuppress trailing newline\n" |
33 | "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" | 34 | "\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n" |
34 | "\t-E\tdisable interpretation of backslash-escaped characters\n"; | 35 | "\t-E\tdisable interpretation of backslash-escaped characters\n" |
36 | #endif | ||
37 | ; | ||
35 | 38 | ||
36 | extern int | 39 | extern int |
37 | echo_main(int argc, char** argv) | 40 | echo_main(int argc, char** argv) |
@@ -715,11 +715,12 @@ int gunzip_main(int argc, char **argv) | |||
715 | char ifname[MAX_PATH_LEN + 1]; /* input file name */ | 715 | char ifname[MAX_PATH_LEN + 1]; /* input file name */ |
716 | char ofname[MAX_PATH_LEN + 1]; /* output file name */ | 716 | char ofname[MAX_PATH_LEN + 1]; /* output file name */ |
717 | 717 | ||
718 | if (argc == 1) | 718 | if (strcmp(*argv, "zcat") == 0) { |
719 | usage(gunzip_usage); | ||
720 | |||
721 | if (strcmp(*argv, "zcat") == 0) | ||
722 | to_stdout = 1; | 719 | to_stdout = 1; |
720 | if (argc == 1) { | ||
721 | fromstdin = 1; | ||
722 | } | ||
723 | } | ||
723 | 724 | ||
724 | /* Parse any options */ | 725 | /* Parse any options */ |
725 | while (--argc > 0 && **(++argv) == '-') { | 726 | while (--argc > 0 && **(++argv) == '-') { |
diff --git a/internal.h b/internal.h index 859bee1c3..a4014778c 100644 --- a/internal.h +++ b/internal.h | |||
@@ -215,8 +215,8 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); | |||
215 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | 215 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); |
216 | void reset_ino_dev_hashtable(void); | 216 | void reset_ino_dev_hashtable(void); |
217 | 217 | ||
218 | int copyFile(const char *srcName, const char *destName, int setModes, | 218 | int copyFile(const char *srcName, const char *destName, |
219 | int followLinks); | 219 | int setModes, int followLinks, int forceFlag); |
220 | char *buildName(const char *dirName, const char *fileName); | 220 | char *buildName(const char *dirName, const char *fileName); |
221 | int makeString(int argc, const char **argv, char *buf, int bufLen); | 221 | int makeString(int argc, const char **argv, char *buf, int bufLen); |
222 | char *getChunk(int size); | 222 | char *getChunk(int size); |
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 192871f1e..fab1a7b99 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
@@ -26,9 +26,12 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | 28 | ||
29 | static const char dutmp_usage[] = "dutmp [FILE]\n\n" | 29 | static const char dutmp_usage[] = "dutmp [FILE]\n" |
30 | "Dump utmp file format (pipe delimited) from FILE\n" | 30 | #ifndef BB_FEATURE_TRIVIAL_HELP |
31 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; | 31 | "\nDump utmp file format (pipe delimited) from FILE\n" |
32 | "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n" | ||
33 | #endif | ||
34 | ; | ||
32 | 35 | ||
33 | extern int dutmp_main(int argc, char **argv) | 36 | extern int dutmp_main(int argc, char **argv) |
34 | { | 37 | { |
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 2bbf43a12..6fa17b5fb 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
@@ -34,7 +34,15 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len); | |||
34 | # include <sys/klog.h> | 34 | # include <sys/klog.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n"; | 37 | static const char dmesg_usage[] = "dmesg [-c] [-n LEVEL] [-s SIZE]\n" |
38 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
39 | "\nPrints or controls the kernel ring buffer\n\n" | ||
40 | "Options:\n" | ||
41 | "\t-c\t\tClears the ring buffer's contents after printing\n" | ||
42 | "\t-n LEVEL\tSets console logging level\n" | ||
43 | "\t-s SIZE\t\tUse a buffer of size SIZE\n" | ||
44 | #endif | ||
45 | ; | ||
38 | 46 | ||
39 | int dmesg_main(int argc, char **argv) | 47 | int dmesg_main(int argc, char **argv) |
40 | { | 48 | { |
@@ -234,15 +234,14 @@ int isDirectory(const char *fileName, const int followLinks, struct stat *statBu | |||
234 | 234 | ||
235 | #if defined (BB_CP_MV) | 235 | #if defined (BB_CP_MV) |
236 | /* | 236 | /* |
237 | * Copy one file to another, while possibly preserving its modes, times, | 237 | * Copy one file to another, while possibly preserving its modes, times, and |
238 | * and modes. Returns TRUE if successful, or FALSE on a failure with an | 238 | * modes. Returns TRUE if successful, or FALSE on a failure with an error |
239 | * error message output. (Failure is not indicated if the attributes cannot | 239 | * message output. (Failure is not indicated if attributes cannot be set.) |
240 | * be set.) | 240 | * -Erik Andersen |
241 | * -Erik Andersen | ||
242 | */ | 241 | */ |
243 | int | 242 | int |
244 | copyFile(const char *srcName, const char *destName, | 243 | copyFile(const char *srcName, const char *destName, |
245 | int setModes, int followLinks) | 244 | int setModes, int followLinks, int forceFlag) |
246 | { | 245 | { |
247 | int rfd; | 246 | int rfd; |
248 | int wfd; | 247 | int wfd; |
@@ -268,7 +267,8 @@ copyFile(const char *srcName, const char *destName, | |||
268 | else | 267 | else |
269 | status = lstat(destName, &dstStatBuf); | 268 | status = lstat(destName, &dstStatBuf); |
270 | 269 | ||
271 | if (status < 0) { | 270 | if (status < 0 || forceFlag==TRUE) { |
271 | unlink(destName); | ||
272 | dstStatBuf.st_ino = -1; | 272 | dstStatBuf.st_ino = -1; |
273 | dstStatBuf.st_dev = -1; | 273 | dstStatBuf.st_dev = -1; |
274 | } | 274 | } |
@@ -306,10 +306,8 @@ copyFile(const char *srcName, const char *destName, | |||
306 | } | 306 | } |
307 | #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) | 307 | #if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1) |
308 | if (setModes == TRUE) { | 308 | if (setModes == TRUE) { |
309 | if (lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) { | 309 | /* Try to set owner, but fail silently like GNU cp */ |
310 | perror(destName); | 310 | lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid); |
311 | return FALSE; | ||
312 | } | ||
313 | } | 311 | } |
314 | #endif | 312 | #endif |
315 | return TRUE; | 313 | return TRUE; |