mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 18:33:06 +00:00
Add usage messages for applets without them.
This commit is contained in:
parent
91a4400fd5
commit
2f46b664b7
@ -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"
|
||||
|
3
clear.c
3
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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
3
halt.c
3
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));
|
||||
|
3
hostid.c
3
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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
3
lsmod.c
3
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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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(¤t_secs);
|
||||
current_time = localtime(¤t_secs);
|
||||
|
||||
|
3
pwd.c
3
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));
|
||||
|
||||
|
3
reboot.c
3
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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
3
uptime.c
3
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(¤t_secs);
|
||||
current_time = localtime(¤t_secs);
|
||||
|
||||
|
89
usage.c
89
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"
|
||||
|
Loading…
Reference in New Issue
Block a user