summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai2000-07-19 18:01:00 +0000
committerMatt Kraai2000-07-19 18:01:00 +0000
commit2f46b664b7d7b51319d21b7c2d6b3ca817f5e1c4 (patch)
treed728fbd078450989fefcce5d372db867899e3056
parent91a4400fd5a74c6e954b22b276dd38c7ffaeae33 (diff)
downloadbusybox-2f46b664b7d7b51319d21b7c2d6b3ca817f5e1c4.zip
busybox-2f46b664b7d7b51319d21b7c2d6b3ca817f5e1c4.tar.gz
Add usage messages for applets without them.
-rw-r--r--applets/usage.c89
-rw-r--r--clear.c3
-rw-r--r--console-tools/clear.c3
-rw-r--r--coreutils/hostid.c3
-rw-r--r--coreutils/pwd.c3
-rw-r--r--halt.c3
-rw-r--r--hostid.c3
-rw-r--r--init/halt.c3
-rw-r--r--init/poweroff.c3
-rw-r--r--init/reboot.c3
-rw-r--r--lsmod.c3
-rw-r--r--modutils/lsmod.c3
-rw-r--r--poweroff.c3
-rw-r--r--procps/uptime.c3
-rw-r--r--pwd.c3
-rw-r--r--reboot.c3
-rw-r--r--true_false.c6
-rw-r--r--uptime.c3
-rw-r--r--usage.c89
19 files changed, 232 insertions, 0 deletions
diff --git a/applets/usage.c b/applets/usage.c
index d5a34ec..56ea80d 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -83,6 +83,15 @@ const char chvt_usage[] =
;
#endif
+#if defined BB_CLEAR
+const char clear_usage[] =
+ "clear\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nClear screen.\n"
+#endif
+ ;
+#endif
+
#if defined BB_CP_MV
const char cp_usage[] =
"cp [OPTION]... SOURCE DEST\n"
@@ -241,6 +250,15 @@ const char echo_usage[] =
;
#endif
+#if defined BB_TRUE_FALSE
+const char false_usage[] =
+ "false\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReturn an exit code of FALSE (1).\n"
+#endif
+ ;
+#endif
+
#if defined BB_FDFLUSH
const char fdflush_usage[] =
"fdflush DEVICE\n"
@@ -340,6 +358,14 @@ const char gzip_usage[] =
;
#endif
+#if defined BB_HALT
+const char halt_usage[] =
+ "halt\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nHalt the system.\n"
+#endif
+ ;
+
#if defined BB_HEAD
const char head_usage[] =
"head [OPTION] [FILE]...\n"
@@ -353,6 +379,15 @@ const char head_usage[] =
;
#endif
+#if defined BB_HOSTID
+const char hostid_usage[] =
+ "hostid\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nPrint out a unique 32-bit identifier for the machine.\n"
+#endif
+ ;
+#endif
+
#if defined BB_HOSTNAME
const char hostname_usage[] =
"hostname [OPTION] {hostname | -F file}\n"
@@ -549,6 +584,15 @@ const char ls_usage[] =
;
#endif
+#if defined BB_LSMOD
+const char lsmod_usage[] =
+ "lsmod\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nList the currently loaded kernel modules.\n"
+#endif
+ ;
+#endif
+
#if defined BB_MAKEDEVS
const char makedevs_usage[] =
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n"
@@ -767,6 +811,15 @@ const char ping_usage[] =
#endif
#endif
+#if defined BB_POWEROFF
+const char poweroff_usage[] =
+ "poweroff\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nHalt the system and request that the kernel shut off the power.\n"
+#endif
+ ;
+#endif
+
#if defined BB_PRINTF
const char printf_usage[] =
"printf FORMAT [ARGUMENT...]\n"
@@ -787,6 +840,24 @@ const char ps_usage[] =
;
#endif
+#if defined BB_PWD
+const char pwd_usage[] =
+ "pwd\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nPrint the full filename of the current working directory.\n"
+#endif
+ ;
+#endif
+
+#if defined BB_REBOOT
+const char reboot_usage[] =
+ "reboot\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReboot the system.\n"
+#endif
+ ;
+#endif
+
#if defined BB_RM
const char rm_usage[] =
"rm [OPTION]... FILE...\n"
@@ -1055,6 +1126,15 @@ const char tr_usage[] =
;
#endif
+#if defined BB_TRUE_FALSE
+const char true_usage[] =
+ "true\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReturn an exit code of TRUE (0).\n"
+#endif
+ ;
+#endif
+
#if defined BB_TTY
const char tty_usage[] =
"tty\n"
@@ -1129,6 +1209,15 @@ const char update_usage[] =
;
#endif
+#if defined BB_UPTIME
+const char uptime_usage[] =
+ "uptime\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nDisplay the time since the last boot.\n"
+#endif
+ ;
+#endif
+
#if defined BB_USLEEP
const char usleep_usage[] =
"usleep N\n"
diff --git a/clear.c b/clear.c
index dba1056..b1641bd 100644
--- a/clear.c
+++ b/clear.c
@@ -28,6 +28,9 @@
extern int clear_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(clear_usage);
+
printf("\033[H\033[J");
return(TRUE);
}
diff --git a/console-tools/clear.c b/console-tools/clear.c
index dba1056..b1641bd 100644
--- a/console-tools/clear.c
+++ b/console-tools/clear.c
@@ -28,6 +28,9 @@
extern int clear_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(clear_usage);
+
printf("\033[H\033[J");
return(TRUE);
}
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index f1010a6..3bf79de 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -25,6 +25,9 @@
extern int hostid_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(hostid_usage);
+
printf("%lx\n", gethostid());
return(TRUE);
}
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index f0c923b..1a023d3 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -30,6 +30,9 @@ extern int pwd_main(int argc, char **argv)
{
char buf[BUFSIZ + 1];
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(pwd_usage);
+
if (getcwd(buf, sizeof(buf)) == NULL)
fatalError("%s\n", strerror(errno));
diff --git a/halt.c b/halt.c
index 2ca36d0..7baccf5 100644
--- a/halt.c
+++ b/halt.c
@@ -26,6 +26,9 @@
extern int halt_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(halt_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR1));
diff --git a/hostid.c b/hostid.c
index f1010a6..3bf79de 100644
--- a/hostid.c
+++ b/hostid.c
@@ -25,6 +25,9 @@
extern int hostid_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(hostid_usage);
+
printf("%lx\n", gethostid());
return(TRUE);
}
diff --git a/init/halt.c b/init/halt.c
index 2ca36d0..7baccf5 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -26,6 +26,9 @@
extern int halt_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(halt_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR1));
diff --git a/init/poweroff.c b/init/poweroff.c
index 126a0fb..b499d14 100644
--- a/init/poweroff.c
+++ b/init/poweroff.c
@@ -26,6 +26,9 @@
extern int poweroff_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(poweroff_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR2));
diff --git a/init/reboot.c b/init/reboot.c
index bde8dbd..bef9b26 100644
--- a/init/reboot.c
+++ b/init/reboot.c
@@ -26,6 +26,9 @@
extern int reboot_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(reboot_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGINT));
diff --git a/lsmod.c b/lsmod.c
index 6eb9c56..95006f0 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -36,5 +36,8 @@ extern int lsmod_main(int argc, char **argv)
char *filename = "/proc/modules";
#endif
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(lsmod_usage);
+
return(print_file_by_name(filename));
}
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 6eb9c56..95006f0 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -36,5 +36,8 @@ extern int lsmod_main(int argc, char **argv)
char *filename = "/proc/modules";
#endif
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(lsmod_usage);
+
return(print_file_by_name(filename));
}
diff --git a/poweroff.c b/poweroff.c
index 126a0fb..b499d14 100644
--- a/poweroff.c
+++ b/poweroff.c
@@ -26,6 +26,9 @@
extern int poweroff_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(poweroff_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR2));
diff --git a/procps/uptime.c b/procps/uptime.c
index efdbccf..6a8bfa6 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -46,6 +46,9 @@ extern int uptime_main(int argc, char **argv)
struct tm *current_time;
time_t current_secs;
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(uptime_usage);
+
time(&current_secs);
current_time = localtime(&current_secs);
diff --git a/pwd.c b/pwd.c
index f0c923b..1a023d3 100644
--- a/pwd.c
+++ b/pwd.c
@@ -30,6 +30,9 @@ extern int pwd_main(int argc, char **argv)
{
char buf[BUFSIZ + 1];
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(pwd_usage);
+
if (getcwd(buf, sizeof(buf)) == NULL)
fatalError("%s\n", strerror(errno));
diff --git a/reboot.c b/reboot.c
index bde8dbd..bef9b26 100644
--- a/reboot.c
+++ b/reboot.c
@@ -26,6 +26,9 @@
extern int reboot_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(reboot_usage);
+
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGINT));
diff --git a/true_false.c b/true_false.c
index c56f5e7..33703ff 100644
--- a/true_false.c
+++ b/true_false.c
@@ -27,10 +27,16 @@
extern int true_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(true_usage);
+
return(TRUE);
}
extern int false_main(int argc, char **argv)
{
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(false_usage);
+
return(FALSE);
}
diff --git a/uptime.c b/uptime.c
index efdbccf..6a8bfa6 100644
--- a/uptime.c
+++ b/uptime.c
@@ -46,6 +46,9 @@ extern int uptime_main(int argc, char **argv)
struct tm *current_time;
time_t current_secs;
+ if (argc > 1 && strcmp(argv[1], "--help") == 0)
+ usage(uptime_usage);
+
time(&current_secs);
current_time = localtime(&current_secs);
diff --git a/usage.c b/usage.c
index d5a34ec..56ea80d 100644
--- a/usage.c
+++ b/usage.c
@@ -83,6 +83,15 @@ const char chvt_usage[] =
;
#endif
+#if defined BB_CLEAR
+const char clear_usage[] =
+ "clear\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nClear screen.\n"
+#endif
+ ;
+#endif
+
#if defined BB_CP_MV
const char cp_usage[] =
"cp [OPTION]... SOURCE DEST\n"
@@ -241,6 +250,15 @@ const char echo_usage[] =
;
#endif
+#if defined BB_TRUE_FALSE
+const char false_usage[] =
+ "false\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReturn an exit code of FALSE (1).\n"
+#endif
+ ;
+#endif
+
#if defined BB_FDFLUSH
const char fdflush_usage[] =
"fdflush DEVICE\n"
@@ -340,6 +358,14 @@ const char gzip_usage[] =
;
#endif
+#if defined BB_HALT
+const char halt_usage[] =
+ "halt\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nHalt the system.\n"
+#endif
+ ;
+
#if defined BB_HEAD
const char head_usage[] =
"head [OPTION] [FILE]...\n"
@@ -353,6 +379,15 @@ const char head_usage[] =
;
#endif
+#if defined BB_HOSTID
+const char hostid_usage[] =
+ "hostid\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nPrint out a unique 32-bit identifier for the machine.\n"
+#endif
+ ;
+#endif
+
#if defined BB_HOSTNAME
const char hostname_usage[] =
"hostname [OPTION] {hostname | -F file}\n"
@@ -549,6 +584,15 @@ const char ls_usage[] =
;
#endif
+#if defined BB_LSMOD
+const char lsmod_usage[] =
+ "lsmod\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nList the currently loaded kernel modules.\n"
+#endif
+ ;
+#endif
+
#if defined BB_MAKEDEVS
const char makedevs_usage[] =
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n"
@@ -767,6 +811,15 @@ const char ping_usage[] =
#endif
#endif
+#if defined BB_POWEROFF
+const char poweroff_usage[] =
+ "poweroff\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nHalt the system and request that the kernel shut off the power.\n"
+#endif
+ ;
+#endif
+
#if defined BB_PRINTF
const char printf_usage[] =
"printf FORMAT [ARGUMENT...]\n"
@@ -787,6 +840,24 @@ const char ps_usage[] =
;
#endif
+#if defined BB_PWD
+const char pwd_usage[] =
+ "pwd\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nPrint the full filename of the current working directory.\n"
+#endif
+ ;
+#endif
+
+#if defined BB_REBOOT
+const char reboot_usage[] =
+ "reboot\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReboot the system.\n"
+#endif
+ ;
+#endif
+
#if defined BB_RM
const char rm_usage[] =
"rm [OPTION]... FILE...\n"
@@ -1055,6 +1126,15 @@ const char tr_usage[] =
;
#endif
+#if defined BB_TRUE_FALSE
+const char true_usage[] =
+ "true\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nReturn an exit code of TRUE (0).\n"
+#endif
+ ;
+#endif
+
#if defined BB_TTY
const char tty_usage[] =
"tty\n"
@@ -1129,6 +1209,15 @@ const char update_usage[] =
;
#endif
+#if defined BB_UPTIME
+const char uptime_usage[] =
+ "uptime\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nDisplay the time since the last boot.\n"
+#endif
+ ;
+#endif
+
#if defined BB_USLEEP
const char usleep_usage[] =
"usleep N\n"