aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-10 05:05:45 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-10 05:05:45 +0000
commit59b9e870243c56a9c5ec045a925e4e9b3f1f6c3c (patch)
tree8db9c40b68387c1017007f5265e45c2a66ccfb0d
parentac130e1dca289c431c43b6efee4b3d9f2b367c87 (diff)
downloadbusybox-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--Changelog3
-rw-r--r--Makefile2
-rw-r--r--TODO2
-rw-r--r--archival/gunzip.c9
-rw-r--r--console-tools/deallocvt.c6
-rw-r--r--coreutils/dd.c18
-rw-r--r--coreutils/df.c7
-rw-r--r--coreutils/dirname.c6
-rw-r--r--coreutils/du.c11
-rw-r--r--coreutils/echo.c9
-rw-r--r--cp_mv.c7
-rw-r--r--dd.c18
-rw-r--r--deallocvt.c6
-rw-r--r--df.c7
-rw-r--r--dirname.c6
-rw-r--r--dmesg.c10
-rw-r--r--du.c11
-rw-r--r--dutmp.c9
-rw-r--r--echo.c9
-rw-r--r--gunzip.c9
-rw-r--r--internal.h4
-rw-r--r--miscutils/dutmp.c9
-rw-r--r--util-linux/dmesg.c10
-rw-r--r--utility.c20
24 files changed, 135 insertions, 73 deletions
diff --git a/Changelog b/Changelog
index 8b683ba90..0cd58ef31 100644
--- a/Changelog
+++ b/Changelog
@@ -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
diff --git a/Makefile b/Makefile
index 475d039fa..d7b1a9bdb 100644
--- a/Makefile
+++ b/Makefile
@@ -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'
29DODEBUG = false 29DODEBUG = true
30 30
31# If you want a static binary, turn this on. 31# If you want a static binary, turn this on.
32DOSTATIC = false 32DOSTATIC = false
diff --git a/TODO b/TODO
index 8d7ef0e6f..5fe780f39 100644
--- a/TODO
+++ b/TODO
@@ -17,8 +17,6 @@ around to it some time. If you have any good ideas, please let me know.
17 17
18Bugs that need fixing as of Mon May 8 17:22:06 MDT 2000 18Bugs 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
43static const char dd_usage[] = 43static 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
31static const char df_usage[] = "df [filesystem ...]\n\n" 31static 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
34extern const char mtab_file[]; /* Defined in utility.c */ 37extern 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 @@
36typedef void (Display) (long, char *); 36typedef void (Display) (long, char *);
37 37
38static const char du_usage[] = 38static 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
46static int du_depth = 0; 49static int du_depth = 0;
47static int count_hardlinks = 0; 50static 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/*
186Local Variables: 189Local Variables:
187c-file-style: "linux" 190c-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
28static const char uname_usage[] = 28static 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
36extern int 39extern int
37echo_main(int argc, char** argv) 40echo_main(int argc, char** argv)
diff --git a/cp_mv.c b/cp_mv.c
index ae35bca19..ac1e71b82 100644
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -70,6 +70,7 @@ static const char *cp_mv_usage[] = /* .rodata */
70static int recursiveFlag; 70static int recursiveFlag;
71static int followLinks; 71static int followLinks;
72static int preserveFlag; 72static int preserveFlag;
73static int forceFlag;
73 74
74static const char *baseSrcName; 75static const char *baseSrcName;
75static int srcDirFlag; 76static 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
173static int 174static 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]);
diff --git a/dd.c b/dd.c
index 303500008..5d9993d8b 100644
--- a/dd.c
+++ b/dd.c
@@ -41,17 +41,19 @@ typedef unsigned long long int uintmax_t;
41#endif 41#endif
42 42
43static const char dd_usage[] = 43static 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];
diff --git a/df.c b/df.c
index c38720454..417065943 100644
--- a/df.c
+++ b/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
31static const char df_usage[] = "df [filesystem ...]\n\n" 31static 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
34extern const char mtab_file[]; /* Defined in utility.c */ 37extern const char mtab_file[]; /* Defined in utility.c */
35 38
diff --git a/dirname.c b/dirname.c
index 528b89a56..ce3cd6f03 100644
--- a/dirname.c
+++ b/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/dmesg.c b/dmesg.c
index 2bbf43a12..6fa17b5fb 100644
--- a/dmesg.c
+++ b/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
37static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n"; 37static 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
39int dmesg_main(int argc, char **argv) 47int dmesg_main(int argc, char **argv)
40{ 48{
diff --git a/du.c b/du.c
index c4fb3a38d..9c699978e 100644
--- a/du.c
+++ b/du.c
@@ -36,12 +36,15 @@
36typedef void (Display) (long, char *); 36typedef void (Display) (long, char *);
37 37
38static const char du_usage[] = 38static 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
46static int du_depth = 0; 49static int du_depth = 0;
47static int count_hardlinks = 0; 50static 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/*
186Local Variables: 189Local Variables:
187c-file-style: "linux" 190c-file-style: "linux"
diff --git a/dutmp.c b/dutmp.c
index 192871f1e..fab1a7b99 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -26,9 +26,12 @@
26#endif 26#endif
27 27
28 28
29static const char dutmp_usage[] = "dutmp [FILE]\n\n" 29static 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
33extern int dutmp_main(int argc, char **argv) 36extern int dutmp_main(int argc, char **argv)
34{ 37{
diff --git a/echo.c b/echo.c
index 2405d0ae1..b31f2229b 100644
--- a/echo.c
+++ b/echo.c
@@ -26,12 +26,15 @@
26#include <stdio.h> 26#include <stdio.h>
27 27
28static const char uname_usage[] = 28static 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
36extern int 39extern int
37echo_main(int argc, char** argv) 40echo_main(int argc, char** argv)
diff --git a/gunzip.c b/gunzip.c
index 97ab84e2d..bdf8dc293 100644
--- a/gunzip.c
+++ b/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/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);
215void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); 215void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
216void reset_ino_dev_hashtable(void); 216void reset_ino_dev_hashtable(void);
217 217
218int copyFile(const char *srcName, const char *destName, int setModes, 218int copyFile(const char *srcName, const char *destName,
219 int followLinks); 219 int setModes, int followLinks, int forceFlag);
220char *buildName(const char *dirName, const char *fileName); 220char *buildName(const char *dirName, const char *fileName);
221int makeString(int argc, const char **argv, char *buf, int bufLen); 221int makeString(int argc, const char **argv, char *buf, int bufLen);
222char *getChunk(int size); 222char *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
29static const char dutmp_usage[] = "dutmp [FILE]\n\n" 29static 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
33extern int dutmp_main(int argc, char **argv) 36extern 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
37static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n"; 37static 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
39int dmesg_main(int argc, char **argv) 47int dmesg_main(int argc, char **argv)
40{ 48{
diff --git a/utility.c b/utility.c
index c8442f1ba..5899fe954 100644
--- a/utility.c
+++ b/utility.c
@@ -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 */
243int 242int
244copyFile(const char *srcName, const char *destName, 243copyFile(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;