case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
return EXIT_SUCCESS;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc != 5)
case 'z':
cf->zero_start = 1;
break;
+ default:
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc != 3)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
fdisk_set_size_unit(cxt, FDISK_SIZEUNIT_BYTES);
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
blksize = strtou32_or_err(optarg, _("invalid blocksize argument"));
break;
default:
- usage(FSCK_EX_USAGE);
+ errtryhelp(FSCK_EX_USAGE);
}
if ((argc - optind) != 1)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(FSCK_EX_USAGE);
}
argc -= optind;
argv += optind;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
ct = argc - optind;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
opt_holes = 1;
break;
default:
- usage(FSCK_EX_USAGE);
+ errtryhelp(MKFS_EX_USAGE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(MKFS_EX_USAGE);
}
argc -= optind;
argv += optind;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(EXIT_SUCCESS);
default:
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
/*
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc != 4)
sf->notell = 1;
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
#endif
break;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
exit(eval); \
})
+#define errtryh(eval) __extension__ ({ \
+ fprintf(stderr, _("Try '%s -h' for more information.\n"), \
+ program_invocation_short_name); \
+ exit(eval); \
+})
+
static inline __attribute__((const)) int is_power_of_2(unsigned long num)
{
case 'u':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
ctl->changed = 1;
ctl->interactive = 0;
pinfo->shell = optarg;
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
/* done parsing arguments. check for a username. */
ctl.time_fmt = which_time_format(optarg);
break;
default:
- usage(&ctl, stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
break;
}
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (!(pw_entry = getpwuid(getuid())))
printf(UTIL_LINUX_VERSION);
return EXIT_FAILURE;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
exit(EXIT_SUCCESS);
default:
- usage (EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
/* ignore - backward compatibility */
break;
case 'h':
- err = 0;
- /* fallthrough */
+ usage(0);
+ break;
default:
- usage(err);
+ errtryh(EXIT_FAILURE);
}
}
return EXIT_SUCCESS;
case 'h':
usage(stdout);
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
force_tree = 1;
break;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
errx(EXIT_FAILURE, _("invalid structured data parameter: '%s'"), optarg);
add_structured_data_param(get_user_structured_data(&ctl), optarg);
break;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
argc -= optind;
return EXIT_SUCCESS;
case 'h':
usage(stdout);
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
argv += optind;
case 'u':
disable_columns_truncate();
break;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
flags |= NAMEI_VERTICAL;
break;
default:
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
#include "c.h"
#include "xalloc.h"
#include "strutils.h"
+#include "nls.h"
#define LOG(level,args) if (loglev >= level) { fprintf args; }
usage(stdout);
break;
default:
- usage(stderr);
- break;
+ errtryh(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
switch (do_type) {
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
while((c = getopt_long(argc, argv, "+abdD:fiphmoP:T:rRvV", longopts, NULL)) != -1)
{
- int ret = EXIT_FAILURE;
-
switch (c) {
case 'a':
ctl->all_tasks = 1;
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- ret = EXIT_SUCCESS;
- /* fallthrough */
+ show_usage(EXIT_SUCCESS);
default:
- show_usage(ret);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
switch (ioclass) {
usage(stdout);
break;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
act = ACT_ZEROOUT;
break;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
+ default:
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc < 2)
case OPT_TIME_FORMAT:
ctl.time_fmt = which_time_format(optarg);
break;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
argc -= optind;
exit(EXIT_SUCCESS);
break;
default:
- case '?':
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
break;
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
case 'V':
printf(UTIL_LINUX_VERSION);
exit(EX_OK);
+ case 'h':
+ usage(0);
default:
- /* optopt will be set if this was an unrecognized
- * option, i.e. *not* 'h' or '?
- */
- usage(optopt ? EX_USAGE : 0);
- break;
+ errtryhelp(EX_USAGE);
}
}
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
verbose = 1;
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
break;
}
}
out_version();
return 0;
case 'h': /* --help */
- case '?':
- default:
usage(NULL);
+ default:
+ errtryhelp(EXIT_FAILURE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- ask_shm = ask_msg = ask_sem = 0;
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
/* print usage if we still have some arguments left over */
if (optind < argc) {
warnx(_("unknown argument: %s"), argv[optind]);
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(EXIT_SUCCESS);
default:
- warnx(_("invalid option"));
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
}
flags |= LOOPDEV_FL_SIZELIMIT;
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
lsmem->want_table = 0;
break;
default:
- lsmem_usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
ls.fltr_ntypes++;
break;
}
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
mnt_context_set_source(cxt, optarg);
break;
default:
- usage(stderr);
- break;
+ errtryhelp(MOUNT_EX_USAGE);
}
}
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- usage(stderr);
- break;
+ errtryhelp(EXIT_FAILURE);
}
}
break;
#endif
default:
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc != 3)
case RAW_OPTION:
raw = 1;
break;
-
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
if (argc > optind && pid)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
warnx(_("unrecognized option '--list'"));
/* fallthrough */
default:
- show_usage(NULL);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
- case '?':
- usage(stderr);
default:
- errx(EXIT_FAILURE, _("unrecognized option '%c'"), c);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc - optind < 1)
case 'U':
add_uuid(optarg);
break;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
argv += optind;
return EXIT_SUCCESS;
case 0:
break;
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
argv += optind;
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
default:
- print_usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
print_version();
break;
default:
- usage(stderr);
- break;
+ errtryhelp(MOUNT_EX_USAGE);
}
}
propagation = parse_propagation(optarg);
break;
default:
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
}
noident = 1;
notimeouts = 1;
break;
-
- case '?':
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
usage(stdout);
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
argv += optind;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
argv += optind;
if ((argc < 1 && !tname) || argc > 3) {
warnx(_("wrong number of arguments"));
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (!tname)
tname = argv[idx++];
case OPT_HELP:
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
argc -= optind;
do_write(&ctl);
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
free(ctl.dst_tty_path);
return EXIT_SUCCESS;
case 'H':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (optind != argc)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc > 1)
xflag = 1;
break;
default:
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
argv += optind;
exit(EXIT_SUCCESS);
break;
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
}
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
setvbuf(stdin, NULL, _IONBF, 0);
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
argc -= optind;
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
if (argc == optind)
case 'h':
usage(stdout);
default:
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
}
setupterm(termtype, STDOUT_FILENO, &ret);
switch (ret) {