groff-commit
[Top][All Lists]
Advanced

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

[groff] 04/22: [troff]: Recast some diagnostic messages.


From: G. Branden Robinson
Subject: [groff] 04/22: [troff]: Recast some diagnostic messages.
Date: Tue, 27 Jul 2021 22:34:21 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 84bf68945654c21804b1a1710c8a2ae74137cb71
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Jul 27 17:19:10 2021 +1000

    [troff]: Recast some diagnostic messages.
    
    * src/roff/troff/input.cpp (do_suppress): Recast diagnostic messages for
      clarity, to communicate in terms of what the escape sequence _is_, and
      to quote literals expected as input.
    
    * src/roff/troff/node.cpp (suppress_node::tprint): Recast diagnostic to
      prevent misinterpretation of image "description" as being HTML IMG tag
      alt text or something like that.  Unfortunately, the new language
      speaks in terms of internal implementation details ("grohtml-info"),
      but at least that way it's easier for a user to decide if they care
      about it.
---
 ChangeLog                | 12 ++++++++++++
 src/roff/troff/input.cpp | 14 +++++++++-----
 src/roff/troff/node.cpp  |  4 ++--
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5197bf2..c3ff39b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2021-07-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       * src/roff/troff/input.cpp (do_suppress): Recast diagnostic
+       messages for clarity, to communicate in terms of what the
+       escape sequence _is_, and to quote literals expected as input.
+       * src/roff/troff/node.cpp (suppress_node::tprint): Recast
+       diagnostic to prevent misinterpretation of image "description"
+       as being HTML IMG tag alt text or something like that.
+       Unfortunately, the new language speaks in terms of internal
+       implementation details ("grohtml-info"), but at least that way
+       it's easier for a user to decide if they care about it.
+
+2021-07-27  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        [troff]: Avoid using sprintf() with user-controlled format
        string.
 
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 2a94e64..9ae7650 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5528,7 +5528,7 @@ extern int image_no;              // from node.cpp
 static node *do_suppress(symbol nm)
 {
   if (nm.is_null() || nm.is_empty()) {
-    error("expecting an argument to escape \\O");
+    error("output suppression escape sequence requires an argument");
     return 0;
   }
   const char *s = nm.contents();
@@ -5560,19 +5560,22 @@ static node *do_suppress(symbol nm)
       s++;                     // move over '5'
       char position = *s;
       if (*s == (char)0) {
-       error("missing position and filename in \\O");
+       error("missing position and filename in output suppression"
+             " escape sequence");
        return 0;
       }
       if (!(position == 'l'
            || position == 'r'
            || position == 'c'
            || position == 'i')) {
-       error("l, r, c, or i position expected (got %1 in \\O)", position);
+       error("expected position 'l', 'r', 'c', or 'i' in output"
+             " suppression escape sequence, got '%1'", position);
        return 0;
       }
       s++;                     // onto image name
       if (s == (char *)0) {
-       error("missing image name for \\O");
+       error("missing image name in output suppression escape"
+             " sequence");
        return 0;
       }
       image_no++;
@@ -5583,7 +5586,8 @@ static node *do_suppress(symbol nm)
     }
     break;
   default:
-    error("'%1' is an invalid argument to \\O", *s);
+    error("invalid argument '%1' to output suppression escape sequence",
+         *s);
   }
   return 0;
 }
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
index 86b054e..83d4e9e 100644
--- a/src/roff/troff/node.cpp
+++ b/src/roff/troff/node.cpp
@@ -4170,8 +4170,8 @@ void suppress_node::tprint(troff_output_file *out)
       else {
        // postscript (or other device)
        if (suppress_start_page > 0 && current_page != suppress_start_page)
-         error("suppression limit registers span more than one page;"
-               " image description %1 will be wrong", image_no);
+         error("suppression limit registers span more than a page;"
+               " grohtml-info for image %1 will be wrong", image_no);
        // if (topdiv->get_page_number() != suppress_start_page)
        //  fprintf(stderr, "end of image and topdiv page = %d   and  
suppress_start_page = %d\n",
        //        topdiv->get_page_number(), suppress_start_page);



reply via email to

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