groff-commit
[Top][All Lists]
Advanced

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

[groff] 33/35: [grops]: Supply more information in diagnostics.


From: G. Branden Robinson
Subject: [groff] 33/35: [grops]: Supply more information in diagnostics.
Date: Tue, 21 Jun 2022 14:26:32 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 96e3e743bdd0619c45a758b2c0a379dd9a92bf5b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Tue Jun 21 05:35:40 2022 -0500

    [grops]: Supply more information in diagnostics.
    
    * src/devices/grops/psrm.cpp (resource_manager::output_prolog):
      (resource_manager::supply_resource):
      (resource_manager::read_download_file): Update diagnostic message
      language and report underlying problem encountered by system when
      failing to open files.  This will probably be the text for ENOENT in
      most cases, but should help avoid frustration in those where it isn't.
---
 ChangeLog                  | 10 ++++++++++
 src/devices/grops/psrm.cpp | 11 +++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 35da385d..3346fa03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-06-21  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grops/psrm.cpp (resource_manager::output_prolog):
+       (resource_manager::supply_resource):
+       (resource_manager::read_download_file): Update diagnostic
+       message language and report underlying problem encountered by
+       system when failing to open files.  This will probably be the
+       text for ENOENT in most cases, but should help avoid frustration
+       in those where it isn't.
+
 2022-06-20  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/devices/grops/psrm.cpp
diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp
index 02bdd648..76d9d13b 100644
--- a/src/devices/grops/psrm.cpp
+++ b/src/devices/grops/psrm.cpp
@@ -317,7 +317,8 @@ void resource_manager::output_prolog(ps_output &out)
   char *prologue = getenv("GROPS_PROLOGUE");
   FILE *fp = font::open_file(prologue, &path);
   if (!fp)
-    fatal("can't find '%1'", prologue);
+    fatal("failed to open PostScript prologue '%1': %2", prologue,
+         strerror(errno));
   fputs("%%BeginResource: ", outfp);
   procset_resource->print_type_and_name(outfp);
   putc('\n', outfp);
@@ -353,7 +354,8 @@ void resource_manager::supply_resource(resource *r, int 
rank,
     if (r->type == RESOURCE_FONT) {
       fp = font::open_file(r->filename, &path);
       if (!fp) {
-       error("can't find '%1'", r->filename);
+       error("failed to open PostScript resource '%1': %2",
+             r->filename, strerror(errno));
        delete[] r->filename;
        r->filename = 0 /* nullptr */;
       }
@@ -1079,7 +1081,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");
+    fatal("failed to open 'download' file: %1", strerror(errno));
   char buf[512];
   int lineno = 0;
   while (fgets(buf, sizeof(buf), fp)) {
@@ -1089,7 +1091,8 @@ void resource_manager::read_download_file()
       continue;
     char *q = strtok(0 /* nullptr */, " \t\r\n");
     if (!q)
-      fatal_with_file_and_line(path, lineno, "missing filename");
+      fatal_with_file_and_line(path, lineno, "file name missing for"
+                              " font '%1'", p);
     lookup_font(p)->filename = strsave(q);
   }
   free(path);



reply via email to

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