diff options
author | Ruediger Meier | 2017-06-19 20:52:50 +0200 |
---|---|---|
committer | Ruediger Meier | 2017-06-26 14:38:24 +0200 |
commit | 6e1eda6f229f87b77471ce6eb7cbf0ede7c8029e (patch) | |
tree | 5e74a0cd99493e934780db2b434c75e995a6bd17 /misc-utils/cal.c | |
parent | misc: never use usage(ERROR) (diff) | |
download | kernel-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 'misc-utils/cal.c')
-rw-r--r-- | misc-utils/cal.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 86e159bfa..f73cbbf30 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -244,7 +244,7 @@ static int week_number(int day, int month, int32_t year, const struct cal_contro static int week_to_day(const struct cal_control *ctl); static int center_str(const char *src, char *dest, size_t dest_size, size_t width); static void center(const char *str, size_t len, int separate); -static void __attribute__((__noreturn__)) usage(FILE *out); +static void __attribute__((__noreturn__)) usage(void); int main(int argc, char **argv) { @@ -394,7 +394,7 @@ int main(int argc, char **argv) printf(UTIL_LINUX_VERSION); return EXIT_SUCCESS; case 'h': - usage(stdout); + usage(); default: errtryhelp(EXIT_FAILURE); } @@ -470,7 +470,8 @@ int main(int argc, char **argv) ctl.req.month = local_time->tm_mon + 1; break; default: - usage(stderr); + warnx(_("bad usage")); + errtryhelp(EXIT_FAILURE); } if (0 < ctl.req.week) { @@ -987,8 +988,9 @@ static void center(const char *str, size_t len, int separate) } } -static void __attribute__ ((__noreturn__)) usage(FILE * out) +static void __attribute__((__noreturn__)) usage(void) { + FILE *out = stdout; fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options] [[[day] month] year]\n"), program_invocation_short_name); fprintf(out, _(" %s [options] <timestamp|monthname>\n"), program_invocation_short_name); @@ -1017,5 +1019,5 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) fputs(USAGE_VERSION, out); fprintf(out, USAGE_MAN_TAIL("cal(1)")); - exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); + exit(EXIT_SUCCESS); } |