Browse Source

misc: consolidate version printing and close_stdout()

Signed-off-by: Karel Zak <kzak@redhat.com>
pull/783/head
Karel Zak 3 years ago
parent
commit
2c308875a7
  1. 5
      Documentation/boilerplate.c
  2. 3
      disk-utils/addpart.c
  3. 8
      disk-utils/blockdev.c
  4. 5
      disk-utils/cfdisk.c
  5. 3
      disk-utils/delpart.c
  6. 5
      disk-utils/fdformat.c
  7. 5
      disk-utils/fdisk.c
  8. 8
      disk-utils/fsck.c
  9. 5
      disk-utils/fsck.cramfs.c
  10. 5
      disk-utils/fsck.minix.c
  11. 5
      disk-utils/isosize.c
  12. 2
      disk-utils/mkfs.bfs.c
  13. 2
      disk-utils/mkfs.c
  14. 7
      disk-utils/mkfs.cramfs.c
  15. 5
      disk-utils/mkfs.minix.c
  16. 5
      disk-utils/mkswap.c
  17. 5
      disk-utils/partx.c
  18. 5
      disk-utils/raw.c
  19. 5
      disk-utils/resizepart.c
  20. 6
      disk-utils/sfdisk.c
  21. 5
      disk-utils/swaplabel.c
  22. 5
      include/c.h
  23. 6
      login-utils/chfn.c
  24. 5
      login-utils/chsh.c
  25. 2
      login-utils/islocal.c
  26. 5
      login-utils/last.c
  27. 3
      login-utils/login.c
  28. 2
      login-utils/logindefs.c
  29. 5
      login-utils/lslogins.c
  30. 5
      login-utils/newgrp.c
  31. 4
      login-utils/nologin.c
  32. 6
      login-utils/su-common.c
  33. 8
      login-utils/sulogin.c
  34. 6
      login-utils/utmpdump.c
  35. 5
      login-utils/vipw.c
  36. 2
      misc-utils/blkid.c
  37. 5
      misc-utils/cal.c
  38. 5
      misc-utils/fincore.c
  39. 5
      misc-utils/findfs.c
  40. 13
      misc-utils/findmnt.c
  41. 10
      misc-utils/getopt.c
  42. 5
      misc-utils/hardlink.c
  43. 8
      misc-utils/kill.c
  44. 12
      misc-utils/logger.c
  45. 5
      misc-utils/look.c
  46. 16
      misc-utils/lsblk.c
  47. 12
      misc-utils/lslocks.c
  48. 6
      misc-utils/mcookie.c
  49. 13
      misc-utils/namei.c
  50. 6
      misc-utils/rename.c
  51. 6
      misc-utils/uuidd.c
  52. 8
      misc-utils/uuidgen.c
  53. 6
      misc-utils/uuidparse.c
  54. 12
      misc-utils/whereis.c
  55. 11
      misc-utils/wipefs.c
  56. 6
      schedutils/chrt.c
  57. 6
      schedutils/ionice.c
  58. 7
      schedutils/taskset.c
  59. 13
      sys-utils/blkdiscard.c
  60. 11
      sys-utils/blkzone.c
  61. 10
      sys-utils/chcpu.c
  62. 13
      sys-utils/chmem.c
  63. 6
      sys-utils/choom.c
  64. 5
      sys-utils/ctrlaltdel.c
  65. 13
      sys-utils/dmesg.c
  66. 12
      sys-utils/eject.c
  67. 11
      sys-utils/fallocate.c
  68. 6
      sys-utils/flock.c
  69. 9
      sys-utils/fsfreeze.c
  70. 14
      sys-utils/fstrim.c
  71. 6
      sys-utils/hwclock.c
  72. 7
      sys-utils/ipcmk.c
  73. 6
      sys-utils/ipcrm.c
  74. 6
      sys-utils/ipcs.c
  75. 4
      sys-utils/ldattach.c
  76. 11
      sys-utils/losetup.c
  77. 10
      sys-utils/lscpu.c
  78. 4
      sys-utils/lsipc.c
  79. 15
      sys-utils/lsmem.c
  80. 12
      sys-utils/lsns.c
  81. 15
      sys-utils/mount.c
  82. 7
      sys-utils/mountpoint.c
  83. 11
      sys-utils/nsenter.c
  84. 5
      sys-utils/pivot_root.c
  85. 13
      sys-utils/prlimit.c
  86. 6
      sys-utils/readprofile.c
  87. 8
      sys-utils/renice.c
  88. 6
      sys-utils/rfkill.c
  89. 6
      sys-utils/rtcwake.c
  90. 13
      sys-utils/setarch.c
  91. 6
      sys-utils/setpriv.c
  92. 8
      sys-utils/setsid.c
  93. 13
      sys-utils/swapoff.c
  94. 13
      sys-utils/swapon.c
  95. 5
      sys-utils/switch_root.c
  96. 11
      sys-utils/tunelp.c
  97. 15
      sys-utils/umount.c
  98. 12
      sys-utils/unshare.c
  99. 12
      sys-utils/wdctl.c
  100. 6
      sys-utils/zramctl.c
  101. 6
      term-utils/mesg.c
  102. 8
      term-utils/script.c
  103. 6
      term-utils/scriptreplay.c
  104. 6
      term-utils/setterm.c
  105. 6
      term-utils/wall.c
  106. 5
      term-utils/write.c
  107. 6
      text-utils/col.c
  108. 6
      text-utils/colcrt.c
  109. 3
      text-utils/colrm.c
  110. 13
      text-utils/column.c
  111. 7
      text-utils/hexdump.c
  112. 5
      text-utils/line.c
  113. 10
      text-utils/more.c
  114. 8
      text-utils/pg.c
  115. 5
      text-utils/rev.c
  116. 6
      text-utils/ul.c

5
Documentation/boilerplate.c

@ -84,7 +84,7 @@ 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, "nr:zelfVh", longopts, NULL)) != -1)
switch (c) {
@ -98,8 +98,7 @@ int main(int argc, char **argv)
case 'f':
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

3
disk-utils/addpart.c

@ -41,8 +41,7 @@ int main(int argc, char **argv)
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:

8
disk-utils/blockdev.c

@ -238,7 +238,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
if (argc < 2) {
warnx(_("not enough arguments"));
@ -246,10 +246,8 @@ int main(int argc, char **argv)
}
/* -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();

5
disk-utils/cfdisk.c

@ -2667,7 +2667,7 @@ 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, "L::hVz", longopts, NULL)) != -1) {
switch(c) {
@ -2681,8 +2681,7 @@ int main(int argc, char *argv[])
_("unsupported color mode"));
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'z':
cf->zero_start = 1;
break;

3
disk-utils/delpart.c

@ -41,8 +41,7 @@ int main(int argc, char **argv)
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:

5
disk-utils/fdformat.c

@ -186,7 +186,7 @@ int main(int argc, char **argv)
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) {
@ -204,8 +204,7 @@ int main(int argc, char **argv)
verify = 0;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

5
disk-utils/fdisk.c

@ -891,7 +891,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
fdisk_init_debug(0);
scols_init_debug(0);
@ -990,8 +990,7 @@ int main(int argc, char **argv)
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)

8
disk-utils/fsck.c

@ -1450,10 +1450,8 @@ static void parse_argv(int argc, char *argv[])
/* 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)
@ -1621,7 +1619,7 @@ int main(int argc, char *argv[])
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 */

5
disk-utils/fsck.cramfs.c

@ -660,7 +660,7 @@ int main(int argc, char **argv)
setlocale(LC_CTYPE, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
strutils_set_exitcode(FSCK_EX_USAGE);
@ -674,8 +674,7 @@ int main(int argc, char **argv)
usage();
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return FSCK_EX_OK;
print_version(FSCK_EX_OK);
case 'x':
opt_extract = 1;
if(optarg)

5
disk-utils/fsck.minix.c

@ -1291,7 +1291,7 @@ main(int argc, char **argv) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
strutils_set_exitcode(FSCK_EX_USAGE);
@ -1326,8 +1326,7 @@ main(int argc, char **argv) {
force = 1;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return FSCK_EX_OK;
print_version(FSCK_EX_OK);
case 'h':
usage();
default:

5
disk-utils/isosize.c

@ -177,7 +177,7 @@ int main(int argc, char **argv)
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) {
@ -190,8 +190,7 @@ int main(int argc, char **argv)
xflag = 1;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

2
disk-utils/mkfs.bfs.c

@ -121,7 +121,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
if (argc < 2) {
warnx(_("not enough arguments"));

2
disk-utils/mkfs.c

@ -80,7 +80,7 @@ int main(int argc, char **argv)
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);

7
disk-utils/mkfs.cramfs.c

@ -714,14 +714,14 @@ int main(int argc, char **argv)
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);
}
}
@ -770,8 +770,7 @@ int main(int argc, char **argv)
/* old option, ignored */
break;
case 'V':
printf(UTIL_LINUX_VERSION);
exit(MKFS_EX_OK);
print_version(MKFS_EX_OK);
case 'v':
verbose = 1;
break;

5
disk-utils/mkfs.minix.c

@ -758,7 +758,7 @@ int main(int argc, char ** argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
strutils_set_exitcode(MKFS_EX_USAGE);
@ -792,8 +792,7 @@ int main(int argc, char ** argv)
listfile = optarg;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return MKFS_EX_OK;
print_version(MKFS_EX_OK);
case 'h':
usage();
default:

5
disk-utils/mkswap.c

@ -369,7 +369,7 @@ 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, "cfp:L:v:U:Vh", longopts, NULL)) != -1) {
switch (c) {
@ -400,8 +400,7 @@ int main(int argc, char **argv)
#endif
break;
case 'V':
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

5
disk-utils/partx.c

@ -832,7 +832,7 @@ 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,
"abdglrsuvn:t:o:PS:hV", long_opts, NULL)) != -1) {
@ -901,8 +901,7 @@ int main(int argc, char **argv)
case 'h':
usage();
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}

5
disk-utils/raw.c

@ -108,7 +108,7 @@ 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, "qaVh", longopts, NULL)) != -1)
switch (c) {
@ -119,8 +119,7 @@ int main(int argc, char *argv[])
do_query_all = 1;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

5
disk-utils/resizepart.c

@ -80,13 +80,12 @@ 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, "Vh", longopts, NULL)) != -1)
switch (c) {
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

6
disk-utils/sfdisk.c

@ -1994,7 +1994,7 @@ 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, "aAbcdfFgGhJlLo:O:nN:qrsTu:vVX:Y:w:W:",
longopts, &longidx)) != -1) {
@ -2079,9 +2079,7 @@ int main(int argc, char *argv[])
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;

5
disk-utils/swaplabel.c

@ -152,7 +152,7 @@ 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, "hVL:U:", longopts, NULL)) != -1) {
switch (c) {
@ -160,8 +160,7 @@ int main(int argc, char *argv[])
usage();
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'L':
label = optarg;
break;

5
include/c.h

@ -351,6 +351,11 @@ static inline int xusleep(useconds_t usec)
#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"
*/

6
login-utils/chfn.c

@ -176,8 +176,7 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
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:
@ -412,7 +411,8 @@ int main(int argc, char **argv)
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 */

5
login-utils/chsh.c

@ -166,8 +166,7 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo)
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();
@ -264,7 +263,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
parse_argv(argc, argv, &info);
if (!info.username) {

2
login-utils/islocal.c

@ -91,7 +91,7 @@ int is_local(const char *user)
#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]);

5
login-utils/last.c

@ -939,7 +939,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
/*
* Which file do we want to read?
*/
@ -954,8 +954,7 @@ int main(int argc, char **argv)
usage(&ctl);
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'R':
ctl.showhost = 0;
break;

3
login-utils/login.c

@ -1196,8 +1196,7 @@ int main(int argc, char **argv)
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case HELP_OPTION:
usage();
default:

2
login-utils/logindefs.c

@ -403,7 +403,7 @@ int get_hushlogin_status(struct passwd *pwd, int force_check)
int main(int argc, char *argv[])
{
char *name, *type;
atexit(close_stdout);
close_stdout_atexit();
if (argc <= 1)
errx(EXIT_FAILURE, "usage: %s <filename> "

5
login-utils/lslogins.c

@ -1425,7 +1425,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
ctl->time_mode = TIME_SHORT;
@ -1528,8 +1528,7 @@ int main(int argc, char *argv[])
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

5
login-utils/newgrp.c

@ -196,13 +196,12 @@ int main(int argc, char *argv[])
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:

4
login-utils/nologin.c

@ -54,10 +54,8 @@ int main(int argc, char *argv[])
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);
}

6
login-utils/su-common.c

@ -1321,7 +1321,7 @@ int su_main(int argc, char **argv, int mode)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
su_init_debug();
su->conv.appdata_ptr = (void *) su;
@ -1392,9 +1392,7 @@ int su_main(int argc, char **argv, int mode)
usage(mode);
case 'V':
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}

8
login-utils/sulogin.c

@ -815,6 +815,8 @@ static void usage(void)
fputs(USAGE_SEPARATOR, out);
printf(USAGE_HELP_OPTIONS(26));
printf(USAGE_MAN_TAIL("sulogin(8)"));
exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@ -853,7 +855,7 @@ 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.
@ -870,11 +872,9 @@ int main(int argc, char **argv)
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;

6
login-utils/utmpdump.c

@ -334,7 +334,7 @@ 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, "fro:hV", longopts, NULL)) != -1) {
switch (c) {
@ -355,10 +355,8 @@ int main(int argc, char **argv)
case 'h':
usage();
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}

5
login-utils/vipw.c

@ -325,7 +325,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
if (!strcmp(program_invocation_short_name, "vigr")) {
program = VIGR;
@ -338,8 +338,7 @@ int main(int argc, char *argv[])
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:

2
misc-utils/blkid.c

@ -686,7 +686,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
strutils_set_exitcode(BLKID_EXIT_OTHER);

5
misc-utils/cal.c

@ -332,7 +332,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
term = getenv("TERM");
if (term) {
@ -435,8 +435,7 @@ int main(int argc, char **argv)
ctl.reform_year = ISO;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

5
misc-utils/fincore.c

@ -310,7 +310,7 @@ 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, "bno:JrVh", longopts, NULL)) != -1) {
switch (c) {
@ -330,8 +330,7 @@ int main(int argc, char ** argv)
ctl.raw = 1;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

5
misc-utils/findfs.c

@ -50,7 +50,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
if (argc != 2) {
/* we return '2' for backward compatibility
@ -62,8 +62,7 @@ int main(int argc, char **argv)
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:

13
misc-utils/findmnt.c

@ -1348,7 +1348,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
/* default output format */
flags |= FL_TREE;
@ -1391,9 +1391,6 @@ int main(int argc, char *argv[])
case 'e':
flags |= FL_EVALUATE;
break;
case 'h':
usage();
break;
case 'i':
flags |= FL_INVERT;
break;
@ -1490,9 +1487,6 @@ int main(int argc, char *argv[])
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;
@ -1508,6 +1502,11 @@ int main(int argc, char *argv[])
case FINDMNT_OPT_REAL:
flags |= FL_REAL;
break;
case 'h':
usage();
case 'V':
print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}

10
misc-utils/getopt.c

@ -379,7 +379,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
if (getenv("GETOPT_COMPATIBLE"))
ctl.compatible = 1;
@ -413,8 +413,6 @@ int main(int argc, char *argv[])
case 'a':
getopt_long_fp = getopt_long_only;
break;
case 'h':
usage();
case 'o':
free(ctl.optstr);
ctl.optstr = xstrdup(optarg);
@ -441,12 +439,14 @@ int main(int argc, char *argv[])
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."));
}

5
misc-utils/hardlink.c

@ -413,7 +413,7 @@ int main(int argc, char **argv)
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) {
@ -438,8 +438,7 @@ int main(int argc, char **argv)
#endif
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

8
misc-utils/kill.c

@ -213,10 +213,8 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
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")) {
@ -343,7 +341,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
argv = parse_arguments(argc, argv, &ctl);

12
misc-utils/logger.c

@ -1155,7 +1155,7 @@ int main(int argc, char **argv)
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);
@ -1212,11 +1212,6 @@ int main(int argc, char **argv)
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;
@ -1263,6 +1258,11 @@ int main(int argc, char **argv)
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);
}

5
misc-utils/look.c

@ -100,7 +100,7 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
setlocale(LC_ALL, "");
@ -127,8 +127,7 @@ main(int argc, char *argv[])
termchar = *optarg;
break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:

16
misc-utils/lsblk.c

@ -1814,7 +1814,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
close_stdout_atexit();
lsblk = &_ls;
@ -1849,9 +1849,6 @@ int main(int argc, char *argv[])
case 'e':
parse_excludes(optarg);
break;
case 'h':
usage();
break;
case 'J':
lsblk->flags |= LSBLK_JSON;
break;
@ -1939,9 +1936,6 @@ int main(int argc, char *argv[])
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)
@ -1953,7 +1947,13 @@ int main(int argc, char *argv[])
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);
}

12
misc-utils/lslocks.c

@ -585,7 +585,7 @@ 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,
"biJp:o:nruhV", long_opts, NULL)) != -1) {
@ -612,11 +612,6 @@ int main(int argc, char *argv[])
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;
@ -626,6 +621,11 @@ int main(int argc, char *argv[])
case 'u':
disable_columns_truncate();
break;
case 'V':
print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
errtryhelp(EXIT_FAILURE);
}

6
misc-utils/mcookie.c

@ -147,7 +147,7 @@ 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, "f:m:vVh", longopts, NULL)) != -1) {
switch (c) {
@ -163,9 +163,9 @@ int main(int argc, char **argv)
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:

13
misc-utils/namei.c

@ -372,16 +372,10 @@ 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, "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;
@ -400,6 +394,11 @@ main(int argc, char **argv)
case 'v':
flags |= NAMEI_VERTICAL;
break;
case 'h':
usage();
case 'V':
print_version(EXIT_SUCCESS);