groff-commit
[Top][All Lists]
Advanced

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

[groff] 07/27: [refer]: Tweak diagnostic and usage message style.


From: G. Branden Robinson
Subject: [groff] 07/27: [refer]: Tweak diagnostic and usage message style.
Date: Tue, 3 May 2022 14:27:15 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit ff99afa2cdc0c4958ec05d5754a180adcac64705
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun May 1 22:37:55 2022 -0500

    [refer]: Tweak diagnostic and usage message style.
    
    * src/preproc/refer/refer.cpp (main): Tweak wording of diagnostic
      messages to refer to options consistently and to characterize input as
      "invalid" rather than "bad".
    
      (usage): Document --version option.  Switch lettercase between option
      and its argument when no space separates them.  Use more informative
      metasyntactic variable names.  Organize usage message consistently
      with our others, and stop wrapping the output lines: we know neither
      the width of the terminal nor the length of the `program_name` string
      we're interpolating.  See commit b4de44f0, 19 July 2021.
---
 ChangeLog                   | 12 ++++++++++++
 src/preproc/refer/refer.cpp | 25 ++++++++++++++-----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 64b3304c..6363940c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-05-01  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/refer/refer.cpp (main): Tweak wording of
+       diagnostic messages to refer to options consistently and to
+       characterize input as "invalid" rather than "bad".
+       (usage): Document --version option.  Use more informative
+       metasyntactic variable names.  Organize usage message
+       consistently with our others, and stop wrapping the output
+       lines: we know neither the width of the terminal nor the length
+       of the `program_name` string we're interpolating.  See commit
+       b4de44f0, 19 July 2021.
+
 2022-05-01  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/input.cpp (string_iterator::backtrace): Fix
diff --git a/src/preproc/refer/refer.cpp b/src/preproc/refer/refer.cpp
index a6b44f3f..0fd79f69 100644
--- a/src/preproc/refer/refer.cpp
+++ b/src/preproc/refer/refer.cpp
@@ -174,7 +174,7 @@ int main(int argc, char **argv)
              --argc;
            }
            else {
-             error("option 'f' requires an argument");
+             error("'f' option requires an argument");
              usage(stderr);
              exit(1);
            }
@@ -186,7 +186,8 @@ int main(int argc, char **argv)
          const char *ptr;
          for (ptr = num; *ptr; ptr++)
            if (!csdigit(*ptr)) {
-             error("bad character '%1' in argument to -f option", *ptr);
+             error("invalid character '%1' in argument to 'f' option",
+                   *ptr);
              break;
            }
          if (*ptr == '\0') {
@@ -219,7 +220,8 @@ int main(int argc, char **argv)
            buf[0] = *opt++;
          else {
            if (*opt != '\0')
-             error("bad field name '%1'", *opt++);
+             error("invalid field name '%1' in argument to 'k' option",
+                   *opt++);
            buf[0] = 'L';
          }
          buf[1] = '~';
@@ -235,7 +237,7 @@ int main(int argc, char **argv)
          const char *ptr;
          for (ptr = ++opt; *ptr; ptr++)
            if (!csdigit(*ptr)) {
-             error("argument to 'a' option not a number");
+             error("'a' option argument must be an integer");
              break;
            }
          if (*ptr == '\0') {
@@ -257,7 +259,7 @@ int main(int argc, char **argv)
            char *ptr;
            long n = strtol(opt, &ptr, 10);
            if (n == 0 && ptr == opt) {
-             error("bad integer '%1' in 'l' option", opt);
+             error("invalid integer '%1' in 'l' option argument", opt);
              opt = 0;
              break;
            }
@@ -273,7 +275,7 @@ int main(int argc, char **argv)
            char *ptr;
            long n = strtol(opt, &ptr, 10);
            if (n == 0 && ptr == opt) {
-             error("bad integer '%1' in 'l' option", opt);
+             error("invalid integer '%1' in 'l' option argument", opt);
              opt = 0;
              break;
            }
@@ -329,7 +331,7 @@ int main(int argc, char **argv)
          char *ptr;
          long n = strtol(opt, &ptr, 10);
          if (n == 0 && ptr == opt) {
-           error("bad integer '%1' in 't' option", opt);
+           error("invalid integer '%1' in 't' option argument", opt);
            opt = 0;
            break;
          }
@@ -391,9 +393,9 @@ int main(int argc, char **argv)
 static void usage(FILE *stream)
 {
   fprintf(stream,
-"usage: %s [-benvCPRS] [-aN] [-cXYZ] [-fN] [-iXYZ] [-kX] [-lM,N] [-p file]\n"
-"       [-sXYZ] [-tN] [-BL.M] [files ...]\n",
-         program_name);
+"usage: %s [-benCPRS] [-aN] [-cXYZ] [-fN] [-iXYZ] [-kX] [-lM,N]"
+" [-p db-file] [-sXYZ] [-tN] [-Bl.m] [file ...]\n"
+"usage: %s { -v | --version }\n", program_name, program_name);
 }
 
 static void possibly_load_default_database()
@@ -950,7 +952,8 @@ void output_references()
   assert(accumulate);
   if (!hash_table_size) {
     if (have_bibliography)
-      error("nothing to reference (probably 'bibliography' before 'sort')");
+      error("nothing to reference (probably 'bibliography' before"
+           " 'sort')");
     accumulate = 0;
     nreferences = 0;
     return;



reply via email to

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