* 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
This commit is contained in:
parent
ac130e1dca
commit
59b9e87024
@ -27,6 +27,9 @@
|
|||||||
* Fixed basename to support stripping of suffixes. Patch thanks
|
* Fixed basename to support stripping of suffixes. Patch thanks
|
||||||
to xiong jianxin <jxiong@uiuc.edu>
|
to xiong jianxin <jxiong@uiuc.edu>
|
||||||
* More doc updates
|
* More doc updates
|
||||||
|
* cp -fa now works as expected for symlinks (it didn't before)
|
||||||
|
* zcat now works (wasn't working since option parsing was broken)
|
||||||
|
|
||||||
|
|
||||||
-Erik
|
-Erik
|
||||||
|
|
||||||
|
2
Makefile
2
Makefile
@ -26,7 +26,7 @@ export VERSION
|
|||||||
# Set the following to `true' to make a debuggable build.
|
# Set the following to `true' to make a debuggable build.
|
||||||
# Leave this set to `false' for production use.
|
# Leave this set to `false' for production use.
|
||||||
# eg: `make DODEBUG=true tests'
|
# eg: `make DODEBUG=true tests'
|
||||||
DODEBUG = false
|
DODEBUG = true
|
||||||
|
|
||||||
# If you want a static binary, turn this on.
|
# If you want a static binary, turn this on.
|
||||||
DOSTATIC = false
|
DOSTATIC = false
|
||||||
|
2
TODO
2
TODO
@ -17,8 +17,6 @@ around to it some time. If you have any good ideas, please let me know.
|
|||||||
|
|
||||||
Bugs that need fixing as of Mon May 8 17:22:06 MDT 2000
|
Bugs that need fixing as of Mon May 8 17:22:06 MDT 2000
|
||||||
|
|
||||||
- zcat option parsing broke (maybe replace zcat binary with a shell script?)
|
|
||||||
- cp -fa doesn't work (-a option parsing probably overrides everything)
|
|
||||||
- 'grep foo$ file' doesn't work
|
- 'grep foo$ file' doesn't work
|
||||||
- 'grep *foo file' segfaults
|
- 'grep *foo file' segfaults
|
||||||
- ps dirent race bug (need to stat the file before attempting chdir)
|
- ps dirent race bug (need to stat the file before attempting chdir)
|
||||||
|
@ -715,11 +715,12 @@ int gunzip_main(int argc, char **argv)
|
|||||||
char ifname[MAX_PATH_LEN + 1]; /* input file name */
|
char ifname[MAX_PATH_LEN + 1]; /* input file name */
|
||||||
char ofname[MAX_PATH_LEN + 1]; /* output file name */
|
char ofname[MAX_PATH_LEN + 1]; /* output file name */
|
||||||
|
|
||||||
if (argc == 1)
|
if (strcmp(*argv, "zcat") == 0) {
|
||||||
usage(gunzip_usage);
|
|
||||||
|
|
||||||
if (strcmp(*argv, "zcat") == 0)
|
|
||||||
to_stdout = 1;
|
to_stdout = 1;
|
||||||
|
if (argc == 1) {
|
||||||
|
fromstdin = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (--argc > 0 && **(++argv) == '-') {
|
while (--argc > 0 && **(++argv) == '-') {
|
||||||
|
@ -19,7 +19,11 @@ int deallocvt_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if ((argc != 2) || (**(argv + 1) == '-')) {
|
if ((argc != 2) || (**(argv + 1) == '-')) {
|
||||||
usage
|
usage
|
||||||
("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n");
|
("deallocvt N\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nDeallocate unused virtual terminal /dev/ttyN\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
@ -41,17 +41,19 @@ typedef unsigned long long int uintmax_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char dd_usage[] =
|
static const char dd_usage[] =
|
||||||
"dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]\n\n"
|
"dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n"
|
||||||
"Copy a file, converting and formatting according to options\n\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nCopy a file, converting and formatting according to options\n\n"
|
||||||
"\tif=FILE\tread from FILE instead of stdin\n"
|
"\tif=FILE\tread from FILE instead of stdin\n"
|
||||||
"\tof=FILE\twrite to FILE instead of stdout\n"
|
"\tof=FILE\twrite to FILE instead of stdout\n"
|
||||||
"\tbs=n\tread and write n bytes at a time\n"
|
"\tbs=N\tread and write N bytes at a time\n"
|
||||||
"\tcount=n\tcopy only n input blocks\n"
|
"\tcount=N\tcopy only N input blocks\n"
|
||||||
"\tskip=n\tskip n input blocks\n"
|
"\tskip=N\tskip N input blocks\n"
|
||||||
"\tseek=n\tskip n output blocks\n"
|
"\tseek=N\tskip N output blocks\n"
|
||||||
|
|
||||||
"\n"
|
"\n"
|
||||||
"Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n";
|
"Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,8 +28,11 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
static const char df_usage[] = "df [filesystem ...]\n\n"
|
static const char df_usage[] = "df [filesystem ...]\n"
|
||||||
"Print the filesystem space used and space available.\n";
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrint the filesystem space used and space available.\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern const char mtab_file[]; /* Defined in utility.c */
|
extern const char mtab_file[]; /* Defined in utility.c */
|
||||||
|
|
||||||
|
@ -28,7 +28,11 @@ extern int dirname_main(int argc, char **argv)
|
|||||||
char* s;
|
char* s;
|
||||||
|
|
||||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||||
usage("dirname [file ...]\n");
|
usage("dirname [FILENAME ...]\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nStrips non-directory suffix from FILENAME\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
|
@ -36,12 +36,15 @@
|
|||||||
typedef void (Display) (long, char *);
|
typedef void (Display) (long, char *);
|
||||||
|
|
||||||
static const char du_usage[] =
|
static const char du_usage[] =
|
||||||
"du [OPTION]... [FILE]...\n\n"
|
"du [OPTION]... [FILE]...\n"
|
||||||
"Summarize disk space used for each FILE and/or directory.\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nSummarizes disk space used for each FILE and/or directory.\n"
|
||||||
"Disk space is printed in units of 1024 bytes.\n\n"
|
"Disk space is printed in units of 1024 bytes.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-l\tcount sizes many times if hard linked\n"
|
"\t-l\tcount sizes many times if hard linked\n"
|
||||||
"\t-s\tdisplay only a total for each argument\n";
|
"\t-s\tdisplay only a total for each argument\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
static int du_depth = 0;
|
static int du_depth = 0;
|
||||||
static int count_hardlinks = 0;
|
static int count_hardlinks = 0;
|
||||||
@ -181,7 +184,7 @@ int du_main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */
|
/* $Id: du.c,v 1.19 2000/05/10 05:05:45 erik Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
@ -26,12 +26,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static const char uname_usage[] =
|
static const char uname_usage[] =
|
||||||
"echo [-neE] [ARG ...]\n\n"
|
"echo [-neE] [ARG ...]\n"
|
||||||
"Prints the specified ARGs to stdout\n\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrints the specified ARGs to stdout\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-n\tsuppress trailing newline\n"
|
"\t-n\tsuppress trailing newline\n"
|
||||||
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
|
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
|
||||||
"\t-E\tdisable interpretation of backslash-escaped characters\n";
|
"\t-E\tdisable interpretation of backslash-escaped characters\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
echo_main(int argc, char** argv)
|
echo_main(int argc, char** argv)
|
||||||
|
7
cp_mv.c
7
cp_mv.c
@ -70,6 +70,7 @@ static const char *cp_mv_usage[] = /* .rodata */
|
|||||||
static int recursiveFlag;
|
static int recursiveFlag;
|
||||||
static int followLinks;
|
static int followLinks;
|
||||||
static int preserveFlag;
|
static int preserveFlag;
|
||||||
|
static int forceFlag;
|
||||||
|
|
||||||
static const char *baseSrcName;
|
static const char *baseSrcName;
|
||||||
static int srcDirFlag;
|
static int srcDirFlag;
|
||||||
@ -167,7 +168,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
|
|||||||
add_to_ino_dev_hashtable(statbuf, destName);
|
add_to_ino_dev_hashtable(statbuf, destName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return copyFile(fileName, destName, preserveFlag, followLinks);
|
return copyFile(fileName, destName, preserveFlag, followLinks, forceFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -200,7 +201,7 @@ extern int cp_mv_main(int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
if (dz_i == is_cp) {
|
if (dz_i == is_cp) {
|
||||||
recursiveFlag = preserveFlag = FALSE;
|
recursiveFlag = preserveFlag = forceFlag = FALSE;
|
||||||
followLinks = TRUE;
|
followLinks = TRUE;
|
||||||
while (**argv == '-') {
|
while (**argv == '-') {
|
||||||
while (*++(*argv)) {
|
while (*++(*argv)) {
|
||||||
@ -220,7 +221,7 @@ extern int cp_mv_main(int argc, char **argv)
|
|||||||
recursiveFlag = TRUE;
|
recursiveFlag = TRUE;
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
/* for compatibility; busybox cp/mv always does force */
|
forceFlag = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(cp_mv_usage[is_cp]);
|
usage(cp_mv_usage[is_cp]);
|
||||||
|
18
dd.c
18
dd.c
@ -41,17 +41,19 @@ typedef unsigned long long int uintmax_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char dd_usage[] =
|
static const char dd_usage[] =
|
||||||
"dd [if=name] [of=name] [bs=n] [count=n] [skip=n] [seek=n]\n\n"
|
"dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N] [seek=N]\n"
|
||||||
"Copy a file, converting and formatting according to options\n\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nCopy a file, converting and formatting according to options\n\n"
|
||||||
"\tif=FILE\tread from FILE instead of stdin\n"
|
"\tif=FILE\tread from FILE instead of stdin\n"
|
||||||
"\tof=FILE\twrite to FILE instead of stdout\n"
|
"\tof=FILE\twrite to FILE instead of stdout\n"
|
||||||
"\tbs=n\tread and write n bytes at a time\n"
|
"\tbs=N\tread and write N bytes at a time\n"
|
||||||
"\tcount=n\tcopy only n input blocks\n"
|
"\tcount=N\tcopy only N input blocks\n"
|
||||||
"\tskip=n\tskip n input blocks\n"
|
"\tskip=N\tskip N input blocks\n"
|
||||||
"\tseek=n\tskip n output blocks\n"
|
"\tseek=N\tskip N output blocks\n"
|
||||||
|
|
||||||
"\n"
|
"\n"
|
||||||
"Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n";
|
"Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,11 @@ int deallocvt_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if ((argc != 2) || (**(argv + 1) == '-')) {
|
if ((argc != 2) || (**(argv + 1) == '-')) {
|
||||||
usage
|
usage
|
||||||
("deallocvt N\n\nDeallocate unused virtual terminal /dev/ttyN\n");
|
("deallocvt N\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nDeallocate unused virtual terminal /dev/ttyN\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
7
df.c
7
df.c
@ -28,8 +28,11 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
static const char df_usage[] = "df [filesystem ...]\n\n"
|
static const char df_usage[] = "df [filesystem ...]\n"
|
||||||
"Print the filesystem space used and space available.\n";
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrint the filesystem space used and space available.\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern const char mtab_file[]; /* Defined in utility.c */
|
extern const char mtab_file[]; /* Defined in utility.c */
|
||||||
|
|
||||||
|
@ -28,7 +28,11 @@ extern int dirname_main(int argc, char **argv)
|
|||||||
char* s;
|
char* s;
|
||||||
|
|
||||||
if ((argc < 2) || (**(argv + 1) == '-')) {
|
if ((argc < 2) || (**(argv + 1) == '-')) {
|
||||||
usage("dirname [file ...]\n");
|
usage("dirname [FILENAME ...]\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nStrips non-directory suffix from FILENAME\n"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
argv++;
|
argv++;
|
||||||
|
|
||||||
|
10
dmesg.c
10
dmesg.c
@ -34,7 +34,15 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
|
|||||||
# include <sys/klog.h>
|
# include <sys/klog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n";
|
static const char dmesg_usage[] = "dmesg [-c] [-n LEVEL] [-s SIZE]\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrints or controls the kernel ring buffer\n\n"
|
||||||
|
"Options:\n"
|
||||||
|
"\t-c\t\tClears the ring buffer's contents after printing\n"
|
||||||
|
"\t-n LEVEL\tSets console logging level\n"
|
||||||
|
"\t-s SIZE\t\tUse a buffer of size SIZE\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
int dmesg_main(int argc, char **argv)
|
int dmesg_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
11
du.c
11
du.c
@ -36,12 +36,15 @@
|
|||||||
typedef void (Display) (long, char *);
|
typedef void (Display) (long, char *);
|
||||||
|
|
||||||
static const char du_usage[] =
|
static const char du_usage[] =
|
||||||
"du [OPTION]... [FILE]...\n\n"
|
"du [OPTION]... [FILE]...\n"
|
||||||
"Summarize disk space used for each FILE and/or directory.\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nSummarizes disk space used for each FILE and/or directory.\n"
|
||||||
"Disk space is printed in units of 1024 bytes.\n\n"
|
"Disk space is printed in units of 1024 bytes.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-l\tcount sizes many times if hard linked\n"
|
"\t-l\tcount sizes many times if hard linked\n"
|
||||||
"\t-s\tdisplay only a total for each argument\n";
|
"\t-s\tdisplay only a total for each argument\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
static int du_depth = 0;
|
static int du_depth = 0;
|
||||||
static int count_hardlinks = 0;
|
static int count_hardlinks = 0;
|
||||||
@ -181,7 +184,7 @@ int du_main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.18 2000/04/28 00:18:56 erik Exp $ */
|
/* $Id: du.c,v 1.19 2000/05/10 05:05:45 erik Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
9
dutmp.c
9
dutmp.c
@ -26,9 +26,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const char dutmp_usage[] = "dutmp [FILE]\n\n"
|
static const char dutmp_usage[] = "dutmp [FILE]\n"
|
||||||
"Dump utmp file format (pipe delimited) from FILE\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
|
"\nDump utmp file format (pipe delimited) from FILE\n"
|
||||||
|
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern int dutmp_main(int argc, char **argv)
|
extern int dutmp_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
9
echo.c
9
echo.c
@ -26,12 +26,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static const char uname_usage[] =
|
static const char uname_usage[] =
|
||||||
"echo [-neE] [ARG ...]\n\n"
|
"echo [-neE] [ARG ...]\n"
|
||||||
"Prints the specified ARGs to stdout\n\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrints the specified ARGs to stdout\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-n\tsuppress trailing newline\n"
|
"\t-n\tsuppress trailing newline\n"
|
||||||
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
|
"\t-e\tinterpret backslash-escaped characters (i.e. \\t=tab etc)\n"
|
||||||
"\t-E\tdisable interpretation of backslash-escaped characters\n";
|
"\t-E\tdisable interpretation of backslash-escaped characters\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
echo_main(int argc, char** argv)
|
echo_main(int argc, char** argv)
|
||||||
|
9
gunzip.c
9
gunzip.c
@ -715,11 +715,12 @@ int gunzip_main(int argc, char **argv)
|
|||||||
char ifname[MAX_PATH_LEN + 1]; /* input file name */
|
char ifname[MAX_PATH_LEN + 1]; /* input file name */
|
||||||
char ofname[MAX_PATH_LEN + 1]; /* output file name */
|
char ofname[MAX_PATH_LEN + 1]; /* output file name */
|
||||||
|
|
||||||
if (argc == 1)
|
if (strcmp(*argv, "zcat") == 0) {
|
||||||
usage(gunzip_usage);
|
|
||||||
|
|
||||||
if (strcmp(*argv, "zcat") == 0)
|
|
||||||
to_stdout = 1;
|
to_stdout = 1;
|
||||||
|
if (argc == 1) {
|
||||||
|
fromstdin = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse any options */
|
/* Parse any options */
|
||||||
while (--argc > 0 && **(++argv) == '-') {
|
while (--argc > 0 && **(++argv) == '-') {
|
||||||
|
@ -215,8 +215,8 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
|
|||||||
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
|
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
|
||||||
void reset_ino_dev_hashtable(void);
|
void reset_ino_dev_hashtable(void);
|
||||||
|
|
||||||
int copyFile(const char *srcName, const char *destName, int setModes,
|
int copyFile(const char *srcName, const char *destName,
|
||||||
int followLinks);
|
int setModes, int followLinks, int forceFlag);
|
||||||
char *buildName(const char *dirName, const char *fileName);
|
char *buildName(const char *dirName, const char *fileName);
|
||||||
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
int makeString(int argc, const char **argv, char *buf, int bufLen);
|
||||||
char *getChunk(int size);
|
char *getChunk(int size);
|
||||||
|
@ -26,9 +26,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const char dutmp_usage[] = "dutmp [FILE]\n\n"
|
static const char dutmp_usage[] = "dutmp [FILE]\n"
|
||||||
"Dump utmp file format (pipe delimited) from FILE\n"
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n";
|
"\nDump utmp file format (pipe delimited) from FILE\n"
|
||||||
|
"or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern int dutmp_main(int argc, char **argv)
|
extern int dutmp_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,15 @@ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
|
|||||||
# include <sys/klog.h>
|
# include <sys/klog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char dmesg_usage[] = "dmesg [-c] [-n level] [-s bufsize]\n";
|
static const char dmesg_usage[] = "dmesg [-c] [-n LEVEL] [-s SIZE]\n"
|
||||||
|
#ifndef BB_FEATURE_TRIVIAL_HELP
|
||||||
|
"\nPrints or controls the kernel ring buffer\n\n"
|
||||||
|
"Options:\n"
|
||||||
|
"\t-c\t\tClears the ring buffer's contents after printing\n"
|
||||||
|
"\t-n LEVEL\tSets console logging level\n"
|
||||||
|
"\t-s SIZE\t\tUse a buffer of size SIZE\n"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
int dmesg_main(int argc, char **argv)
|
int dmesg_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
18
utility.c
18
utility.c
@ -234,15 +234,14 @@ int isDirectory(const char *fileName, const int followLinks, struct stat *statBu
|
|||||||
|
|
||||||
#if defined (BB_CP_MV)
|
#if defined (BB_CP_MV)
|
||||||
/*
|
/*
|
||||||
* Copy one file to another, while possibly preserving its modes, times,
|
* Copy one file to another, while possibly preserving its modes, times, and
|
||||||
* and modes. Returns TRUE if successful, or FALSE on a failure with an
|
* modes. Returns TRUE if successful, or FALSE on a failure with an error
|
||||||
* error message output. (Failure is not indicated if the attributes cannot
|
* message output. (Failure is not indicated if attributes cannot be set.)
|
||||||
* be set.)
|
|
||||||
* -Erik Andersen
|
* -Erik Andersen
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
copyFile(const char *srcName, const char *destName,
|
copyFile(const char *srcName, const char *destName,
|
||||||
int setModes, int followLinks)
|
int setModes, int followLinks, int forceFlag)
|
||||||
{
|
{
|
||||||
int rfd;
|
int rfd;
|
||||||
int wfd;
|
int wfd;
|
||||||
@ -268,7 +267,8 @@ copyFile(const char *srcName, const char *destName,
|
|||||||
else
|
else
|
||||||
status = lstat(destName, &dstStatBuf);
|
status = lstat(destName, &dstStatBuf);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0 || forceFlag==TRUE) {
|
||||||
|
unlink(destName);
|
||||||
dstStatBuf.st_ino = -1;
|
dstStatBuf.st_ino = -1;
|
||||||
dstStatBuf.st_dev = -1;
|
dstStatBuf.st_dev = -1;
|
||||||
}
|
}
|
||||||
@ -306,10 +306,8 @@ copyFile(const char *srcName, const char *destName,
|
|||||||
}
|
}
|
||||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
||||||
if (setModes == TRUE) {
|
if (setModes == TRUE) {
|
||||||
if (lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid) < 0) {
|
/* Try to set owner, but fail silently like GNU cp */
|
||||||
perror(destName);
|
lchown(destName, srcStatBuf.st_uid, srcStatBuf.st_gid);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user