summaryrefslogtreecommitdiffstats
path: root/misc-utils/cal.c
diff options
context:
space:
mode:
authorSami Kerola2013-05-02 00:07:21 +0200
committerSami Kerola2013-05-26 10:59:19 +0200
commit201d43fd12f556e0bf2ef8955073627ab7f74004 (patch)
tree5dc87aa02179e3e4343db6cc56541e4e60e0cc53 /misc-utils/cal.c
parentcal: support --color[={auto,always,never}] (diff)
downloadkernel-qcow2-util-linux-201d43fd12f556e0bf2ef8955073627ab7f74004.tar.gz
kernel-qcow2-util-linux-201d43fd12f556e0bf2ef8955073627ab7f74004.tar.xz
kernel-qcow2-util-linux-201d43fd12f556e0bf2ef8955073627ab7f74004.zip
cal: add --color to usage()
And clean up the usage() function. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r--misc-utils/cal.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 9d9f357d0..9988c7b9e 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -788,20 +788,19 @@ center(const char *str, size_t len, int separate)
static void __attribute__ ((__noreturn__)) usage(FILE * out)
{
- fputs(_("\nUsage:\n"), out);
- fprintf(out,
- _(" %s [options] [[[day] month] year]\n"),
- program_invocation_short_name);
-
- fputs(_("\nOptions:\n"), out);
- fputs(_(" -1, --one show only current month (default)\n"
- " -3, --three show previous, current and next month\n"
- " -s, --sunday Sunday as first day of week\n"
- " -m, --monday Monday as first day of week\n"
- " -j, --julian output Julian dates\n"
- " -y, --year show whole current year\n"
- " -V, --version display version information and exit\n"
- " -h, --help display this help text and exit\n\n"), out);
-
+ fputs(USAGE_HEADER, out);
+ fprintf(out, _(" %s [options] [[[day] month] year]\n"), program_invocation_short_name);
+ fputs(USAGE_OPTIONS, out);
+ fputs(_(" -1, --one show only current month (default)\n"), out);
+ fputs(_(" -3, --three show previous, current and next month\n"), out);
+ fputs(_(" -s, --sunday Sunday as first day of week\n"), out);
+ fputs(_(" -m, --monday Monday as first day of week\n"), out);
+ fputs(_(" -j, --julian output Julian dates\n"), out);
+ fputs(_(" -y, --year show whole current year\n"), out);
+ fputs(_(" --color[=<when>] colorize messages (auto, always or never)\n"), out);
+ fputs(USAGE_SEPARATOR, out);
+ fputs(USAGE_HELP, out);
+ fputs(USAGE_VERSION, out);
+ fprintf(out, USAGE_MAN_TAIL("cal(1)"));
exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
}