groff-commit
[Top][All Lists]
Advanced

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

[groff] 08/38: [eqn]: Clarify diagnostics when handling options.


From: G. Branden Robinson
Subject: [groff] 08/38: [eqn]: Clarify diagnostics when handling options.
Date: Fri, 2 Sep 2022 19:56:30 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 4357b983bb043fdaf48227e5e58f45293b73f7a7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Aug 28 16:33:08 2022 -0500

    [eqn]: Clarify diagnostics when handling options.
    
    * src/preproc/eqn/main.cpp (main): Clarify error diagnostics regarding
      invalid option arguments.  Identify the option being handled at the
      time and characterize the argument as "invalid", not "bad".
    
    See, e.g., bb7512b57a, 17 September 2021.
---
 ChangeLog                |  7 +++++++
 src/preproc/eqn/main.cpp | 12 +++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 57393523b..224a33004 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-08-28  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/preproc/eqn/main.cpp (main): Clarify error diagnostics
+       regarding invalid option arguments.  Identify the option being
+       handled at the time and characterize the argument as "invalid",
+       not "bad".
+
 2022-08-28  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        [eqn]: Drop support for undocumented '-D' option.  It has been
diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp
index c8fe06053..a707d5115 100644
--- a/src/preproc/eqn/main.cpp
+++ b/src/preproc/eqn/main.cpp
@@ -301,11 +301,13 @@ int main(int argc, char **argv)
       break;
     case 'd':
       if (optarg[0] == '\0' || optarg[1] == '\0')
-       error("-d requires two character argument");
+       error("'-d' option requires a two-character argument");
       else if (invalid_input_char(optarg[0]))
-       error("bad delimiter '%1'", optarg[0]);
+       error("invalid delimiter '%1' in '-d' option argument",
+             optarg[0]);
       else if (invalid_input_char(optarg[1]))
-       error("bad delimiter '%1'", optarg[1]);
+       error("invalid delimiter '%1' in '-d' option argument",
+             optarg[1]);
       else {
        start_delim = optarg[0];
        end_delim = optarg[1];
@@ -333,7 +335,7 @@ int main(int argc, char **argv)
       break;
     case 's':
       if (!set_gsize(optarg))
-       error("invalid size '%1'", optarg);
+       error("invalid size '%1' in '-s' option argument ", optarg);
       break;
     case 'p':
       {
@@ -341,7 +343,7 @@ int main(int argc, char **argv)
        if (sscanf(optarg, "%d", &n) == 1)
          set_script_reduction(n);
        else
-         error("bad size '%1'", optarg);
+         error("invalid size '%1' in '-p' option argument ", optarg);
       }
       break;
     case 'm':



reply via email to

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