commit bee1c5d81bb6ae58bf540db8f1ad6017a4e296fd
parent 99d66cb8004c4efac2ae276b0cfc036d0795262b
Author: Kyle Milz <krwmilz@gmail.com>
Date: Sat, 11 Sep 2021 19:25:10 +0000
replace hand rolled functions with err.h
Replace oops(), Warning(), and many fprintf(stderr, ...) functions
with standard err.h counterparts.
Diffstat:
14 files changed, 92 insertions(+), 133 deletions(-)
diff --git a/dvi-draw.c b/dvi-draw.c
@@ -27,6 +27,7 @@ NOTE:
\*========================================================================*/
+#include <err.h>
#include <ctype.h>
#include <stdarg.h>
@@ -241,17 +242,15 @@ xskip(offset)
SEEK_CUR);
}
-static void tell_oops(const char *, ...) NORETURN;
-
-static void
+static void
tell_oops(const char *message, ...)
{
va_list args;
- Fprintf(stderr, "%s: ", prog);
va_start(args, message);
- (void) vfprintf(stderr, message, args);
+ vwarnx(message, args);
va_end(args);
+
if (currinf.virtual)
Fprintf(stderr, " in virtual font %s\n", currinf.virtual->fontname);
else
@@ -271,7 +270,8 @@ print_bitmap(bitmap)
BMUNIT *ptr = (BMUNIT *) bitmap->bits;
int x, y, i;
- if (ptr == NULL) oops("print_bitmap called with null pointer.");
+ if (ptr == NULL)
+ errx(1, "print_bitmap called with null pointer.");
Printf("w = %d, h = %d, bytes wide = %d\n",
bitmap->w, bitmap->h, bitmap->bytes_wide);
for (y = 0; y < (int) bitmap->h; ++y) {
@@ -527,7 +527,7 @@ open_font_file(fontp)
if (fontp->file == NULL) {
fontp->file = xfopen(fontp->filename, "r");
if (fontp->file == NULL)
- oops("Font file disappeared: %s", fontp->filename);
+ errx(1, "Font file disappeared: '%s'", fontp->filename);
}
}
@@ -1471,9 +1471,8 @@ geom_do_char(g_info, ch)
return DIR * m->dvi_adv;
}
else {
- oops("internal error -- currinf.set_char_p = 0x%x",
+ errx(1, "internal error -- currinf.set_char_p = %p",
currinf.set_char_p);
- /* NOTREACHED */
}
}
diff --git a/dvi-init.c b/dvi-init.c
@@ -27,6 +27,8 @@ NOTE:
\*========================================================================*/
+#include <err.h>
+
#include <X11/Shell.h> /* defines XtNtitle and XtNiconName */
#include "dvi-init.h"
@@ -235,23 +237,21 @@ load_font(fontp)
if (ev_flags & EV_GE_NEWDOC)
return False;
fontp->flags |= FONT_LOADED; /* as loaded as it'll get */
- Fprintf(stderr, "%s: can't find font %s.\n", prog, fontp->fontname);
+ warnx("can't find font '%s'.", fontp->fontname);
return False;
}
fontp->flags |= FONT_LOADED;
if (font_found != NULL) {
- Fprintf(stderr,
- "%s: can't find font %s; using %s instead at %d dpi.\n",
- prog, fontp->fontname, font_found, dpi);
+ warnx("can't find font '%s'; using '%s' instead at %d dpi.",
+ fontp->fontname, font_found, dpi);
free(fontp->fontname);
fontp->fontname = font_found;
hushcs = True;
}
else if (size_found > (int) (1.002 * fsize + 0.5) ||
size_found < (int) (0.998 * fsize + 0.5))
- Fprintf(stderr,
- "%s: can't find font %s at %d dpi; using %d dpi instead.\n",
- prog, fontp->fontname, dpi, size_found);
+ warnx("can't find font %s at %d dpi; using %d dpi instead.",
+ fontp->fontname, dpi, size_found);
fontp->timestamp = ++current_timestamp;
fontp->maxchar = maxchar = 255;
fontp->set_char_p = set_char;
@@ -267,7 +267,8 @@ load_font(fontp)
else
if (magic == VF_MAGIC) read_VF_index(fontp, hushcs);
else
- oops("Cannot recognize format for font file %s", fontp->filename);
+ errx(1, "Cannot recognize format for font file '%s'",
+ fontp->filename);
if (fontp->flags & FONT_VIRTUAL) {
while (maxchar > 0 && fontp->macro[maxchar].pos == NULL) --maxchar;
@@ -762,7 +763,8 @@ internal_init_dvi()
void
init_dvi_file()
{
- if (setjmp(dvi_env)) oops(dvi_oops_msg);
+ if (setjmp(dvi_env))
+ errx(1, "%s", dvi_oops_msg);
(void) internal_init_dvi();
}
diff --git a/events.c b/events.c
@@ -28,6 +28,7 @@ NOTE:
\*========================================================================*/
#include <ctype.h>
+#include <err.h>
#include <limits.h> /* abs() */
#include <math.h> /* pow() */
#include <stdlib.h> /* free(), atoi(), atof(), exit(), abs() */
@@ -192,8 +193,7 @@ compile_action(str, app)
for (actp = Actions;; ++actp) {
if (actp >= Actions + XtNumber(Actions)) {
- fprintf(stderr, "%s: cannot compile action %.*s\n", prog,
- (int) (p - str), str);
+ warnx("cannot compile action '%.*s'", (int) (p - str), str);
*app = NULL;
return False;
}
@@ -205,8 +205,7 @@ compile_action(str, app)
while (*p == ' ' || *p == '\t') ++p;
if (*p != '(') {
while (*p != '\0' && *p != '\n') ++p;
- fprintf(stderr, "%s: syntax error in action %.*s\n", prog,
- (int) (p - str), str);
+ warnx("syntax error in action '%.*s'", (int) (p - str), str);
*app = NULL;
return False;
}
@@ -214,8 +213,7 @@ compile_action(str, app)
while (*p == ' ' || *p == '\t') ++p;
for (p1 = p;; ++p1) {
if (*p1 == '\0' || *p1 == '\n') {
- fprintf(stderr, "%s: syntax error in action %.*s\n", prog,
- (int) (p1 - str), str);
+ warnx("syntax error in action '%.*s'", (int) (p1 - str), str);
*app = NULL;
return False;
}
diff --git a/filefind.c b/filefind.c
@@ -38,6 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* <pwd.h>
*/
+#include <err.h>
#include <setjmp.h> /* jmp_buf, longjmp(), setjmp() */
#include <stdlib.h> /* getenv() */
@@ -464,8 +465,7 @@ dobrace(p, pos0, level, skip)
for (;;) { /* loop over characters */
if (*p == '\0' || IS_SEP(*p)) {
/* keep the braces matched: { */
- fprintf(stderr, "%s: Missing } in %s path.\n",
- prog, lrec.type);
+ warnx("Missing } in '%s' path.", lrec.type);
return;
}
else if (*p == '%') {
@@ -1364,8 +1364,7 @@ filltree(pos, treepp, atom, slashslash)
continue; /* skip . and .. */
if (lstat(ffline, &statbuf) != 0) {
- fprintf(stderr, "%s/filltree/stat: ", prog);
- perror(ffline);
+ warn("lstat: filltree ffline");
continue;
}
isdir = False;
diff --git a/font-open.c b/font-open.c
@@ -27,6 +27,7 @@ NOTE:
\*========================================================================*/
+#include <err.h>
#include <errno.h>
#include <stdlib.h> /* free(), atoi() */
@@ -502,16 +503,15 @@ dvips_parse(line)
if (w1l == 0) {
if (debug & DBG_OPEN)
- Fprintf(stderr,
- "%s: map file %s: line \"%s\" does not give a font name.\n",
- prog, p_head->value, line);
+ warnx("map file '%s': line '%s' does not give a font name.",
+ p_head->value, line);
return NULL;
}
if (err != NULL) {
if (debug & DBG_OPEN)
- Fprintf(stderr, "%s: map file %s, font %.*s: %s\n", prog,
- p_head->value, (int) w1l, w1p, err);
+ warnx("map file '%s', font '%.*s': '%s'", p_head->value,
+ (int) w1l, w1p, err);
return NULL;
}
@@ -520,9 +520,8 @@ dvips_parse(line)
if (t1p->key != w1p) { /* if existing record */
if (debug & DBG_OPEN)
- Fprintf(stderr,
- "%s: map file %s, font %.*s: duplicate record; using first one\n",
- prog, p_head->value, (int) w1l, w1p);
+ warnx("map file '%s', font '%.*s': duplicate record; using first one",
+ p_head->value, (int) w1l, w1p);
return NULL;
}
@@ -942,10 +941,8 @@ get_gs_token(gsfp, pos, pos_ret, file_type)
bcopy(p0, ffline + pos, len);
pos += len;
if (!gs_fillbuf(gsfp)) {
- Fprintf(stderr,
- "%s: unterminated string in %s file; giving up.\n"
- ,
- prog, file_type);
+ warnx("unterminated string in '%s' file; giving up." ,
+ file_type);
return GS_ERR;
}
p0 = gsfp->buffer;
@@ -995,9 +992,8 @@ get_gs_token(gsfp, pos, pos_ret, file_type)
break;
default:
- Fprintf(stderr,
- "%s: invalid character `%c' encountered in %s file; giving up.\n",
- prog, c, file_type);
+ warnx("invalid character `%c' encountered in '%s' file; giving up.",
+ c, file_type);
return GS_ERR;
}
@@ -1041,14 +1037,13 @@ process_gs_fontmap(FILE *f)
if (ttype == GS_ERR)
break;
if (ttype == GS_EOF) {
- Fprintf(stderr,
- "%s: unexpected end of Fontmap file; giving up.\n", prog);
+ warnx("unexpected end of Fontmap file; giving up.");
break;
}
if (ttype != '.' || pos2 - pos1 != 11
|| memcmp(ffline + pos1, ".runlibfile", 11) != 0) {
- Fprintf(stderr, "%s: invalid token following \"(%.*s)\" in Fontmap file; giving up.\n",
- prog, (int) pos1, ffline);
+ warnx("invalid token following '(%.*s)' in Fontmap file; giving up.",
+ (int) pos1, ffline);
break;
}
@@ -1065,8 +1060,7 @@ process_gs_fontmap(FILE *f)
}
if (f1 == NULL)
- Fprintf(stderr, "%s: Fontmap .runlibfile: %s: %s\n",
- prog, ffline, strerror(errno));
+ warn("Fontmap .runlibfile: '%s'", ffline);
else {
--gs_fontmap_number;
process_gs_fontmap(f1);
@@ -1080,17 +1074,15 @@ process_gs_fontmap(FILE *f)
if (ttype == GS_ERR)
break;
if (ttype == GS_EOF) {
- Fprintf(stderr,
- "%s: unexpected end of Fontmap file; giving up.\n", prog);
+ warnx("unexpected end of Fontmap file; giving up.");
break;
}
if ((ttype != '/' && ttype != LPAREN)
|| pos2 == pos1 /* empty string would mess things up */
|| get_gs_token(&gsf, pos2, &pos3, "Fontmap") != ';'
|| pos3 != pos2 + 1) {
- Fprintf(stderr,
- "%s: invalid token following \"%.*s\" in Fontmap file; giving up.\n",
- prog, (int) pos1, ffline);
+ warnx("invalid token following '%.*s' in Fontmap file; giving up.",
+ (int) pos1, ffline);
break;
}
if (ttype == '/')
@@ -1127,8 +1119,8 @@ process_gs_fontmap(FILE *f)
gsfp->fontmap_number = gs_fontmap_number;
}
else {
- Fprintf(stderr, "%s: invalid token \"%s\" in Fontmap file; giving up.\n",
- prog, ffline);
+ warnx("invalid token '%s' in Fontmap file; giving up.",
+ ffline);
}
}
@@ -1201,8 +1193,7 @@ pre_lookup_t1_font(fontname)
printf("Map file: %s\n", p_head->value);
break;
}
- Fprintf(stderr, "%s: cannot open map file %s\n", prog,
- p_head->value);
+ warnx("cannot open map file '%s'", p_head->value);
}
continue;
}
@@ -1308,8 +1299,7 @@ open_t1_font(t1p, path_ret)
f = lookup_gs_font(t1p->psname, path_ret);
if (f == NULL) {
- Fprintf(stderr, "%s: cannot find Type 1 font %s\n", prog,
- t1p->psname);
+ warnx("cannot find Type 1 font '%s'", t1p->psname);
return NULL;
}
@@ -1320,8 +1310,8 @@ open_t1_font(t1p, path_ret)
f = filefind(t1p->fontfile, &search_type1, path_ret);
if (f == NULL) {
- Fprintf(stderr, "%s: cannot find Type 1 font file %s (will try PK version instead)\n",
- prog, t1p->fontfile);
+ warnx("cannot find Type 1 font file '%s' (will try PK version instead)",
+ t1p->fontfile);
return NULL;
}
}
@@ -1368,9 +1358,8 @@ read_encoding(encp)
f = filefind(encp->key, &search_enc, NULL);
if (f == NULL) {
- Fprintf(stderr,
- "%s: cannot find encoding file %s; ignoring encoding\n",
- prog, encp->key);
+ warnx("cannot find encoding file '%s'; ignoring encoding",
+ encp->key);
return;
}
@@ -1420,9 +1409,8 @@ read_encoding(encp)
encp->valid = True;
}
else /* if error */
- Fprintf(stderr,
- "%s: invalid format in encoding file %s; giving up.\n", prog,
- encp->key);
+ warnx("invalid format in encoding file '%s'; giving up.",
+ encp->key);
Fclose(f);
++n_files_left;
diff --git a/ft.c b/ft.c
@@ -27,10 +27,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "font.h" /* struct font */
+#include "util.h" /* alloc_bitmap(), ROUNDUP, struct avl */
#include "xdvi.h"
-#include "util.h" /* oops() */
#include <ctype.h> /* isspace(), isdigit() */
+#include <err.h>
#include <math.h>
#include <ft2build.h>
@@ -134,7 +135,7 @@ read_ft_char(struct font *fontp, wide_ubyte ch)
FT_Activate_Size(fontp->size);
err = FT_Load_Glyph(face, g->addr, FT_LOAD_NO_SCALE);
if (err != 0)
- oops("FT_Load_Glyph: error = %d", err);
+ errx(1, "FT_Load_Glyph: error = %d", err);
g->dvi_adv = face->glyph->metrics.horiAdvance * fontp->ft->expn
* fontp->spsize / face->units_per_EM + 0.5;
@@ -143,7 +144,7 @@ read_ft_char(struct font *fontp, wide_ubyte ch)
err = FT_Load_Glyph(face, g->addr, FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
if (err != 0)
- oops("FT_Load_Glyph: error = %d", err);
+ errx(1, "FT_Load_Glyph: error = %d", err);
slot = face->glyph;
g->bitmap.w = slot->bitmap.width;
@@ -353,8 +354,7 @@ load_ft_font(fontp)
ftp->face = face;
if (!FT_IS_SCALABLE(face)) {
- Fprintf(stderr, "%s: Font %s is not scalable.\n", prog,
- fontp->fontname);
+ warnx("Font '%s' is not scalable.", fontp->fontname);
FT_Done_Face(face);
free((char *) path);
Fclose(f);
@@ -420,7 +420,7 @@ load_ft_font(fontp)
(int) (fontp->spsize * (72<<6) / (pixels_per_inch << 16) + 0.5), 0,
pixels_per_inch, pixels_per_inch);
if (err != 0)
- oops("FT_Set_Char_Size: error = %d\n", err);
+ errx(1, "FT_Set_Char_Size: error = %d", err);
/* Look for already-computed character indices */
for (fontp2 = ftp->first_size;; fontp2 = fontp2->next_size) {
diff --git a/pk.c b/pk.c
@@ -30,6 +30,8 @@ NOTE:
* Public routines are read_PK_index and read_PK_char.
*/
+#include <err.h>
+
#include "font.h" /* struct font, struct glyph */
#include "xdvi.h"
#include "util.h" /* xmalloc() */
@@ -123,7 +125,7 @@ PK_skip_specials(fontp)
case PK_NOOP :
break;
default :
- oops("Unexpected %d in PK file %s", PK_flag_byte,
+ errx(1, "Unexpected %d in PK file '%s'", PK_flag_byte,
fontp->filename);
break;
}
@@ -177,7 +179,7 @@ read_PK_char(struct font *fontp, wide_ubyte ch)
w = num(fp, n);
h = num(fp, n);
if (w > 0x7fff || h > 0x7fff)
- oops("Character %d too large in file %s", ch, fontp->fontname);
+ errx(1, "Character %d too large in file '%s'", ch, fontp->fontname);
g->bitmap.w = w;
g->bitmap.h = h;
}
@@ -292,10 +294,10 @@ read_PK_char(struct font *fontp, wide_ubyte ch)
paint_switch = 1 - paint_switch;
}
if (cp != ((BMUNIT *) (g->bitmap.bits + bytes_wide * g->bitmap.h)))
- oops("Wrong number of bits stored: char. %d, font %s", ch,
- fontp->fontname);
+ errx(1, "Wrong number of bits stored: char. %d, font '%s'",
+ ch, fontp->fontname);
if (rows_left != 0 || h_bit != g->bitmap.w)
- oops("Bad pk file (%s), too many bits", fontp->fontname);
+ errx(1, "Bad pk file '%s', too many bits", fontp->fontname);
}
}
diff --git a/popups.c b/popups.c
@@ -31,6 +31,7 @@ IN THE SOFTWARE.
#include <sys/wait.h>
#include <ctype.h>
+#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
@@ -106,8 +107,7 @@ vmprintf(format, args)
char *result;
if (vasprintf(&result, format, args) < 0)
- oops("! Out of memory (call to vasprintf() with format \"%s\").\n",
- format);
+ errx(1, "vasprintf failed with format '%s').", format);
return result;
}
@@ -1277,10 +1277,10 @@ print_do_it()
#if 0
if (argnext - argv != argc)
- oops("dvips command count mismatch: %u != %u", argc,
+ errx(1, "dvips command count mismatch: %u != %u", argc,
argnext - argv);
if (p - argv[0] != len)
- oops("dvips command length mismatch: %u != %u", len, p - argv[0]);
+ errx(1, "dvips command length mismatch: %u != %u", len, p - argv[0]);
#endif
p[-1] = '\n';
diff --git a/special.c b/special.c
@@ -270,9 +270,10 @@ add_path(cp)
{
int pathx, pathy;
- if (++path_len >= MAXPOINTS) oops("Too many points");
+ if (++path_len >= MAXPOINTS)
+ errx(1, "Too many points");
if (sscanf(cp, " %d %d ", &pathx, &pathy) != 2)
- oops("Malformed path command");
+ errx(1, "Malformed path command");
xx[path_len] = pathx;
yy[path_len] = pathy;
}
@@ -286,7 +287,8 @@ static void
im_fdraw(x, y)
double x,y;
{
- if (++path_len >= MAXPOINTS) oops("Too many arc points");
+ if (++path_len >= MAXPOINTS)
+ errx(1, "Too many arc points");
xx[path_len] = x + 0.5;
yy[path_len] = y + 0.5;
}
@@ -648,9 +650,8 @@ epsf_special(cp)
for (keyno = 0;; ++keyno) {
if (keyno >= NKEYS) {
if (warn_spec_now)
- Fprintf(stderr,
- "%s: unknown keyword (%.*s) in \\special will be ignored\n",
- prog, (int) (p1 - cp), cp);
+ warnx("unknown keyword '%.*s' in \\special will be ignored",
+ (int) (p1 - cp), cp);
break;
}
if (memcmp(cp, keytab[keyno], p1 - cp) == 0) {
@@ -1010,7 +1011,7 @@ scan_color(cp)
struct colorframe *cfp;
warnx("Global color change occurred with non-empty color stack"
- ";\ncoping by setting all stack entries to that color.\n");
+ ";\ncoping by setting all stack entries to that color.");
for (cfp = scanstack_head.next;; cfp = cfp->next) {
cfp->color = scanstack_head.color;
if (cfp == scanstack_current) break;
@@ -1250,8 +1251,7 @@ scan_papersize(cp0)
h = myatopix(&cp) * mag + 0.5;
if (w == 0 || h == 0)
- Fprintf(stderr, "%s: invalid papersize special \"%s\"\n", prog,
- cp0);
+ warnx("invalid papersize special '%s'", cp0);
else {
page_info[scanned_page + 1].pw = page_info[scanned_page + 1].ww = w;
page_info[scanned_page + 1].ph = page_info[scanned_page + 1].wh = h;
@@ -1384,7 +1384,7 @@ applicationDoSpecial(cp)
}
if (warn_spec_now && memcmp(cp, "src:", 4) != 0)
- Fprintf(stderr, "%s: special \"%s\" not implemented\n", prog, cp);
+ warnx("special '%s' not implemented", cp);
}
#undef CMD
diff --git a/util.c b/util.c
@@ -30,9 +30,9 @@ NOTE:
#include <sys/ioctl.h> /* this defines SIOCSPGRP and FIOASYNC */
#include <ctype.h> /* needed for memicmp() */
+#include <err.h>
#include <errno.h>
#include <pwd.h>
-#include <stdarg.h>
#include <unistd.h>
#include "font.h" /* struct font */
@@ -45,26 +45,6 @@ NOTE:
*/
/*
- * Print error message and quit.
- */
-
-void
-oops(const char *message, ...)
-{
- va_list args;
-
- Fprintf(stderr, "%s: ", prog);
- va_start(args, message);
- (void) vfprintf(stderr, message, args);
- va_end(args);
- Putc('\n', stderr);
- exit(1);
-}
-
-
-#ifndef KPATHSEA
-
-/*
* Either (re)allocate storage or fail with explanation.
*/
@@ -75,7 +55,7 @@ xmalloc(size)
void *mem = malloc(size);
if (mem == NULL)
- oops("! Out of memory (allocating %u bytes).\n", size);
+ err(1, "malloc %u bytes", size);
return mem;
}
@@ -88,7 +68,7 @@ xrealloc(where, size)
void *mem = realloc(where, size);
if (mem == NULL)
- oops("! Out of memory (reallocating %u bytes).\n", size);
+ err(1, "realloc %u bytes", size);
return mem;
}
@@ -127,8 +107,6 @@ xmemdup(str, len)
return new;
}
-#endif /* not KPATHSEA */
-
/*
* Expand the matrix *ffline to at least the given size.
@@ -173,7 +151,7 @@ xputenv(var, value)
const char *value;
{
if (setenv(var, value, True) != 0)
- oops("! Failure in setting environment variable.");
+ err(1, "setenv");
return;
}
@@ -222,7 +200,7 @@ close_a_file()
oldest = fontp->timestamp;
}
if (f == NULL)
- oops("Can't find an open pixel file to close");
+ errx(1, "Can't find an open pixel file to close");
Fclose(f->file);
f->file = NULL;
++n_files_left;
diff --git a/util.h b/util.h
@@ -12,7 +12,6 @@ struct avl *avladd(const char *, size_t, struct avl **, size_t);
void expandline(size_t);
const struct passwd *ff_getpw(const char **, const char *);
int memicmp(const char *, const char *, size_t);
-void oops(const char *, ...) __attribute__((__noreturn__));
void prep_fd(int, Boolean);
FILE *xfopen(const char *, const char *);
diff --git a/vf.c b/vf.c
@@ -28,6 +28,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* faulting in characters as needed.
*/
+#include <err.h>
+
#include "font.h" /* struct font */
#include "xdvi.h"
#include "dvi.h"
@@ -144,7 +146,7 @@ read_VF_index(struct font *fontp, Boolean hushcs)
cc, m->dvi_adv, len);
}
if (cmnd != POST)
- oops("Wrong command byte found in VF macro list: %d", cmnd);
+ errx(1, "Wrong command byte found in VF macro list: %d", cmnd);
Fclose(VF_file);
fontp->file = NULL;
diff --git a/xdvi.c b/xdvi.c
@@ -767,8 +767,7 @@ compile_wheel_actions()
if (!compile_modifiers(&p, &wact)
|| !compile_evtype(&p, &wact.button))
- fprintf(stderr, "%s: syntax error in wheel translations\n",
- prog);
+ warnx("syntax error in wheel translations");
else if (compile_action(p, &wact.action) || wact.action != NULL) {
wactp = xmalloc(sizeof(struct wheel_acts));
*wactp = wact;
@@ -803,13 +802,7 @@ main(int argc, char **argv)
* Step 1: Process command-line options and resources.
*/
- prog = rindex(*argv, '/');
- if (prog != NULL)
- ++prog;
- else
- prog = *argv;
-
- top_level = XtInitialize(prog, "XDvi", options, XtNumber(options),
+ top_level = XtInitialize("wdvi", "XDvi", options, XtNumber(options),
&argc, argv);
XtAddActions(Actions, num_actions);
@@ -858,7 +851,7 @@ main(int argc, char **argv)
: DBG_ALL;
if (!XInternAtoms(DISP, atom_names, XtNumber(atom_names), False, atoms))
- oops("XInternAtoms failed.");
+ errx(1, "XInternAtoms failed.");
if (debug & DBG_CLIENT) {
for (i = 0; i < XtNumber(atom_names); ++i)
diff --git a/xdvi.h b/xdvi.h
@@ -253,7 +253,6 @@ Boolean dvi_file_ready = False;
/* done with font generation and prescanning */
Boolean titles_are_stale = True;
/* replace icon/window titles */
-const char *prog;
int bak_shrink; /* last shrink factor != 1 */
Dimension window_w, window_h;
XImage *image;