From 2c308875a7fa1aaa44892c368f6b37bcfcb8879a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 16 Apr 2019 15:14:13 +0200 Subject: misc: consolidate version printing and close_stdout() Signed-off-by: Karel Zak --- sys-utils/eject.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'sys-utils/eject.c') 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); -- cgit v1.2.3-55-g7522