setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "nr:zelfVh", longopts, NULL)) != -1)
switch (c) {
case 'f':
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc < 2) {
warnx(_("not enough arguments"));
}
/* -V not together with commands */
- if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
- }
+ if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))
+ print_version(EXIT_SUCCESS);
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
usage();
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while((c = getopt_long(argc, argv, "L::hVz", longopts, NULL)) != -1) {
switch(c) {
_("unsupported color mode"));
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'z':
cf->zero_start = 1;
break;
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "f:t:r:nVh", longopts, NULL)) != -1)
switch (ch) {
verify = 0;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
fdisk_init_debug(0);
scols_init_debug(0);
break;
case 'V': /* preferred for util-linux */
case 'v': /* for backward compatibility only */
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'w':
wipemode = wipemode_from_string(optarg);
if (wipemode < 0)
/* the only two longopts to satisfy UL standards */
if (!opts_for_fsck && !strcmp(arg, "--help"))
usage();
- if (!opts_for_fsck && !strcmp(arg, "--version")) {
- printf(UTIL_LINUX_VERSION);
- exit(FSCK_EX_OK);
- }
+ if (!opts_for_fsck && !strcmp(arg, "--version"))
+ print_version(FSCK_EX_OK);
if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
if (num_devices >= MAX_DEVICES)
setlocale(LC_CTYPE, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(FSCK_EX_USAGE);
mnt_init_debug(0); /* init libmount debug mask */
setlocale(LC_CTYPE, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(FSCK_EX_USAGE);
usage();
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return FSCK_EX_OK;
+ print_version(FSCK_EX_OK);
case 'x':
opt_extract = 1;
if(optarg)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(FSCK_EX_USAGE);
force = 1;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return FSCK_EX_OK;
+ print_version(FSCK_EX_OK);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((opt = getopt_long(argc, argv, "d:xVh", longopts, NULL)) != -1) {
switch (opt) {
xflag = 1;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc < 2) {
warnx(_("not enough arguments"));
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc == 2 && !strcmp(argv[1], "-V"))
print_version(EXIT_SUCCESS);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc > 1) {
/* first arg may be one of our standard longopts */
if (!strcmp(argv[1], "--help"))
usage();
if (!strcmp(argv[1], "--version")) {
- printf(UTIL_LINUX_VERSION);
+ print_version(EXIT_SUCCESS);
exit(MKFS_EX_OK);
}
}
/* old option, ignored */
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(MKFS_EX_OK);
+ print_version(MKFS_EX_OK);
case 'v':
verbose = 1;
break;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(MKFS_EX_USAGE);
listfile = optarg;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return MKFS_EX_OK;
+ print_version(MKFS_EX_OK);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while((c = getopt_long(argc, argv, "cfp:L:v:U:Vh", longopts, NULL)) != -1) {
switch (c) {
#endif
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv,
"abdglrsuvn:t:o:PS:hV", long_opts, NULL)) != -1) {
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "qaVh", longopts, NULL)) != -1)
switch (c) {
do_query_all = 1;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "aAbcdfFgGhJlLo:O:nN:qrsTu:vVX:Y:w:W:",
longopts, &longidx)) != -1) {
errx(EXIT_FAILURE, _("unsupported unit '%c'"), *optarg);
break;
case 'v':
- printf(_("%s from %s\n"), program_invocation_short_name,
- PACKAGE_STRING);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'V':
sf->verify = 1;
break;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "hVL:U:", longopts, NULL)) != -1) {
switch (c) {
usage();
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'L':
label = optarg;
break;
#define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
+#define print_version(eval) __extension__ ({ \
+ printf(UTIL_LINUX_VERSION); \
+ exit(eval); \
+})
+
/*
* scanf modifiers for "strings allocation"
*/
status += check_gecos_string(_("Home Phone"), optarg);
break;
case 'v':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'u':
usage();
default:
setlocale(LC_ALL, ""); /* both for messages and for iscntrl() below */
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
+
uid = getuid();
/* check /etc/login.defs CHFN_RESTRICT */
while ((c = getopt_long(argc, argv, "s:lhuv", long_options, NULL)) != -1) {
switch (c) {
case 'v':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'u': /* deprecated */
case 'h':
usage();
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
parse_argv(argc, argv, &info);
if (!info.username) {
#ifdef TEST_PROGRAM
int main(int argc, char *argv[])
{
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc <= 2) {
fprintf(stderr, _("Usage: %s <passwordfile> <username>...\n"),
argv[0]);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/*
* Which file do we want to read?
*/
usage(&ctl);
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'R':
ctl.showhost = 0;
break;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case HELP_OPTION:
usage();
default:
int main(int argc, char *argv[])
{
char *name, *type;
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc <= 1)
errx(EXIT_FAILURE, "usage: %s <filename> "
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
ctl->time_mode = TIME_SHORT;
ctl->time_mode = parse_time_mode(optarg);
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'Z':
{
#ifdef HAVE_LIBSELINUX
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (ch) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
switch (c) {
case 'h':
usage();
- break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_FAILURE;
+ print_version(EXIT_FAILURE); /* yes FAILURE! */
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
su_init_debug();
su->conv.appdata_ptr = (void *) su;
usage(mode);
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
-
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
fputs(USAGE_SEPARATOR, out);
printf(USAGE_HELP_OPTIONS(26));
printf(USAGE_MAN_TAIL("sulogin(8)"));
+
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout); /* XXX */
+ close_stdout_atexit();
/*
* See if we have a timeout flag.
opt_e = 1;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
- return EXIT_SUCCESS;
default:
/* Do not exit! getopt prints a warning. */
break;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "fro:hV", longopts, NULL)) != -1) {
switch (c) {
case 'h':
usage();
- break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (!strcmp(program_invocation_short_name, "vigr")) {
program = VIGR;
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(BLKID_EXIT_OTHER);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
term = getenv("TERM");
if (term) {
ctl.reform_year = ISO;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long (argc, argv, "bno:JrVh", longopts, NULL)) != -1) {
switch (c) {
ctl.raw = 1;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc != 2) {
/* we return '2' for backward compatibility
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return FINDFS_SUCCESS;
+ print_version(FINDFS_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/* default output format */
flags |= FL_TREE;
case 'e':
flags |= FL_EVALUATE;
break;
- case 'h':
- usage();
- break;
case 'i':
flags |= FL_INVERT;
break;
case 'w':
timeout = strtos32_or_err(optarg, _("invalid timeout argument"));
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'x':
verify = 1;
break;
case FINDMNT_OPT_REAL:
flags |= FL_REAL;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (getenv("GETOPT_COMPATIBLE"))
ctl.compatible = 1;
case 'a':
getopt_long_fp = getopt_long_only;
break;
- case 'h':
- usage();
case 'o':
free(ctl.optstr);
ctl.optstr = xstrdup(optarg);
case 'u':
ctl.quote = 0;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case '?':
case ':':
parse_error(NULL);
+ case 'h':
+ usage();
default:
parse_error(_("internal error, contact the author."));
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) {
switch (ch) {
#endif
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
break;
}
if (!strcmp(arg, "-v") || !strcmp(arg, "-V") ||
- !strcmp(arg, "--version")) {
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- }
+ !strcmp(arg, "--version"))
+ print_version(EXIT_SUCCESS);
if (!strcmp(arg, "-h") || !strcmp(arg, "--help"))
usage();
if (!strcmp(arg, "--verbose")) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
argv = parse_arguments(argc, argv, &ctl);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
INIT_LIST_HEAD(&ctl.user_sds);
INIT_LIST_HEAD(&ctl.reserved_sds);
case 'P':
ctl.port = optarg;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- case 'h':
- usage();
case OPT_OCTET_COUNT:
ctl.octet_count = 1;
break;
errx(EXIT_FAILURE, _("invalid structured data parameter: '%s'"), optarg);
add_structured_data_param(get_user_structured_data(&ctl), optarg);
break;
+
+ case 'V':
+ print_version(EXIT_SUCCESS);
+ case 'h':
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
setlocale(LC_ALL, "");
termchar = *optarg;
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
lsblk = &_ls;
case 'e':
parse_excludes(optarg);
break;
- case 'h':
- usage();
- break;
case 'J':
lsblk->flags |= LSBLK_JSON;
break;
case OPT_SYSROOT:
lsblk->sysroot = optarg;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'E':
lsblk->dedup_id = column_name_to_id(optarg, strlen(optarg));
if (lsblk->dedup_id >= 0)
lsblk->sort_id = column_name_to_id(optarg, strlen(optarg));
if (lsblk->sort_id >= 0)
break;
- /* fallthrough */
+ errtryhelp(EXIT_FAILURE);
+ break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv,
"biJp:o:nruhV", long_opts, NULL)) != -1) {
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
- case 'h':
- usage();
case 'n':
no_headings = 1;
break;
case 'u':
disable_columns_truncate();
break;
+
+ case 'V':
+ print_version(EXIT_SUCCESS);
+ case 'h':
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "f:m:vVh", longopts, NULL)) != -1) {
switch (c) {
ctl.maxsz = strtosize_or_err(optarg,
_("failed to parse length"));
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "hVlmnovx", longopts, NULL)) != -1) {
switch(c) {
- case 'h':
- usage();
- break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'l':
flags |= (NAMEI_OWNERS | NAMEI_MODES | NAMEI_VERTICAL);
break;
case 'v':
flags |= NAMEI_VERTICAL;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "vsVhnoi", longopts, NULL)) != -1)
switch (c) {
case 's':
do_rename = do_symlink;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c =
getopt_long(argc, argv, "p:s:T:krtn:PFSdqVh", longopts,
uuidd_cxt.timeout = strtou32_or_err(optarg,
_("failed to parse --timeout"));
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "rtVhn:N:msx", longopts, NULL)) != -1)
switch (c) {
case 'r':
do_type = UUID_TYPE_DCE_RANDOM;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'n':
namespace = optarg;
break;
case 'x':
is_hex = 1;
break;
+
case 'h':
usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "Jno:rVh", longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
case 'r':
ctrl.raw = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc <= 1) {
warnx(_("not enough arguments"));
/* first arg may be one of our standard longopts */
if (!strcmp(argv[1], "--help"))
usage();
- if (!strcmp(argv[1], "--version")) {
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- }
+ if (!strcmp(argv[1], "--version"))
+ print_version(EXIT_SUCCESS);
}
whereis_init_debug();
case 'l':
list_dirlist(ls);
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "abfhiJnO:o:pqt:V", longopts, NULL)) != -1) {
case 'f':
ctl.force = 1;
break;
- case 'h':
- usage();
- break;
case 'J':
ctl.json = 1;
break;
case 't':
ctl.type_pattern = optarg;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while((c = getopt_long(argc, argv, "+abdD:fiphmoP:T:rRvV", longopts, NULL)) != -1)
{
case 'D':
ctl->deadline = strtou64_or_err(optarg, _("invalid deadline argument"));
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "+n:c:p:P:u:tVh", longopts, NULL)) != EOF)
switch (c) {
case 't':
tolerant = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
memset(&ts, 0, sizeof(ts));
case 'c':
ts.use_list = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
- break;
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
range[0] = 0;
range[1] = ULLONG_MAX;
while ((c = getopt_long(argc, argv, "hVsvo:l:p:z", longopts, NULL)) != -1) {
switch(c) {
- case 'h':
- usage();
- break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'l':
range[1] = strtosize_or_err(optarg,
_("failed to parse length"));
case 'z':
act = ACT_ZEROOUT;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc >= 2 && *argv[1] != '-') {
ctl.command = name_to_command(argv[1]);
err_exclusive_options(c, longopts, excl, excl_st);
switch (c) {
- case 'h':
- usage();
- break;
case 'c':
ctl.count = strtou32_or_err(optarg,
_("failed to parse number of zones"));
case 'v':
ctl.verbose = 1;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
ul_path_init_debug();
sys = ul_new_path(_PATH_SYS_CPU);
cmd = CMD_CPU_DECONFIGURE;
cpu_parse(argv[optind - 1], cpu_set, setsize);
break;
- case 'h':
- usage();
case 'p':
if (strcmp("horizontal", argv[optind - 1]) == 0)
cmd = CMD_CPU_DISPATCH_HORIZONTAL;
case 'r':
cmd = CMD_CPU_RESCAN;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
ul_path_init_debug();
desc->sysmem = ul_new_path(_PATH_SYS_MEMORY);
case 'b':
desc->use_blocks = 1;
break;
- case 'h':
- usage();
- break;
case 'v':
desc->verbose = 1;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'z':
zone = xstrdup(optarg);
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "hn:p:V", longopts, NULL)) != -1) {
switch (c) {
adj = strtos32_or_err(optarg, _("invalid adjust argument"));
has_adj = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (ch) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "CcDdEeF:f:HhkL::l:n:iPprSs:TtuVwx",
longopts, NULL)) != -1) {
colormode = UL_COLORMODE_AUTO;
ctl.pager = 1;
break;
- case 'h':
- usage();
- break;
case 'k':
ctl.fltr_fac = 1;
setbit(ctl.facilities, FAC_BASE(LOG_KERN));
for (n = 1; (size_t) n < ARRAY_SIZE(facility_names); n++)
setbit(ctl.facilities, n);
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'w':
ctl.follow = 1;
break;
case OPT_TIME_FORMAT:
ctl.time_fmt = which_time_format(optarg);
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
case 'F':
ctl->F_option = 1;
break;
- case 'h':
- usage();
- break;
case 'i':
ctl->i_option = 1;
ctl->i_arg = parse_switch(optarg, _("argument error"),
case 'v':
ctl->v_option = 1;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- break;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
break;
setlocale(LC_ALL,"");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/* parse the command line arguments */
parse_args(&ctl, argc, argv);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "hvVncpdizxl:o:", longopts, NULL))
!= -1) {
err_exclusive_options(c, longopts, excl, excl_st);
switch(c) {
- case 'h':
- usage();
- break;
case 'c':
mode |= FALLOC_FL_COLLAPSE_RANGE;
break;
case 'v':
verbose++;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(EX_USAGE);
case OPT_VERBOSE:
verbose = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EX_OK);
+ print_version(EX_OK);
case 'h':
usage();
default:
err_exclusive_options(c, longopts, excl, excl_st);
switch(c) {
- case 'h':
- usage();
- break;
case 'f':
action = FREEZE;
break;
case 'u':
action = UNFREEZE;
break;
+
+ case 'h':
+ usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "Aahl:m:no:Vv", longopts, NULL)) != -1) {
switch(c) {
case 'n':
ctl.dryrun = 1;
break;
- case 'h':
- usage();
- break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'l':
ctl.range.len = strtosize_or_err(optarg,
_("failed to parse length"));
case 'v':
ctl.verbose = 1;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
- break;
}
}
#endif
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv,
"hvVDd:alrsuwf:", longopts, NULL)) != -1) {
ctl.rtc_dev_name = optarg; /* --rtc */
break;
#endif
+
case 'V': /* --version */
- out_version();
- return 0;
+ print_version(EXIT_SUCCESS);
case 'h': /* --help */
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while((opt = getopt_long(argc, argv, "hM:QS:p:Vh", longopts, NULL)) != -1) {
switch(opt) {
case 'p':
permission = strtoul(optarg, NULL, 8);
break;
+
case 'h':
usage();
- break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/* check to see if the command is being invoked in the old way if so
* then remove argument list */
case 'v':
verbose = 1;
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((opt = getopt_long(argc, argv, options, longopts, NULL)) != -1) {
switch (opt) {
case 'b':
unit = IPC_UNIT_BYTES;
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
case 'i':
parse_iflag(optarg, &set_iflag, &clr_iflag);
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
case 'f':
act = A_FIND_FREE;
break;
- case 'h':
- usage();
- break;
case 'J':
json = 1;
break;
break;
case 'v':
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case OPT_SIZELIMIT: /* --sizelimit */
sizelimit = strtosize_or_err(optarg, _("failed to parse size"));
flags |= LOOPDEV_FL_SIZELIMIT;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
}
mod->mode = OUTPUT_CACHES;
break;
- case 'h':
- usage();
case 'J':
mod->json = 1;
break;
case 'y':
mod->physical = 1;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case OPT_OUTPUT_ALL:
all = 1;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
case 'c':
show_creat = 1;
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
printf(USAGE_MAN_TAIL("lsmem(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "abhJno:PrS:s:V", longopts, NULL)) != -1) {
case 'b':
lsmem->bytes = 1;
break;
- case 'h':
- usage();
- break;
case 'J':
lsmem->json = 1;
lsmem->want_summary = 0;
case 'S':
splitarg = optarg;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return 0;
case LSMEM_OPT_SUMARRY:
if (optarg) {
if (strcmp(optarg, "never") == 0)
} else
lsmem->want_table = 0;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
lsns_init_debug();
memset(&ls, 0, sizeof(ls));
for (ncolumns = 0; ncolumns < ARRAY_SIZE(infos); ncolumns++)
columns[ncolumns] = ncolumns;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'p':
ls.fltr_pid = strtos32_or_err(optarg, _("invalid PID argument"));
break;
- case 'h':
- usage();
case 'n':
ls.no_headings = 1;
break;
case 'W':
ls.no_wrap = 1;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(MNT_EX_USAGE);
case 'F':
mnt_context_enable_fork(cxt, TRUE);
break;
- case 'h':
- usage();
- break;
case 'i':
mnt_context_disable_helpers(cxt, TRUE);
break;
case 'v':
mnt_context_enable_verbose(cxt, TRUE);
break;
- case 'V':
- mount_print_version();
- break;
case 'w':
append_option(cxt, "rw");
mnt_context_enable_rwonly_mount(cxt, TRUE);
case MOUNT_OPT_OPTSRC_FORCE:
optmode |= MNT_OMODE_FORCE;
break;
+
+ case 'h':
+ mnt_free_context(cxt);
+ usage();
+ case 'V':
+ mnt_free_context(cxt);
+ mount_print_version();
default:
errtryhelp(MNT_EX_USAGE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
mnt_init_debug(0);
case 'x':
ctl.dev_devno = 1;
break;
+
case 'h':
usage();
- break;
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c =
getopt_long(argc, argv, "+ahVt:m::u::i::n::p::C::U::S:G:r::w::FZ",
longopts, NULL)) != -1) {
switch (c) {
- case 'h':
- usage();
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'a':
do_all = true;
break;
selinux = 1;
break;
#endif
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (ch) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
INIT_LIST_HEAD(&lims);
errx(EXIT_FAILURE, _("option --pid may be specified only once"));
pid = strtos32_or_err(optarg, _("invalid PID argument"));
break;
- case 'h':
- usage();
case 'o':
ncolumns = string_to_idarray(optarg,
columns, ARRAY_SIZE(columns),
if (ncolumns < 0)
return EXIT_FAILURE;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
-
case NOHEADINGS_OPTION:
no_headings = 1;
break;
case RAW_OPTION:
raw = 1;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
proFile = defaultpro;
mapFile = defaultmap;
case 'v':
optVerbose++;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
argc--;
argv++;
if (strcmp(*argv, "-v") == 0 ||
strcmp(*argv, "-V") == 0 ||
- strcmp(*argv, "--version") == 0) {
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
- }
+ strcmp(*argv, "--version") == 0)
+ print_version(EXIT_SUCCESS);
}
if (*argv && (strcmp(*argv, "-n") == 0 || strcmp(*argv, "--priority") == 0)) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "Jno:rVh", longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
case 'r':
ctrl.raw = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((t = getopt_long(argc, argv, "A:ahd:lm:ns:t:uVv",
long_options, NULL)) != EOF) {
case 'v':
ctl.verbose = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc < 1) {
warnx(_("Not enough arguments"));
while ((c = getopt_long(argc, argv, "+hVv3BFILRSTXZ", longopts, NULL)) != -1) {
switch (c) {
- case 'h':
- usage(archwrapper);
- break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'v':
verbose = 1;
break;
} else
warnx(_("unrecognized option '--list'"));
/* fallthrough */
+
default:
errtryhelp(EXIT_FAILURE);
+ case 'h':
+ usage(archwrapper);
+ case 'V':
+ print_version(EXIT_SUCCESS);
}
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
memset(&opts, 0, sizeof(opts));
case RESET_ENV:
opts.reset_env = 1;
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "+Vhcfw", longopts, NULL)) != -1)
switch (ch) {
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'c':
ctty=1;
break;
case 'w':
status = 1;
break;
+
case 'h':
usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "ahvVL:U:",
long_opts, NULL)) != -1) {
case 'a': /* all */
++all;
break;
- case 'h': /* help */
- usage();
- break;
case 'v': /* be chatty */
++verbose;
break;
- case 'V': /* version */
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'L':
add_label(optarg);
break;
case 'U':
add_uuid(optarg);
break;
+
+ case 'h': /* help */
+ usage();
+ case 'V': /* version */
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
memset(&ctl, 0, sizeof(struct swapon_ctl));
ctl.props.priority = -1;
case 'a': /* all */
ctl.all = 1;
break;
- case 'h': /* help */
- usage();
- break;
case 'o':
options = optarg;
break;
case BYTES_OPTION:
ctl.bytes = 1;
break;
- case 'V': /* version */
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 0:
break;
+
+ case 'h': /* help */
+ usage();
+ case 'V': /* version */
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
{NULL, 0, NULL, 0}
};
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "+Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
strutils_set_exitcode(EXIT_LP_BADVAL);
show_irq = 1;
while ((c = getopt_long(argc, argv, "t:c:w:a:i:ho:C:sq:rT:vV", longopts, NULL)) != -1) {
switch (c) {
- case 'h':
- usage();
- break;
case 'i':
cmds->op = LPSETIRQ;
cmds->val = strtol_or_err(optarg, _("argument error"));
cmds = cmds->next;
cmds->next = NULL;
break;
+
+ case 'h':
+ usage();
case 'v':
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
mnt_init_debug(0);
cxt = mnt_new_context();
case 'f':
mnt_context_enable_force(cxt, TRUE);
break;
- case 'h':
- usage();
- break;
case 'i':
mnt_context_disable_helpers(cxt, TRUE);
break;
case 'v':
mnt_context_enable_verbose(cxt, TRUE);
break;
- case 'V':
- umount_print_version();
- break;
case 'N':
{
char path[PATH_MAX];
err(MNT_EX_SYSERR, _("failed to set target namespace to %s"), pid ? path : optarg);
break;
}
+
+ case 'h':
+ mnt_free_context(cxt);
+ usage();
+ case 'V':
+ mnt_free_context(cxt);
+ umount_print_version();
default:
errtryhelp(MNT_EX_USAGE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "+fhVmuinpCUrR:w:S:G:", longopts, NULL)) != -1) {
switch (c) {
case 'f':
forkit = 1;
break;
- case 'h':
- usage();
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'm':
unshare_flags |= CLONE_NEWNS;
if (optarg)
case 'w':
newdir = optarg;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv,
"d:f:hFnITo:s:OrVx", long_opts, NULL)) != -1) {
if (string_to_bitmask(optarg, (unsigned long *) &wanted, name2bit) != 0)
return EXIT_FAILURE;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
- case 'h':
- usage();
case 'F':
noflags = 1;
break;
noident = 1;
notimeouts = 1;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "a:bfho:nrs:t:V", longopts, NULL)) != -1) {
case 'n':
no_headings = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "vVh", longopts, NULL)) != -1)
switch (ch) {
case 'v':
verbose = TRUE;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_NUMERIC, "C");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
script_init_debug();
ctl.tname = optarg;
ctl.timing = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- break;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
- break;
default:
errtryhelp(EXIT_FAILURE);
}
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "t:s:d:m:Vh", longopts, NULL)) != -1)
switch(ch) {
maxdelayopt = TRUE;
maxdelay = getnum(optarg);
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
ctl->opt_bfreq = set_opt_flag(ctl->opt_bfreq);
ctl->opt_bfreq_f = parse_bfreq(av, optarg, &optind);
break;
+
case OPT_VERSION:
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case OPT_HELP:
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc < 2) {
warnx(_("bad usage"));
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((ch = getopt_long(argc, argv, "nt:g:Vh", longopts, NULL)) != -1) {
switch (ch) {
case 'g':
group_buf = init_group_workspace(optarg);
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
max_bufd_lines = 128 * 2;
compress_spaces = 1; /* compress spaces into tabs */
case 'x': /* do not compress spaces into tabs */
compress_spaces = 0;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'H':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/* Take care of lonely hyphen option. */
for (opt = 0; opt < argc; opt++) {
case '2':
ctl.half_lines = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
NULL)) != -1)
switch (opt) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
ctl.output_separator = " ";
ctl.input_separator = mbs_to_wcs("\t ");
case 'H':
ctl.tab_colhide = optarg;
break;
- case 'h':
- usage();
- break;
case 'i':
ctl.tree_id = optarg;
break;
case 't':
ctl.mode = COLUMN_MODE_TABLE;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'W':
ctl.tab_colwrap = optarg;
break;
case 'x':
ctl.mode = COLUMN_MODE_FILLROWS;
break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
add_fmt(hex_offt, hex);
add_fmt("\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"", hex);
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- break;
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
argv += parse_args(argc, argv, hex);
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((opt = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (opt) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
case '\t':
break;
case 'V':
- printf(UTIL_LINUX_VERSION);
+ print_version(EXIT_SUCCESS);
exit(EXIT_SUCCESS);
break;
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (argc > 1) {
/* first arg may be one of our standard longopts */
if (!strcmp(argv[1], "--help"))
usage();
- if (!strcmp(argv[1], "--version")) {
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
- }
+ if (!strcmp(argv[1], "--version"))
+ print_version(EXIT_SUCCESS);
}
ctl.num_files = argc;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
if (tcgetattr(STDOUT_FILENO, &otio) == 0) {
ontty = 1;
}
if (!strcmp(argv[arg], "--version")) {
- printf(UTIL_LINUX_VERSION);
+ print_version(EXIT_SUCCESS);
return EXIT_SUCCESS;
}
case 's':
sflag = 1;
break;
+
case 'h':
usage();
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
default:
invopt(&argv[arg][i]);
}
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch(ch) {
case 'V':
- printf(UTIL_LINUX_VERSION);
- exit(EXIT_SUCCESS);
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
case 'i':
iflag = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default: