groff-commit
[Top][All Lists]
Advanced

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

[groff] 12/17: [grops]: Improve diagnostic messages.


From: G. Branden Robinson
Subject: [groff] 12/17: [grops]: Improve diagnostic messages.
Date: Sat, 17 Feb 2024 22:08:44 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 44055aff9a3f2c012abef505a47006a6257840ad
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Feb 17 17:39:42 2024 -0600

    [grops]: Improve diagnostic messages.
    
    * src/devices/grops/psrm.cpp (resource_manager::output_prolog): Report
      underlying system error when `putenv()` fails.
    
    * src/devices/grops/psrm.cpp (resource_manager::output_prolog):
      (resource_manager::supply_resource)
      (resource_manager::read_download_file): Parallelize wording of
      diagnostic messages.
---
 ChangeLog                  | 10 ++++++++++
 src/devices/grops/psrm.cpp | 11 ++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e221452d4..8564c0a8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-17  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grops/psrm.cpp (resource_manager::output_prolog):
+       Report underlying system error when `putenv()` fails.
+
+       * src/devices/grops/psrm.cpp (resource_manager::output_prolog):
+       (resource_manager::supply_resource)
+       (resource_manager::read_download_file): Parallelize wording of
+       diagnostic messages.
+
 2024-02-17  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grops/ps.cpp: Promote type definition to global
diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp
index 5cf9eeae8..f7ba771c6 100644
--- a/src/devices/grops/psrm.cpp
+++ b/src/devices/grops/psrm.cpp
@@ -314,7 +314,7 @@ void resource_manager::output_prolog(ps_output &out)
     e += GROPS_PROLOGUE;
     e += '\0';
     if (putenv(strsave(e.contents())))
-      fatal("putenv failed");
+      fatal("unable to update environment: %1", strerror(errno));
   }
   char *prologue = getenv("GROPS_PROLOGUE");
   FILE *fp = font::open_file(prologue, &path);
@@ -323,7 +323,7 @@ void resource_manager::output_prolog(ps_output &out)
     if (errno <= 0)
       fatal("refusing to traverse directories to open PostScript"
            " prologue file '%1'");
-    fatal("failed to open PostScript prologue file '%1': %2", prologue,
+    fatal("unable to open PostScript prologue file '%1': %2", prologue,
          strerror(errno));
   }
   fputs("%%BeginResource: ", outfp);
@@ -366,7 +366,7 @@ void resource_manager::supply_resource(resource *r, int 
rank,
          error("refusing to traverse directories to open PostScript"
                " resource file '%1'");
        else
-         error("failed to open PostScript resource file '%1': %2",
+         error("unable to open PostScript resource file '%1': %2",
                r->filename, strerror(errno));
        delete[] r->filename;
        r->filename = 0 /* nullptr */;
@@ -375,7 +375,8 @@ void resource_manager::supply_resource(resource *r, int 
rank,
     else {
       fp = include_search_path.open_file_cautious(r->filename);
       if (0 /* nullptr */ == fp) {
-       error("can't open '%1': %2", r->filename, strerror(errno));
+       error("unable to open file '%1': %2", r->filename,
+             strerror(errno));
        delete[] r->filename;
        r->filename = 0 /* nullptr */;
       }
@@ -1092,7 +1093,7 @@ void resource_manager::read_download_file()
   char *path = 0 /* nullptr */;
   FILE *fp = font::open_file("download", &path);
   if (0 /* nullptr */ == fp)
-    fatal("failed to open 'download' file: %1", strerror(errno));
+    fatal("unable to open 'download' file: %1", strerror(errno));
   char buf[512];
   int lineno = 0;
   while (fgets(buf, sizeof buf, fp)) {



reply via email to

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