commit 99d66cb8004c4efac2ae276b0cfc036d0795262b
parent 7d978266916fbc463b2bffcefbc6a93cdae3d269
Author: Kyle Milz <krwmilz@gmail.com>
Date: Sat, 11 Sep 2021 17:50:01 +0000
replace custom Warning() with warnx()
Diffstat:
M | special.c | | | 30 | ++++++++---------------------- |
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/special.c b/special.c
@@ -53,6 +53,7 @@ NOTE:
* it's worth it.
*/
+#include <err.h>
#include <math.h>
#include <ctype.h>
@@ -84,20 +85,6 @@ static Boolean blacken = False;
/*
- * Issue warning messages
- */
-
-static void
-Warning(fmt, msg)
- char *fmt, *msg;
-{
- Fprintf(stderr, "%s: ", prog);
- Fprintf(stderr, fmt, msg);
- (void) fputc('\n', stderr);
-}
-
-
-/*
* X drawing routines
*/
@@ -168,7 +155,7 @@ set_pen_size(cp)
int ps;
if (sscanf(cp, " %d ", &ps) != 1) {
- Warning("invalid .ps command format: %s", cp);
+ warnx("invalid .ps command format: %s", cp);
return;
}
pen_size = (ps * (xRESOLUTION + yRESOLUTION) + 1000) / 2000;
@@ -225,11 +212,11 @@ flush_dashed(cp, dotted)
double d, spacesize, a, b, dx, dy, milliperdash;
if (sscanf(cp, " %f ", &inchesperdash) != 1) {
- Warning("invalid format for dotted/dashed line: %s", cp);
+ warnx("invalid format for dotted/dashed line: %s", cp);
return;
}
if (path_len <= 1 || inchesperdash <= 0.0) {
- Warning("invalid conditions for dotted/dashed line", "");
+ warnx("invalid conditions for dotted/dashed line");
return;
}
milliperdash = inchesperdash * 1000.0;
@@ -353,7 +340,7 @@ arc(cp, invis)
if (sscanf(cp, " %d %d %d %d %f %f ", &xc, &yc, &xrad, &yrad,
&start_angle, &end_angle) != 6) {
- Warning("invalid arc specification: %s", cp);
+ warnx("invalid arc specification: %s", cp);
return;
}
@@ -1010,8 +997,7 @@ scan_color(cp)
}
else if (memicmp(cp1, "pop", 3) == 0) {
if (scanstack_len <= 1) {
- fprintf(stderr,
- "Warning: Color pop occurred with empty color stack.\n");
+ warnx("Color pop occurred with empty color stack.");
}
else {
scanstack_current = scanstack_current->prev;
@@ -1023,8 +1009,8 @@ scan_color(cp)
if (scanstack_len > 1) {
struct colorframe *cfp;
- Fprintf(stderr, "Warning: Global color change occurred with non-empty color stack;\n\
-coping by setting all stack entries to that color.\n");
+ warnx("Global color change occurred with non-empty color stack"
+ ";\ncoping by setting all stack entries to that color.\n");
for (cfp = scanstack_head.next;; cfp = cfp->next) {
cfp->color = scanstack_head.color;
if (cfp == scanstack_current) break;