groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/35: [groff]: Fix Savannah #62640.


From: G. Branden Robinson
Subject: [groff] 06/35: [groff]: Fix Savannah #62640.
Date: Tue, 21 Jun 2022 14:26:28 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 3bcdc926c84abdf735b24569f86975fd97e6529a
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Jun 18 19:31:50 2022 -0500

    [groff]: Fix Savannah #62640.
    
    * src/roff/groff/groff.cpp: Add new Boolean global, `need_postdriver`,
      and initialize it true.
    
      (main): Make `need_postdriver` false if the `-X` or `-Z` options are
      given.  Test it later.  This prevents groff from exiting with a fatal
      error if an output driver is not available, but also not required.
      Also reorder null pointer equality comparison to avoid inadvertent
      lvalue assignment.
    
    Fixes <https://savannah.gnu.org/bugs/?62640>.
    
    Also update editor aid comments; drop old style Emacs file-local
    variable setting.
---
 ChangeLog                | 12 ++++++++++++
 src/roff/groff/groff.cpp | 12 ++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5cc7fe8..9af479cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-06-18  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/roff/groff/groff.cpp: Add new Boolean global,
+       `need_postdriver`, and initialize it true.
+       (main): Make `need_postdriver` false if the `-X` or `-Z` options
+       are given.  Test it later.  This prevents groff from exiting
+       with a fatal error if an output driver is not available, but
+       also not required.  Also reorder null pointer equality
+       comparison to avoid inadvertent lvalue assignment.
+
+       Fixes <https://savannah.gnu.org/bugs/?62640>.
+
 2022-06-16  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/groff/groff.cpp (help): Revise usage message for
diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp
index d046f9d3..73f58e5d 100644
--- a/src/roff/groff/groff.cpp
+++ b/src/roff/groff/groff.cpp
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* Copyright (C) 1989-2020 Free Software Foundation, Inc.
      Written by James Clark (jjc@jclark.com)
 
@@ -96,6 +95,7 @@ int lflag = 0;
 char *spooler = 0;
 char *postdriver = 0;
 char *predriver = 0;
+bool need_postdriver = true;
 
 possible_command commands[NCOMMANDS];
 
@@ -211,6 +211,7 @@ int main(int argc, char **argv)
       // fall through
     case 'Z':
       zflag++;
+      need_postdriver = false;
       break;
     case 'l':
       lflag++;
@@ -324,6 +325,7 @@ int main(int argc, char **argv)
       break;
     case 'X':
       Xflag++;
+      need_postdriver = false;
       break;
     case '?':
       usage(stderr);
@@ -349,7 +351,7 @@ int main(int argc, char **argv)
   if (!font::load_desc())
     fatal("cannot load 'DESC' description file for device '%1'",
          device);
-  if (!postdriver)
+  if (need_postdriver && (0 /* nullptr */ == postdriver))
     fatal("no 'postpro' directive in 'DESC' file for device '%1'",
           device);
   if (predriver && !zflag) {
@@ -868,3 +870,9 @@ void c_fatal(const char *format, const char *arg1, const 
char *arg2,
 }
 
 }
+
+// Local Variables:
+// fill-column: 72
+// mode: C++
+// End:
+// vim: set cindent noexpandtab shiftwidth=2 textwidth=72:



reply via email to

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