summaryrefslogtreecommitdiffstats
path: root/sys-utils/eject.c
diff options
context:
space:
mode:
authorKarel Zak2019-04-16 15:14:13 +0200
committerKarel Zak2019-04-16 15:14:13 +0200
commit2c308875a7fa1aaa44892c368f6b37bcfcb8879a (patch)
tree157ea7afca59059676dbcc25133dd196d1e45fb8 /sys-utils/eject.c
parentinclude/c: add print_version() macro (diff)
downloadkernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.tar.gz
kernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.tar.xz
kernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.zip
misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/eject.c')
-rw-r--r--sys-utils/eject.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 81cd2bcff..d2e76d2ff 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -222,9 +222,6 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
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"),
@@ -263,10 +260,11 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
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;
@@ -849,7 +847,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL,"");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
/* parse the command line arguments */
parse_args(&ctl, argc, argv);