diff options
Diffstat (limited to 'term-utils')
-rw-r--r-- | term-utils/agetty.c | 16 | ||||
-rw-r--r-- | term-utils/write.c | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 5b910011c..869513b22 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -308,7 +308,7 @@ static void termio_final(struct options *op, struct termios *tp, struct chardata *cp); static int caps_lock(char *s); static speed_t bcode(char *s); -static void usage(FILE * out) __attribute__((__noreturn__)); +static void usage(void) __attribute__((__noreturn__)); static void log_err(const char *, ...) __attribute__((__noreturn__)) __attribute__((__format__(printf, 1, 2))); static void log_warn (const char *, ...) @@ -785,9 +785,9 @@ static void parse_args(int argc, char **argv, struct options *op) printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); case HELP_OPTION: - usage(stdout); + usage(); default: - usage(stderr); + errtryhelp(EXIT_FAILURE); } } @@ -795,7 +795,7 @@ static void parse_args(int argc, char **argv, struct options *op) if (argc < optind + 1) { log_warn(_("not enough arguments")); - usage(stderr); + warn(_("not enough arguments")); } /* Accept "tty", "baudrate tty", and "tty baudrate". */ @@ -803,8 +803,8 @@ static void parse_args(int argc, char **argv, struct options *op) /* Assume BSD style speed. */ parse_speeds(op, argv[optind++]); if (argc < optind + 1) { + log_warn(_("not enough arguments")); warn(_("not enough arguments")); - usage(stderr); } op->tty = argv[optind++]; } else { @@ -2066,8 +2066,10 @@ static speed_t bcode(char *s) return 0; } -static void __attribute__ ((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; + fputs(USAGE_HEADER, out); fprintf(out, _(" %1$s [options] <line> [<baud_rate>,...] [<termtype>]\n" " %1$s [options] <baud_rate>,... <line> [<termtype>]\n"), program_invocation_short_name); @@ -2112,7 +2114,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out) fputs(_(" --version output version information and exit\n"), out); fprintf(out, USAGE_MAN_TAIL("agetty(8)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } /* diff --git a/term-utils/write.c b/term-utils/write.c index 13d4745f9..a7b51809f 100644 --- a/term-utils/write.c +++ b/term-utils/write.c @@ -79,8 +79,9 @@ struct write_control { const char *dst_tty_name; }; -static void __attribute__((__noreturn__)) usage(FILE *out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] <user> [<ttyname>]\n"), @@ -92,9 +93,8 @@ static void __attribute__((__noreturn__)) usage(FILE *out) fputs(USAGE_OPTIONS, out); fputs(USAGE_HELP, out); fputs(USAGE_VERSION, out); - fprintf(out, USAGE_MAN_TAIL("write(1)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } /* @@ -317,9 +317,9 @@ int main(int argc, char **argv) printf(UTIL_LINUX_VERSION); return EXIT_SUCCESS; case 'h': - usage(stdout); + usage(); default: - usage(stderr); + errtryhelp(EXIT_FAILURE); } if (get_terminal_name(&ctl.src_tty_path, &ctl.src_tty_name, NULL) == 0) { |