From 7841077fc6290f2f07ce7d77f754454ff4a0b364 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Thu, 5 Feb 2026 22:25:10 -0500 Subject: [PATCH] Make all programs support --version --- man/rem2ps.1.in | 3 +++ rem2pdf/bin/rem2pdf.in | 8 ++++++++ src/rem2ps.c | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/man/rem2ps.1.in b/man/rem2ps.1.in index 85dd91cc..cda5d078 100644 --- a/man/rem2ps.1.in +++ b/man/rem2ps.1.in @@ -21,6 +21,9 @@ render characters outside the ASCII character set, see .SH OPTIONS .TP +.B \-\-version +Print the version of \fBrem2ps\fR and exit. +.TP .B \-v Be more verbose. This causes \fBrem2ps\fR to print progress messages to the standard error stream. Normally, it is silent. diff --git a/rem2pdf/bin/rem2pdf.in b/rem2pdf/bin/rem2pdf.in index 330f0e5f..181e307f 100644 --- a/rem2pdf/bin/rem2pdf.in +++ b/rem2pdf/bin/rem2pdf.in @@ -628,6 +628,14 @@ to print per page; it is an integer that can range from 1 to 4. Print (on STDERR) the name of the month and year for each month that is rendered. +=item --version + +Print the version of rem2pdf and exit. + +=item --help + +Print a brief summary of rem2pdf usage. + =back =head1 USAGE diff --git a/src/rem2ps.c b/src/rem2ps.c index 013ce847..f472c347 100644 --- a/src/rem2ps.c +++ b/src/rem2ps.c @@ -985,6 +985,14 @@ static void Init(int argc, char const *argv[]) case 'e': FillPage = 1; break; + case '-': + if (!strcmp(s, "version")) { + printf("rem2ps version %s\n", VERSION); + exit(0); + } + Usage("Unrecognized option"); + break; + default: Usage("Unrecognized option"); } } @@ -1016,6 +1024,7 @@ void Usage(char const *s) fprintf(stderr, "-e Make calendar fill entire page\n"); fprintf(stderr, "-x Put day numbers on left instead of right\n"); fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n"); + fprintf(stderr, "--version Print the version of rem2pdf and exit\n"); exit(EXIT_FAILURE); }