groff-commit
[Top][All Lists]
Advanced

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

[groff] 19/39: [grotty]: Alter usage message handling.


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

gbranden pushed a commit to branch master
in repository groff.

commit 7fb77605ef679bb589585ef1cb433c3e690b2f32
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 24 18:24:51 2022 -0500

    [grotty]: Alter usage message handling.
    
    * src/devices/grotty/tty.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.
    
    Also drop `v` option from synopsis of primary operation mode.
---
 ChangeLog                  |  8 ++++++++
 src/devices/grotty/tty.cpp | 17 +++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6cf75d440..53adc1c75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-10-24  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grotty/tty.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/grotty/tty.cpp: Fix code style nits.
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index b14813997..45926f668 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -1000,7 +1000,6 @@ int main(int argc, char **argv)
       break;
     case CHAR_MAX + 1: // --help
       usage(stdout);
-      exit(EXIT_SUCCESS);
       break;
     case '?':
       usage(stderr);
@@ -1021,10 +1020,20 @@ int main(int argc, char **argv)
 
 static void usage(FILE *stream)
 {
-  fprintf(stream, "usage: %s [-bBcdfhioruUv] [-F dir] [file ...]\n"
-         "usage: %s {-v | --version}\n"
-         "usage: %s --help\n",
+  fprintf(stream,
+"usage: %s [-bBcdfhioruU] [-F font-directory] [file ...]\n"
+"usage: %s {-v | --version}\n"
+"usage: %s --help\n",
          program_name, program_name, program_name);
+  if (stdout == stream) {
+    fputs(
+"\n"
+"Translate the output of troff(1) into a form suitable for\n"
+"typewriter‐like devices, including terminal emulators.  See the\n"
+"grotty(1) manual page.\n",
+         stream);
+    exit(EXIT_SUCCESS);
+  }
 }
 
 // Local Variables:



reply via email to

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