Update of bug #67309 (group groff):

             Assigned to:                    None => gbranden
                 Summary: [troff] make `-c` option also disable the `color`
request => [PATCH] [troff] make `-c` option also disable the `color` request

    _______________________________________________________

Follow-up Comment #2:

No feedback so far.


$ git stash show -p 6
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 56877ffad..41b81ca0b 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -102,6 +102,7 @@ void transparent_file();
 token tok;
 bool want_break = false;
 bool using_character_classes = false;
+static bool permit_color_output = true;
 bool want_color_output = true;
 static bool want_backtraces = false;
 char *pipe_command = 0 /* nullptr */;
@@ -1523,10 +1524,16 @@ static color *read_gray(char end = 0)
 static void activate_color()
 {
   int n;
+  bool is_color_desired = false;
   if (has_arg() && get_integer(&n))
-    want_color_output = (n > 0);
+    is_color_desired = (n > 0);
   else
-    want_color_output = true;
+    is_color_desired = true;
+  if (is_color_desired && !permit_color_output) {
+    error("color output disabled via command line");
+    is_color_desired = false;
+  }
+  want_color_output = is_color_desired;
   skip_line();
 }
 
@@ -9265,7 +9272,7 @@ int main(int argc, char **argv)
       want_att_compat = true;
       // fall through
     case 'c':
-      want_color_output = false;
+      permit_color_output = false;
       break;
     case 'M':
       macro_path.command_line_dir(optarg);




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67309>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to