diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-02-14 21:23:06 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-02-14 21:23:06 +0000 |
commit | 67991cf824f8df27e74c92d754fb507681c69ce6 (patch) | |
tree | a0b652f3dc794d1050c1a8de3afb014a621238fa /util-linux | |
parent | 68be2ab914e1e20fe666bbd22a89a18714be2789 (diff) | |
download | busybox-67991cf824f8df27e74c92d754fb507681c69ce6.tar.gz |
This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/dmesg.c | 11 | ||||
-rw-r--r-- | util-linux/fdflush.c | 2 | ||||
-rw-r--r-- | util-linux/freeramdisk.c | 2 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 5 | ||||
-rw-r--r-- | util-linux/getopt.c | 2 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 7 | ||||
-rw-r--r-- | util-linux/mkswap.c | 10 | ||||
-rw-r--r-- | util-linux/mount.c | 2 | ||||
-rw-r--r-- | util-linux/pivot_root.c | 2 | ||||
-rw-r--r-- | util-linux/rdate.c | 6 | ||||
-rw-r--r-- | util-linux/swaponoff.c | 2 | ||||
-rw-r--r-- | util-linux/umount.c | 4 |
12 files changed, 20 insertions, 35 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index c21f84c9a..47f9f4474 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -53,21 +53,21 @@ int dmesg_main(int argc, char **argv) case 'n': cmd = 8; if (optarg == NULL) - usage(dmesg_usage); + show_usage(); level = atoi(optarg); break; case 's': if (optarg == NULL) - usage(dmesg_usage); + show_usage(); bufsize = atoi(optarg); break; default: - usage(dmesg_usage); + show_usage(); } } if (optind < argc) { - goto end; + show_usage(); } if (cmd == 8) { @@ -97,7 +97,4 @@ int dmesg_main(int argc, char **argv) if (lastc != '\n') putchar('\n'); return EXIT_SUCCESS; - end: - usage(dmesg_usage); - return EXIT_FAILURE; } diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index fcf8ddd28..f10cceae0 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c @@ -35,7 +35,7 @@ extern int fdflush_main(int argc, char **argv) int fd; if (argc <= 1 || **(++argv) == '-') - usage(fdflush_usage); + show_usage(); if ((fd = open(*argv, 0)) < 0) perror_msg_and_die("%s", *argv); diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 8f90f40b5..cf25fae6a 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -40,7 +40,7 @@ freeramdisk_main(int argc, char **argv) int f; if (argc != 2 || *argv[1] == '-') { - usage(freeramdisk_usage); + show_usage(); } if ((f = open(argv[1], O_RDWR)) == -1) { diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 9d7622006..2b4c65144 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -283,11 +283,6 @@ static void leave(int status) exit(status); } -static void show_usage(void) -{ - usage(fsck_minix_usage); -} - static void die(const char *str) { error_msg("%s", str); diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 625263184..eb28d5d07 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -372,7 +372,7 @@ int getopt_main(int argc, char *argv[]) quote=0; break; default: - usage(getopt_usage); + show_usage(); } if (!optstr) { diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 9b40faac6..6b4a3e2d1 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -255,13 +255,6 @@ static inline int bit(char * a,unsigned int i) #define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1)) #define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1)) -static void show_usage() __attribute__ ((noreturn)); - -static void show_usage() -{ - usage(mkfs_minix_usage); -} - /* * Check to make certain that our new filesystem won't be created on * an already mounted partition. Code adapted from mke2fs, Copyright diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 7d690ad99..48637e889 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -287,7 +287,7 @@ int mkswap_main(int argc, char **argv) PAGES = strtol(argv[0], &tmp, 0) / blocks_per_page; if (*tmp) - usage(mkswap_usage); + show_usage(); } else device_name = argv[0]; } else { @@ -302,13 +302,13 @@ int mkswap_main(int argc, char **argv) version = atoi(argv[0] + 2); break; default: - usage(mkswap_usage); + show_usage(); } } } if (!device_name) { error_msg("error: Nowhere to set up swap on?"); - usage(mkswap_usage); + show_usage(); } sz = get_size(device_name); if (!PAGES) { @@ -331,12 +331,12 @@ int mkswap_main(int argc, char **argv) } if (version != 0 && version != 1) { error_msg("error: unknown version %d", version); - usage(mkswap_usage); + show_usage(); } if (PAGES < 10) { error_msg("error: swap area needs to be at least %ldkB", (long) (10 * pagesize / 1024)); - usage(mkswap_usage); + show_usage(); } #if 0 maxpages = ((version == 0) ? V0_MAX_PAGES : V1_MAX_PAGES); diff --git a/util-linux/mount.c b/util-linux/mount.c index 79813ba18..2f5bba59d 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -505,5 +505,5 @@ singlemount: goto singlemount; goodbye: - usage(mount_usage); + show_usage(); } diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c index 92fe4aeab..e00710148 100644 --- a/util-linux/pivot_root.c +++ b/util-linux/pivot_root.c @@ -20,7 +20,7 @@ static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) int pivot_root_main(int argc, char **argv) { if (argc != 3) - usage(pivot_root_usage); + show_usage(); if (pivot_root(argv[1],argv[2]) < 0) perror_msg_and_die("pivot_root"); diff --git a/util-linux/rdate.c b/util-linux/rdate.c index d350be877..38a7689e9 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -95,14 +95,14 @@ int rdate_main(int argc, char **argv) /* Interpret command line args */ /* do special-case option parsing */ if (argv[1] && (strcmp(argv[1], "--help") == 0)) - usage(rdate_usage); + show_usage(); /* do normal option parsing */ while ((opt = getopt(argc, argv, "Hsp")) > 0) { switch (opt) { default: case 'H': - usage(rdate_usage); + show_usage(); break; case 's': setdate++; @@ -117,7 +117,7 @@ int rdate_main(int argc, char **argv) if (printdate==0 && setdate==0) setdate++; if (optind == argc) { - usage(rdate_usage); + show_usage(); } if ((time= askremotedate(argv[optind])) == (time_t)-1) { diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 74f6ec36e..8dda0972a 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -107,5 +107,5 @@ extern int swap_on_off_main(int argc, char **argv) return EXIT_SUCCESS; usage_and_exit: - usage((whichApp == SWAPON_APP) ? swapon_usage : swapoff_usage); + show_usage(); } diff --git a/util-linux/umount.c b/util-linux/umount.c index 39842d232..c160ec284 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -235,7 +235,7 @@ static int umount_all(int useMtab) extern int umount_main(int argc, char **argv) { if (argc < 2) { - usage(umount_usage); + show_usage(); } #ifdef BB_FEATURE_CLEAN_UP atexit(mtab_free); @@ -269,7 +269,7 @@ extern int umount_main(int argc, char **argv) case 'v': break; /* ignore -v */ default: - usage(umount_usage); + show_usage(); } } |