summaryrefslogtreecommitdiffstats
path: root/term-utils/mesg.c
diff options
context:
space:
mode:
authorRuediger Meier2017-06-19 20:52:50 +0200
committerRuediger Meier2017-06-26 14:38:24 +0200
commit6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch)
tree5e74a0cd99493e934780db2b434c75e995a6bd17 /term-utils/mesg.c
parentmisc: never use usage(ERROR) (diff)
downloadkernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.gz
kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.tar.xz
kernel-qcow2-util-linux-6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e.zip
misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'term-utils/mesg.c')
-rw-r--r--term-utils/mesg.c9
1 files changed, 5 insertions, 4 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();
}