groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 25/39: [preconv]: Alter usage message handling.


From: G. Branden Robinson
Subject: [groff] 25/39: [preconv]: Alter usage message handling.
Date: Sat, 29 Oct 2022 14:59:59 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 510f0ab53904ea34896e21f7b09e43b532a31f76
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Oct 26 21:08:08 2022 -0500

    [preconv]: Alter usage message handling.
    
    * src/preproc/preconv/preconv.cpp: Alter usage message handling.
    
      (usage): Summarize purpose of program and steer reader to man page
      (only) if help was explicitly requested, and exit successfully from
      here...
    
      (main): ...instead of calling scope.
---
 ChangeLog                       |  8 ++++++++
 src/preproc/preconv/preconv.cpp | 24 +++++++++---------------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a8d8906f5..47b21ab24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-10-26  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/preconv/preconv.cpp: Alter usage message handling.
+       (usage): Summarize purpose of program and steer reader to man
+       page (only) if help was explicitly requested, and exit
+       successfully from here...
+       (main): ...instead of calling scope.
+
 2022-10-26  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/preconv/preconv.cpp (usage): Use more
diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp
index 7bc716ca7..e50664e9f 100644
--- a/src/preproc/preconv/preconv.cpp
+++ b/src/preproc/preconv/preconv.cpp
@@ -1207,24 +1207,19 @@ usage(FILE *stream)
   fprintf(stream,
 "usage: %s [-dr] [-D fallback-encoding] [-e encoding] [file ...]\n"
 "usage: %s {-v | --version}\n"
-"usage: %s {-h | --help}\n"
+"usage: %s {-h | --help}\n",
+         program_name, program_name, program_name);
+  if (stdout == stream) {
+    fprintf(stream,
 "\n"
-"Read each file, convert its encoded characters to a form GNU troff\n"
+"Read each file, convert its encoded characters to a form GNU"
+" troff(1)\n"
 "can interpret, and send the result to the standard output stream.\n"
-"\n"
-"Options:\n"
-"  -d      show debugging messages\n"
-"  -D ENC  fall back to encoding ENC\n"
-"  -e ENC  assume input encoding of ENC\n"
-"  --help\n"
-"  -h      show this message and exit\n"
-"  -r      don't add 'lf' requests to output\n"
-"  --version\n"
-"  -v      show version information and exit\n"
-"\n"
 "The default fallback encoding is '%s'.  See the preconv(1) manual"
 " page.\n",
-         program_name, program_name, program_name, default_encoding);
+         default_encoding);
+    exit(EXIT_SUCCESS);
+  }
 }
 
 // ---------------------------------------------------------
@@ -1295,7 +1290,6 @@ main(int argc, char **argv)
       break;
     case 'h':
       usage(stdout);
-      exit(0);
       break;
     case '?':
       usage(stderr);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]