Add usage messages for applets without them.

This commit is contained in:
Matt Kraai 2000-07-19 18:01:00 +00:00
parent 91a4400fd5
commit 2f46b664b7
19 changed files with 232 additions and 0 deletions

View File

@ -83,6 +83,15 @@ const char chvt_usage[] =
; ;
#endif #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 #if defined BB_CP_MV
const char cp_usage[] = const char cp_usage[] =
"cp [OPTION]... SOURCE DEST\n" "cp [OPTION]... SOURCE DEST\n"
@ -241,6 +250,15 @@ const char echo_usage[] =
; ;
#endif #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 #if defined BB_FDFLUSH
const char fdflush_usage[] = const char fdflush_usage[] =
"fdflush DEVICE\n" "fdflush DEVICE\n"
@ -340,6 +358,14 @@ const char gzip_usage[] =
; ;
#endif #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 #if defined BB_HEAD
const char head_usage[] = const char head_usage[] =
"head [OPTION] [FILE]...\n" "head [OPTION] [FILE]...\n"
@ -353,6 +379,15 @@ const char head_usage[] =
; ;
#endif #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 #if defined BB_HOSTNAME
const char hostname_usage[] = const char hostname_usage[] =
"hostname [OPTION] {hostname | -F file}\n" "hostname [OPTION] {hostname | -F file}\n"
@ -549,6 +584,15 @@ const char ls_usage[] =
; ;
#endif #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 #if defined BB_MAKEDEVS
const char makedevs_usage[] = const char makedevs_usage[] =
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n" "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n"
@ -767,6 +811,15 @@ const char ping_usage[] =
#endif #endif
#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 #if defined BB_PRINTF
const char printf_usage[] = const char printf_usage[] =
"printf FORMAT [ARGUMENT...]\n" "printf FORMAT [ARGUMENT...]\n"
@ -787,6 +840,24 @@ const char ps_usage[] =
; ;
#endif #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 #if defined BB_RM
const char rm_usage[] = const char rm_usage[] =
"rm [OPTION]... FILE...\n" "rm [OPTION]... FILE...\n"
@ -1055,6 +1126,15 @@ const char tr_usage[] =
; ;
#endif #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 #if defined BB_TTY
const char tty_usage[] = const char tty_usage[] =
"tty\n" "tty\n"
@ -1129,6 +1209,15 @@ const char update_usage[] =
; ;
#endif #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 #if defined BB_USLEEP
const char usleep_usage[] = const char usleep_usage[] =
"usleep N\n" "usleep N\n"

View File

@ -28,6 +28,9 @@
extern int clear_main(int argc, char **argv) extern int clear_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(clear_usage);
printf("\033[H\033[J"); printf("\033[H\033[J");
return(TRUE); return(TRUE);
} }

View File

@ -28,6 +28,9 @@
extern int clear_main(int argc, char **argv) extern int clear_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(clear_usage);
printf("\033[H\033[J"); printf("\033[H\033[J");
return(TRUE); return(TRUE);
} }

View File

@ -25,6 +25,9 @@
extern int hostid_main(int argc, char **argv) extern int hostid_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(hostid_usage);
printf("%lx\n", gethostid()); printf("%lx\n", gethostid());
return(TRUE); return(TRUE);
} }

View File

@ -30,6 +30,9 @@ extern int pwd_main(int argc, char **argv)
{ {
char buf[BUFSIZ + 1]; char buf[BUFSIZ + 1];
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(pwd_usage);
if (getcwd(buf, sizeof(buf)) == NULL) if (getcwd(buf, sizeof(buf)) == NULL)
fatalError("%s\n", strerror(errno)); fatalError("%s\n", strerror(errno));

3
halt.c
View File

@ -26,6 +26,9 @@
extern int halt_main(int argc, char **argv) extern int halt_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(halt_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR1)); return(kill(*(findPidByName("init")), SIGUSR1));

View File

@ -25,6 +25,9 @@
extern int hostid_main(int argc, char **argv) extern int hostid_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(hostid_usage);
printf("%lx\n", gethostid()); printf("%lx\n", gethostid());
return(TRUE); return(TRUE);
} }

View File

@ -26,6 +26,9 @@
extern int halt_main(int argc, char **argv) extern int halt_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(halt_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR1)); return(kill(*(findPidByName("init")), SIGUSR1));

View File

@ -26,6 +26,9 @@
extern int poweroff_main(int argc, char **argv) extern int poweroff_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(poweroff_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR2)); return(kill(*(findPidByName("init")), SIGUSR2));

View File

@ -26,6 +26,9 @@
extern int reboot_main(int argc, char **argv) extern int reboot_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(reboot_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGINT)); return(kill(*(findPidByName("init")), SIGINT));

View File

@ -36,5 +36,8 @@ extern int lsmod_main(int argc, char **argv)
char *filename = "/proc/modules"; char *filename = "/proc/modules";
#endif #endif
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(lsmod_usage);
return(print_file_by_name(filename)); return(print_file_by_name(filename));
} }

View File

@ -36,5 +36,8 @@ extern int lsmod_main(int argc, char **argv)
char *filename = "/proc/modules"; char *filename = "/proc/modules";
#endif #endif
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(lsmod_usage);
return(print_file_by_name(filename)); return(print_file_by_name(filename));
} }

View File

@ -26,6 +26,9 @@
extern int poweroff_main(int argc, char **argv) extern int poweroff_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(poweroff_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGUSR2)); return(kill(*(findPidByName("init")), SIGUSR2));

View File

@ -46,6 +46,9 @@ extern int uptime_main(int argc, char **argv)
struct tm *current_time; struct tm *current_time;
time_t current_secs; time_t current_secs;
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(uptime_usage);
time(&current_secs); time(&current_secs);
current_time = localtime(&current_secs); current_time = localtime(&current_secs);

3
pwd.c
View File

@ -30,6 +30,9 @@ extern int pwd_main(int argc, char **argv)
{ {
char buf[BUFSIZ + 1]; char buf[BUFSIZ + 1];
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(pwd_usage);
if (getcwd(buf, sizeof(buf)) == NULL) if (getcwd(buf, sizeof(buf)) == NULL)
fatalError("%s\n", strerror(errno)); fatalError("%s\n", strerror(errno));

View File

@ -26,6 +26,9 @@
extern int reboot_main(int argc, char **argv) extern int reboot_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(reboot_usage);
#ifdef BB_FEATURE_LINUXRC #ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */ /* don't assume init's pid == 1 */
return(kill(*(findPidByName("init")), SIGINT)); return(kill(*(findPidByName("init")), SIGINT));

View File

@ -27,10 +27,16 @@
extern int true_main(int argc, char **argv) extern int true_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(true_usage);
return(TRUE); return(TRUE);
} }
extern int false_main(int argc, char **argv) extern int false_main(int argc, char **argv)
{ {
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(false_usage);
return(FALSE); return(FALSE);
} }

View File

@ -46,6 +46,9 @@ extern int uptime_main(int argc, char **argv)
struct tm *current_time; struct tm *current_time;
time_t current_secs; time_t current_secs;
if (argc > 1 && strcmp(argv[1], "--help") == 0)
usage(uptime_usage);
time(&current_secs); time(&current_secs);
current_time = localtime(&current_secs); current_time = localtime(&current_secs);

89
usage.c
View File

@ -83,6 +83,15 @@ const char chvt_usage[] =
; ;
#endif #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 #if defined BB_CP_MV
const char cp_usage[] = const char cp_usage[] =
"cp [OPTION]... SOURCE DEST\n" "cp [OPTION]... SOURCE DEST\n"
@ -241,6 +250,15 @@ const char echo_usage[] =
; ;
#endif #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 #if defined BB_FDFLUSH
const char fdflush_usage[] = const char fdflush_usage[] =
"fdflush DEVICE\n" "fdflush DEVICE\n"
@ -340,6 +358,14 @@ const char gzip_usage[] =
; ;
#endif #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 #if defined BB_HEAD
const char head_usage[] = const char head_usage[] =
"head [OPTION] [FILE]...\n" "head [OPTION] [FILE]...\n"
@ -353,6 +379,15 @@ const char head_usage[] =
; ;
#endif #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 #if defined BB_HOSTNAME
const char hostname_usage[] = const char hostname_usage[] =
"hostname [OPTION] {hostname | -F file}\n" "hostname [OPTION] {hostname | -F file}\n"
@ -549,6 +584,15 @@ const char ls_usage[] =
; ;
#endif #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 #if defined BB_MAKEDEVS
const char makedevs_usage[] = const char makedevs_usage[] =
"makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n" "makedevs NAME TYPE MAJOR MINOR FIRST LAST [s]\n"
@ -767,6 +811,15 @@ const char ping_usage[] =
#endif #endif
#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 #if defined BB_PRINTF
const char printf_usage[] = const char printf_usage[] =
"printf FORMAT [ARGUMENT...]\n" "printf FORMAT [ARGUMENT...]\n"
@ -787,6 +840,24 @@ const char ps_usage[] =
; ;
#endif #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 #if defined BB_RM
const char rm_usage[] = const char rm_usage[] =
"rm [OPTION]... FILE...\n" "rm [OPTION]... FILE...\n"
@ -1055,6 +1126,15 @@ const char tr_usage[] =
; ;
#endif #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 #if defined BB_TTY
const char tty_usage[] = const char tty_usage[] =
"tty\n" "tty\n"
@ -1129,6 +1209,15 @@ const char update_usage[] =
; ;
#endif #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 #if defined BB_USLEEP
const char usleep_usage[] = const char usleep_usage[] =
"usleep N\n" "usleep N\n"