commit 8ee0ee3f72ce90f3989b0aeab4ba221bcbad7004
parent 921113377828d744b8941c5a6a0b5fee9eed3093
Author: Kyle Milz <krwmilz@gmail.com>
Date: Thu, 9 Sep 2021 17:42:21 +0000
clean up paper size warnings
Diffstat:
M | xdvi.c | | | 41 | ++++++++++++++++++----------------------- |
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/xdvi.c b/xdvi.c
@@ -604,7 +604,6 @@ static const char *paper_types[] = {
"legalr", "14x8.5in",
"foolscap", "13.5x17.0in", /* ??? */
"foolscapr", "17x13.5in",
- NULL, NULL, /* hack used for formatting the list */
/* ISO `A' formats, Portrait */
"a1", "594x841mm",
@@ -614,7 +613,6 @@ static const char *paper_types[] = {
"a5", "148x210mm",
"a6", "105x148mm",
"a7", "74x105mm",
- NULL, NULL,
/* ISO `A' formats, Landscape */
"a1r", "840x594mm",
@@ -624,7 +622,6 @@ static const char *paper_types[] = {
"a5r", "210x148mm",
"a6r", "148x105mm",
"a7r", "105x74mm",
- NULL, NULL,
/* ISO `B' formats, Portrait */
"b1", "707x1000mm",
@@ -634,7 +631,6 @@ static const char *paper_types[] = {
"b5", "176x250mm",
"b6", "125x176mm",
"b7", "88x125mm",
- NULL, NULL,
/* ISO `B' formats, Landscape */
"b1r", "1000x707mm",
@@ -644,7 +640,6 @@ static const char *paper_types[] = {
"b5r", "250x176mm",
"b6r", "176x125mm",
"b7r", "125x88mm",
- NULL, NULL,
/* ISO `C' formats, Portrait */
"c1", "648x917mm",
@@ -654,7 +649,6 @@ static const char *paper_types[] = {
"c5", "162x229mm",
"c6", "114x162mm",
"c7", "81x114mm",
- NULL, NULL,
/* ISO `C' formats, Landscape */
"c1r", "917x648mm",
@@ -689,7 +683,7 @@ set_paper_type() {
arg = temp;
/* perform substitutions */
for (p = paper_types; p < paper_types + XtNumber(paper_types); p += 2)
- if (*p != NULL && strcmp(temp, *p) == 0) {
+ if (strcmp(temp, *p) == 0) {
arg = p[1];
break;
}
@@ -1097,22 +1091,23 @@ main(int argc, char **argv)
offset_y = resource.yoffset ? atopix(resource.yoffset, True)
: pixels_per_inch;
if (!set_paper_type()) {
- _Xconst char **p;
-
- Fprintf(stderr,
- "%s: Unrecognized paper type \"%s\". Legal values are:\n ",
- prog, resource.paper);
- for (p = paper_types; p < paper_types + XtNumber(paper_types);
- p += 2)
- if (*p == NULL) Fputs("\n ", stderr);
- else Fprintf(stderr, " %s", *p);
- Fputs("\n\
- (the names ending in `r' are `rotated' or `landscape' variants),\n\n\
-or: a specification `WIDTHxHEIGHT' followed by a dimension unit\n\
- (pt, pc, in, bp, cm, mm, dd, cc, or sp).\n\n\
-Either of the above may be preceded by a plus sign (`+'); this causes the\n\
-argument is to override any papersize specials in the dvi file.\n\n", stderr);
- exit(1);
+ warnx("Unrecognized paper type '%s'. Legal values are:",
+ resource.paper);
+
+ for (int i = 0; i < XtNumber(paper_types); i += 2)
+ fprintf(stderr, "\t%s\t%s\n", paper_types[i],
+ paper_types[i+1]);
+
+ fprintf(stderr, "\t(the names ending in `r' are `rotated' or "
+ "`landscape' variants),\n\n");
+ fprintf(stderr, "or: a specification `WIDTHxHEIGHT' followed "
+ "by a dimension unit\n"
+ "\t(pt, pc, in, bp, cm, mm, dd, cc, or sp).\n\n");
+ fprintf(stderr, "Either of the above may be preceded by a "
+ "plus sign (`+'); this causes the\n"
+ "argument is to override any papersize specials in "
+ "the dvi file.\n\n");
+ exit(1);
}
for (i = 0; i < 5; ++i)
if (resource.mg_arg[i] != NULL) {