Ascender: use screen_error() vs err(3) in shape loader
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 15 Apr 2023 18:40:20 +0000 (18:40 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 15 Apr 2023 18:40:20 +0000 (18:40 +0000)
mmsoftware/ascender/src/main.c

index 780318c..43fe752 100644 (file)
@@ -340,7 +340,7 @@ read_shapes(void)
        int nline = 0, nshapes = 0, len, xs, ys;
 
        if ((fh = fopen(DATA_SHAPESPATH, "r")) == NULL)
-               err(EXIT_FAILURE, "Cannot open %s", DATA_SHAPESPATH);
+               screen_error("Cannot open %s", DATA_SHAPESPATH);
 
        /* About current shape */
        rarray_t tlines, flines, blines, alines;
@@ -405,20 +405,19 @@ read_shapes(void)
                                continue;
                        }
 
-                       err(EXIT_FAILURE,
-                           "Unexpected shape format line %d in %s",
+                       screen_error("Unexpected shape format line %d in %s",
                            nline, DATA_SHAPESPATH);
                }
 
                /* Process lines and create new shape instance */
 
                if (tlines.count < 1)
-                       err(EXIT_FAILURE, "Empty shape %d in %s line %d",
+                       screen_error("Empty shape %d in %s line %d",
                            nshapes, DATA_SHAPESPATH, nline);
                if ((flines.count > 0 && flines.count != tlines.count) ||
                    (blines.count > 0 && blines.count != tlines.count) ||
                    (alines.count > 0 && alines.count != tlines.count))
-                       err(EXIT_FAILURE,
+                       screen_error(
                            "F B A present but not matching T lines count %d "
                            "for shape %d at line %d in %s",
                            tlines.count, nshapes, nline, DATA_SHAPESPATH);
@@ -431,7 +430,7 @@ read_shapes(void)
 
                /* Allocate new pad */
                if ((pad = newpad(ys, xs)) == NULL)
-                       err(EXIT_FAILURE, "newpad()");
+                       screen_error("newpad()");
                (void)werase(pad);
 
                /* Fill with characters marked with attributes as needed */
@@ -533,7 +532,7 @@ read_shapes(void)
        rarray_destroy(&alines);
 
        if (nshapes != SHAPE_MAX)
-               err(EXIT_FAILURE, "Shapes short count in %s "
+               screen_error("Shapes short count in %s "
                    "(expected %d, read %d).", DATA_SHAPESPATH, SHAPE_MAX,
                    nshapes);