[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 62/80: [grn]: Align with modern groff conventions.
From: |
G. Branden Robinson |
Subject: |
[groff] 62/80: [grn]: Align with modern groff conventions. |
Date: |
Sat, 30 Nov 2024 04:02:26 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 7ba2e6df809b42ecf8be325aa018f271f0d0a3fe
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Nov 29 00:49:41 2024 -0600
[grn]: Align with modern groff conventions.
* src/preproc/grn/main.cpp (usage): If asked for `--help`, summarize
command purpose in message.
(main): Use standard symbol `EXIT_SUCCESS` instead of `0` literal.
Recast wording of diagnostic message.
---
ChangeLog | 9 +++++++++
src/preproc/grn/main.cpp | 14 +++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3c41a87ff..9a082f793 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
+
+ [grn]: Align with modern groff conventions.
+
+ * src/preproc/grn/main.cpp (usage): If asked for `--help`,
+ summarize command purpose in message.
+ (main): Use standard symbol `EXIT_SUCCESS` instead of `0`
+ literal. Recast wording of diagnostic message.
+
2024-11-29 G. Branden Robinson <g.branden.robinson@gmail.com>
[grn]: Fix command-line option handling.
diff --git a/src/preproc/grn/main.cpp b/src/preproc/grn/main.cpp
index d05b50dac..93fb6cd7b 100644
--- a/src/preproc/grn/main.cpp
+++ b/src/preproc/grn/main.cpp
@@ -83,9 +83,9 @@
#include <ctype.h> // isdigit(), isupper(), tolower()
#include <errno.h>
#include <locale.h> // setlocale()
-#include <stdio.h> // FILE, fclose(), fgets(), fopen(), stderr, stdin,
- // stdout
-#include <stdlib.h> // free(), malloc()
+#include <stdio.h> // FILE, fclose(), fgets(), fopen(), fprintf(),
+ // fputs(), printf(), stderr, stdin, stdout
+#include <stdlib.h> // exit(), EXIT_SUCCESS, free(), malloc()
#include <string.h> // strchr(), strcmp(), strcpy(), strerror(),
// strlen()
@@ -273,6 +273,10 @@ usage(FILE *stream)
"usage: %s {-v | --version}\n"
"usage: %s --help\n",
program_name, program_name, program_name);
+ if (stdout == stream)
+ fputs("\n"
+"Preprocess troff(1) input to incorporate gremlin image files. See\n"
+"the grn(1) manual page.\n", stream);
}
@@ -357,7 +361,7 @@ main(int argc,
if (strcmp(*argv,"--version")==0) {
case 'v':
printf("GNU grn (groff) version %s\n", Version_string);
- exit(0);
+ exit(EXIT_SUCCESS);
break;
}
if (strcmp(*argv,"--help")==0) {
@@ -368,7 +372,7 @@ main(int argc,
}
// fallthrough
default:
- error("unknown switch: %1", c);
+ error("unrecognized command-line option '%1'", c);
usage(stderr);
exit(2);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 62/80: [grn]: Align with modern groff conventions.,
G. Branden Robinson <=