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.
This commit is contained in:
Eric Andersen
2001-02-14 21:23:06 +00:00
parent 68be2ab914
commit 67991cf824
198 changed files with 702 additions and 3979 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);

View File

@@ -372,7 +372,7 @@ int getopt_main(int argc, char *argv[])
quote=0;
break;
default:
usage(getopt_usage);
show_usage();
}
if (!optstr) {

View File

@@ -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

View File

@@ -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);

View File

@@ -505,5 +505,5 @@ singlemount:
goto singlemount;
goodbye:
usage(mount_usage);
show_usage();
}

View File

@@ -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");

View File

@@ -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) {

View File

@@ -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();
}

View File

@@ -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();
}
}