summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/mesg.c9
-rw-r--r--term-utils/setterm.c14
2 files changed, 13 insertions, 10 deletions
diff --git a/term-utils/mesg.c b/term-utils/mesg.c
index 43835b480..fe5218aa4 100644
--- a/term-utils/mesg.c
+++ b/term-utils/mesg.c
@@ -66,8 +66,9 @@
#define IS_NOT_ALLOWED 1 /* Receiving messages is not allowed. */
#define MESG_EXIT_FAILURE 2 /* An error occurred. */
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
/* TRANSLATORS: this program uses for y and n rpmatch(3),
* which means they can be translated. */
@@ -83,7 +84,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("mesg(1)"));
- exit(out == stderr ? MESG_EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char *argv[])
@@ -113,7 +114,7 @@ int main(int argc, char *argv[])
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
@@ -159,7 +160,7 @@ int main(int argc, char *argv[])
break;
case RPMATCH_INVALID:
warnx(_("invalid argument: %s"), argv[0]);
- usage(stderr);
+ errtryhelp(EXIT_FAILURE);
default:
abort();
}
diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index 9f60e5693..8ab5b45d7 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -371,8 +371,9 @@ static int parse_bfreq(char **av, char *oa, int *oi)
return strtos32_or_err(arg, _("argument error"));
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options]\n"), program_invocation_short_name);
@@ -420,7 +421,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(_(" --version show version information and exit\n"), out);
fputs(_(" --help display this help and exit\n"), out);
fprintf(out, USAGE_MAN_TAIL("setterm(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static int __attribute__((__pure__)) set_opt_flag(int opt)
@@ -672,7 +673,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case OPT_HELP:
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
@@ -1170,9 +1171,10 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- if (argc < 2)
- usage(stderr);
-
+ if (argc < 2) {
+ warnx(_("bad usage"));
+ errtryhelp(EXIT_FAILURE);
+ }
parse_option(&ctl, argc, argv);
init_terminal(&ctl);
perform_sequence(&ctl);