groff-commit
[Top][All Lists]
Advanced

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

[groff] 23/39: [pre-grohtml]: Alter usage message handling.


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

gbranden pushed a commit to branch master
in repository groff.

commit d9f8d1ebe42e051d0682599bd725fd95a4a41d23
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 24 20:01:32 2022 -0500

    [pre-grohtml]: Alter usage message handling.
    
    * src/preproc/html/pre-html.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/html/pre-html.cpp | 23 +++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c8129083f..7c949eb60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/html/pre-html.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-24  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grolbp/lbp.cpp: Alter usage message handling.
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index aef4beaf4..e8902f12b 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1531,17 +1531,21 @@ static void usage(FILE *stream)
 "usage: %s {-v | --version}\n"
 "usage: %s --help\n",
         program_name, program_name, program_name);
-  fputs(
+  if (stdout == stream) {
+    fputs(
 "\n"
-"This program is not intended to be executed standalone; it is\n"
-"normally part of a groff pipeline for producing HTML output.\n"
+"Prepare a troff(1) document for HTML formatting.\n"
 "\n"
-"If your need to call it manually (e.g., for debugging purposes),\n"
-"give the 'groff' program the command-line option '-V' to inspect\n",
-       stream);
-  fprintf(stream, "the arguments with which '%s' is called.\n",
-      program_name);
-  fputs("\nSee grohtml(1).\n", stream);
+"This program is not intended to be executed standalone; it is\n"
+"normally part of a groff pipeline.  If your need to run it manually\n"
+"(e.g., for debugging purposes), give the 'groff' program the\n"
+"command-line option '-V' to inspect the arguments with which\n",
+         stream);
+    fprintf(stream,
+"'%s' is called.  See the grohtml(1) manual page.\n",
+         program_name);
+    exit(EXIT_SUCCESS);
+  }
 }
 
 /*
@@ -1659,7 +1663,6 @@ static int scanArguments(int argc, char **argv)
       break;
     case CHAR_MAX + 1: // --help
       usage(stdout);
-      exit(EXIT_SUCCESS);
       break;
     case '?':
       usage(stderr);



reply via email to

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