commit 82377970cffad8807cb4fae60a75be9f6fcf433c
parent f10d938dc6e9c9cc33164489aab32e6c139f78ef
Author: Kyle Milz <milz@macbook.0x30.net>
Date:   Tue, 18 Aug 2020 12:24:40 -0700
unifdef -DTOOLKIT=1
Remove any non TOOLKIT code as I will be using one exclusively.
Diffstat:
| M | dvi-draw.c |  |  | 16 | ---------------- | 
| M | dvi-init.c |  |  | 12 | ------------ | 
| M | events.c |  |  | 660 | +------------------------------------------------------------------------------ | 
| M | special.c |  |  | 2 | -- | 
| M | util.c |  |  | 2 | +- | 
| M | xdvi.c |  |  | 742 | +------------------------------------------------------------------------------ | 
| M | xdvi.h |  |  | 58 | +++------------------------------------------------------- | 
7 files changed, 6 insertions(+), 1486 deletions(-)
diff --git a/dvi-draw.c b/dvi-draw.c
@@ -806,7 +806,6 @@ spcl_scan(spcl_proc)
  *	`header=' and `!'.
  */
 
-#if TOOLKIT
 
 static	void	show_status ARGS((struct xtimer *));
 
@@ -842,17 +841,14 @@ show_status(arg)
 	simple_popup(psrp->pp, psrp->scanmsg, status_cb_destroy);
 }
 
-#endif /* TOOLKIT */
 
 void
 prescan()
 {
 	int	nextreportpage;
 	char	scanmsg[40];
-#if TOOLKIT
 	static	struct status_popup	popup	= {NULL, NULL, 0, False, False};
 	struct prescan_rec		pr;
-#endif
 
 	dvi_file_ready = False;
 
@@ -861,14 +857,12 @@ prescan()
 	  SEEK_SET);
 	currinf.pos = currinf.end = dvi_buffer;
 
-#if TOOLKIT
 	pr.timer_active = True;
 	pr.popup_active = False;
 	pr.pp = &popup;
 	pr.scanmsg = scanmsg;
 	psrp = ≺
 	set_timer(&pst, 1000);
-#endif
 	for (;;) {
 	    page_info[scanned_page + 1].pw = page_info[scanned_page].pw;
 	    page_info[scanned_page + 1].ph = page_info[scanned_page].ph;
@@ -934,15 +928,10 @@ prescan()
 	    if (scanned_page >= current_page) break;
 	}
 
-#if TOOLKIT
 	if (pr.popup_active)
 	    simple_popdown(&popup);
 	else if (pr.timer_active)
 	    cancel_timer(&pst);
-#else /* !TOOLKIT */
-	if (top_level != 0)
-	    XClearWindow(DISP, mane.win);
-#endif
 
 #if PS
 	if (!(ev_flags & EV_GE_NEWPAGE))
@@ -1634,13 +1623,8 @@ draw_page()
 #define	G_OFFSET_X	(offset_x << 16) + (3 << 15)
 #define	G_OFFSET_Y	(offset_y << 16) + (3 << 15)
 
-#if TOOLKIT
 # define mane_base_x	0
 # define mane_base_y	0
-#else
-# define mane_base_x	mane.base_x
-# define mane_base_y	mane.base_y
-#endif
 
 /*
  *	This set of routines can be called while draw_part() is active,
diff --git a/dvi-init.c b/dvi-init.c
@@ -768,7 +768,6 @@ form_dvi_property(inode)
 	memcpy(dvi_property + 8, p, len);
 }
 
-#if TOOLKIT
 	/* For non-toolkit compiles, this code appears in xdvi.c.  */
 
 static	void
@@ -811,7 +810,6 @@ set_titles()
 	titles_are_stale = False;
 }
 
-#endif
 
 
 /**
@@ -869,10 +867,8 @@ internal_init_dvi()
 	warn_spec_now = warn_spec;
 	source_fwd_box_page = -1;
 	init_prescan();
-#if TOOLKIT
 	if (titles_are_stale)
 	    set_titles();
-#endif
 	dvi_is_valid = True;
 	return True;
 }
@@ -901,7 +897,6 @@ set_dvi_property()
 	  8, PropModeReplace, dvi_property, dvi_property_length);
 }
 
-#if TOOLKIT
 
 static	Widget	dvi_popup = NULL;	/* warning popup for corrupt dvi file */
 
@@ -919,7 +914,6 @@ dvi_callback(w, client_data, call_data)
 	}
 }
 
-#endif /* TOOLKIT */
 
 /**
  **	Check for changes in dvi file.  Return True if it's OK.
@@ -969,7 +963,6 @@ reload_dvi_file()
 	full_reset_colors();
 #endif /* COLOR */
 	}
-#if TOOLKIT
 	if (dvi_popup != NULL) {
 	    int i;
 
@@ -987,7 +980,6 @@ reload_dvi_file()
 	    }
 	    dvi_popup = NULL;
 	}
-#endif /* TOOLKIT */
 	bzero((char *) tn_table, (int) sizeof(tn_table));
 	free_vf_chain(tn_head);
 	tn_head = NULL;
@@ -1012,16 +1004,12 @@ reload_dvi_file()
 	}
 	else {	/* if error */
 	    XClearWindow(DISP, mane.win);
-#if TOOLKIT
 	    dvi_popup = warning_popup_long(
 	      "Xdvi cannot read the DVI file\n%s\nReason:  %s",
 # if MOTIF
 	      XmDIALOG_ERROR,
 # endif
 	      "Reload", dvi_callback, dvi_name, dvi_oops_msg);
-#else /* no toolkit */
-	    showmessage(dvi_oops_msg);
-#endif
 	    if (dvi_file != NULL) {
 		Fclose(dvi_file);
 		dvi_file = NULL;
diff --git a/events.c b/events.c
@@ -32,7 +32,6 @@ NOTE:
 
 /* Xlib and Xutil are already included */
 
-#ifdef	TOOLKIT
 
 #ifdef	OLD_X11_TOOLKIT
 #include <X11/Atoms.h>
@@ -94,12 +93,6 @@ typedef	char	*XtPointer;
 
 #endif	/* XtSpecificationRelease */
 
-#else	/* not TOOLKIT */
-
-typedef	int		Position;
-#define	XtPending()	XPending(DISP)
-
-#endif	/* not TOOLKIT */
 
 #if HAVE_XKB_BELL_EXT
 # include <X11/XKBlib.h>
@@ -194,16 +187,14 @@ extern	int	errno;
 
 #define	fore_Pixel	resource._fore_Pixel
 #define	back_Pixel	resource._back_Pixel
-#ifdef	TOOLKIT
 extern	struct _resource	resource;
 #define	brdr_Pixel	resource._brdr_Pixel
-#endif	/* TOOLKIT */
 
 #define	clip_w	mane.width
 #define	clip_h	mane.height
 static	Position main_x, main_y;
 static	Position mag_x, mag_y, new_mag_x, new_mag_y;
-#if TOOLKIT && !MOTIF
+#if !MOTIF
 static	int	mag_conv_x, mag_conv_y;
 #else
 #define	mag_conv_x	0
@@ -236,7 +227,6 @@ static	void	xdvi_normal_exit();
 static	XColor		bg_Color;
 #endif
 
-#if TOOLKIT
 
 #define	ACTION_DECL(name)				\
 		void name ARGS((Widget, XEvent *, String *, Cardinal *))
@@ -248,16 +238,6 @@ static	XColor		bg_Color;
 			String *, params,		\
 			Cardinal *, num_params)
 
-#else /* not TOOLKIT */
-
-#define	ACTION_DECL(name)				\
-		void name ARGS((XEvent *))
-
-#define	ACTION(name)					\
-		void					\
-		name P1C(XEvent *, event)
-
-#endif /* not TOOLKIT */
 
 /* ARGSUSED */
 void
@@ -301,9 +281,6 @@ static ACTION_DECL(Act_set_gs_alpha);
 #if BUTTONS
 static ACTION_DECL(Act_set_expert_mode);
 #endif
-#if !TOOLKIT
-static ACTION_DECL(Act_redraw);
-#endif
 static ACTION_DECL(Act_reread_dvi_file);
 static ACTION_DECL(Act_discard_number);
 
@@ -311,16 +288,13 @@ static ACTION_DECL(Act_magnifier);
 static ACTION_DECL(Act_drag);
 static ACTION_DECL(Act_wheel);
 static ACTION_DECL(Act_hwheel);
-#if TOOLKIT
 static ACTION_DECL(Act_wheel_actions);
-#endif
 static ACTION_DECL(Act_motion);
 static ACTION_DECL(Act_release);
 ACTION_DECL(Act_source_special);
 ACTION_DECL(Act_show_source_specials);
 ACTION_DECL(Act_show_all_boxes);
 
-#if TOOLKIT
 
 XtActionsRec	Actions[]	= {
 	{"digit",		Act_digit},
@@ -817,78 +791,6 @@ set_button_panel_height(h)
 
 #endif /* BUTTONS */
 
-#else /* not TOOLKIT */
-
-static	Window	x_bar, y_bar;
-static	int	x_bgn, x_end, y_bgn, y_end;	/* scrollbar positions */
-
-static
-ACTION(Act_null)
-{
-}
-
-#if !GREY
-#define	Act_set_greyscaling	Act_null
-#endif
-
-#if !COLOR
-#define	Act_set_color		Act_null
-#endif
-
-#if !PS
-#define	Act_set_ps		Act_null
-#endif
-
-#if !PS_GS
-#define	Act_set_gs_alpha	Act_null
-#endif
-
-typedef	void	(*act_proc) ARGS((XEvent *));
-
-static	act_proc	actions[128]	= {
-		Act_null, Act_null, Act_null, Act_quit,		/* NUL, ^A-^C */
-		Act_quit, Act_null, Act_null, Act_null,		/* ^D-^G */
-		Act_up_or_previous, Act_null, Act_forward_page,
-		  Act_null,					/* ^H-^K */
-		Act_redraw, Act_forward_page, Act_null, Act_null, /* ^L-^O */
-		Act_show_display_attributes, Act_null, Act_null,
-		  Act_null,					/* ^P-^S */
-		Act_null, Act_null, Act_null, Act_null,		/* ^T-^W */
-		Act_null, Act_null, Act_null,
-		  Act_discard_number,				/* ^X-^Z, ESC */
-		Act_null, Act_null, Act_null, Act_null,		/* ^{\,],^,_} */
-		Act_down_or_next, Act_null, Act_null, Act_null,	/* SP,!,",# */
-		Act_null, Act_null, Act_null, Act_null,		/* $,%,&,' */
-		Act_null, Act_null, Act_null, Act_null,		/* (,),*,+ */
-		Act_null, Act_minus, Act_null, Act_null,	/* ,,-,.,/ */
-		Act_digit, Act_digit, Act_digit, Act_digit,	/* 0,1,2,3 */
-		Act_digit, Act_digit, Act_digit, Act_digit,	/* 4,5,6,7 */
-		Act_digit, Act_digit, Act_null, Act_null,	/* 8,9,:,; */
-		Act_null, Act_null, Act_null, Act_null,		/* <,=,>,? */
-		Act_null, Act_null, Act_null, Act_set_color,	/* @,A,B,C */
-		Act_null, Act_null, Act_null,
-		  Act_set_greyscaling,				/* D,E,F,G */
-		Act_null, Act_null, Act_null, Act_null,		/* H,I,J,K */
-		Act_null, Act_set_margins, Act_null, Act_null,	/* L,M,N,O */
-		Act_declare_page_number, Act_null,
-		  Act_reread_dvi_file, Act_set_density,		/* P,Q,R,S */
-		Act_null, Act_null, Act_set_gs_alpha, Act_null,	/* T,U,V,W */
-		Act_null, Act_null, Act_null, Act_null,		/* X,Y,Z,[ */
-		Act_null, Act_null, Act_home, Act_null,		/* \,],^,_ */
-		Act_null, Act_null, Act_back_page, Act_center,	/* `,a,b,c */
-		Act_down, Act_null, Act_forward_page,
-		  Act_goto_page,				/* d,e,f,g */
-		Act_null, Act_null, Act_null,
-		  Act_set_keep_flag,				/* h,i,j,k */
-		Act_left, Act_null, Act_forward_page, Act_null,	/* l,m,n,o */
-		Act_back_page, Act_quit, Act_right,
-		  Act_set_shrink_factor,			/* p,q,r,s */
-		Act_null, Act_up, Act_set_ps, Act_null,		/* t,u,v,w */
-		Act_null, Act_null, Act_null, Act_null,		/* x,y,z,{ */
-		Act_null, Act_null, Act_null, Act_up_or_previous,/* |,},~,DEL */
-};
-
-#endif /* not TOOLKIT */
 
 /*
  *	Mechanism to keep track of the magnifier window.  The problems are,
@@ -975,9 +877,6 @@ and may result in poor display quality.\n\
 \n\
 See the section ``GREYSCALING AND COLORMAPS''\n\
 in the xdvi manual page for more details.");
-#if !TOOLKIT
-	    fflush(stdout);	/* useful if called by netscape */
-#endif
 	}
 }
 
@@ -1674,7 +1573,6 @@ scrollwindow(windowrec, x0, y0)
 	}
 }
 
-#ifdef	TOOLKIT
 
 /*
  *	routines for X11 toolkit
@@ -1929,225 +1827,6 @@ reconfig()
 	get_geom();
 }
 
-#else	/* not TOOLKIT */
-
-/*
- *	brute force scrollbar routines
- */
-
-static	void
-paint_x_bar()
-{
-	int	new_x_bgn = mane.base_x * clip_w / page_w;
-	int	new_x_end = (mane.base_x + clip_w) * clip_w / page_w;
-
-	if (new_x_bgn >= x_end || x_bgn >= new_x_end) {	/* no overlap */
-	    XClearArea(DISP, x_bar, x_bgn, 1, x_end - x_bgn, BAR_WID, False);
-	    XFillRectangle(DISP, x_bar, copyGC,
-		new_x_bgn, 1, new_x_end - new_x_bgn, BAR_WID);
-	}
-	else {		/* this stuff avoids flicker */
-	    if (x_bgn < new_x_bgn)
-		XClearArea(DISP, x_bar, x_bgn, 1, new_x_bgn - x_bgn,
-		    BAR_WID, False);
-	    else
-		XFillRectangle(DISP, x_bar, copyGC,
-		    new_x_bgn, 1, x_bgn - new_x_bgn, BAR_WID);
-	    if (new_x_end < x_end)
-		XClearArea(DISP, x_bar, new_x_end, 1, x_end - new_x_end,
-		    BAR_WID, False);
-	    else
-		XFillRectangle(DISP, x_bar, copyGC,
-		    x_end, 1, new_x_end - x_end, BAR_WID);
-	}
-	x_bgn = new_x_bgn;
-	x_end = new_x_end;
-}
-
-static	void
-paint_y_bar()
-{
-	int	new_y_bgn = mane.base_y * clip_h / page_h;
-	int	new_y_end = (mane.base_y + clip_h) * clip_h / page_h;
-
-	if (new_y_bgn >= y_end || y_bgn >= new_y_end) {	/* no overlap */
-	    XClearArea(DISP, y_bar, 1, y_bgn, BAR_WID, y_end - y_bgn, False);
-	    XFillRectangle(DISP, y_bar, copyGC,
-		1, new_y_bgn, BAR_WID, new_y_end - new_y_bgn);
-	}
-	else {		/* this stuff avoids flicker */
-	    if (y_bgn < new_y_bgn)
-		XClearArea(DISP, y_bar, 1, y_bgn, BAR_WID, new_y_bgn - y_bgn,
-		    False);
-	    else
-		XFillRectangle(DISP, y_bar, copyGC,
-		    1, new_y_bgn, BAR_WID, y_bgn - new_y_bgn);
-	    if (new_y_end < y_end)
-		XClearArea(DISP, y_bar, 1, new_y_end,
-		    BAR_WID, y_end - new_y_end, False);
-	    else
-		XFillRectangle(DISP, y_bar, copyGC,
-		    1, y_end, BAR_WID, new_y_end - y_end);
-	}
-	y_bgn = new_y_bgn;
-	y_end = new_y_end;
-}
-
-static	void
-scrollmane(x, y)
-	int	x, y;
-{
-	int	old_base_x = mane.base_x;
-	int	old_base_y = mane.base_y;
-
-	if (x > (int) (page_w - clip_w)) x = page_w - clip_w;
-	if (x < 0) x = 0;
-	if (y > (int) (page_h - clip_h)) y = page_h - clip_h;
-	if (y < 0) y = 0;
-	scrollwindow(&mane, x, y);
-	if (old_base_x != mane.base_x && x_bar) paint_x_bar();
-	if (old_base_y != mane.base_y && y_bar) paint_y_bar();
-}
-
-void
-reconfig()
-{
-	int	x_thick = 0;
-	int	y_thick = 0;
-
-		/* determine existence of scrollbars */
-	if (window_w < page_w) x_thick = BAR_THICK;
-	if (window_h - x_thick < page_h) y_thick = BAR_THICK;
-	clip_w = window_w - y_thick;
-	if (clip_w < page_w) x_thick = BAR_THICK;
-	clip_h = window_h - x_thick;
-
-		/* process drawing (clip) window */
-	if (mane.win == (Window) 0) {	/* initial creation */
-	    XWindowAttributes attrs;
-
-	    mane.win = XCreateSimpleWindow(DISP, top_level, y_thick, x_thick,
-			(unsigned int) clip_w, (unsigned int) clip_h, 0,
-			brdr_Pixel, back_Pixel);
-	    XSelectInput(DISP, mane.win, ExposureMask |
-			ButtonPressMask | ButtonMotionMask | ButtonReleaseMask);
-	    (void) XGetWindowAttributes(DISP, mane.win, &attrs);
-	    backing_store = attrs.backing_store;
-	    XMapWindow(DISP, mane.win);
-	}
-	else
-	    XMoveResizeWindow(DISP, mane.win, y_thick, x_thick, clip_w, clip_h);
-
-		/* process scroll bars */
-	if (x_thick) {
-	    if (x_bar) {
-		XMoveResizeWindow(DISP, x_bar,
-		    y_thick - 1, -1, clip_w, BAR_THICK - 1);
-		paint_x_bar();
-	    }
-	    else {
-		x_bar = XCreateSimpleWindow(DISP, top_level, y_thick - 1, -1,
-				(unsigned int) clip_w, BAR_THICK - 1, 1,
-				brdr_Pixel, back_Pixel);
-		XSelectInput(DISP, x_bar,
-			ExposureMask | ButtonPressMask | Button2MotionMask);
-		XMapWindow(DISP, x_bar);
-	    }
-	    x_bgn = mane.base_x * clip_w / page_w;
-	    x_end = (mane.base_x + clip_w) * clip_w / page_w;
-	}
-	else
-	    if (x_bar) {
-		XDestroyWindow(DISP, x_bar);
-		x_bar = (Window) 0;
-	    }
-
-	if (y_thick) {
-	    if (y_bar) {
-		XMoveResizeWindow(DISP, y_bar,
-		    -1, x_thick - 1, BAR_THICK - 1, clip_h);
-		paint_y_bar();
-	    }
-	    else {
-		y_bar = XCreateSimpleWindow(DISP, top_level, -1, x_thick - 1,
-				BAR_THICK - 1, (unsigned int) clip_h, 1,
-				brdr_Pixel, back_Pixel);
-		XSelectInput(DISP, y_bar,
-			ExposureMask | ButtonPressMask | Button2MotionMask);
-		XMapWindow(DISP, y_bar);
-	    }
-	    y_bgn = mane.base_y * clip_h / page_h;
-	    y_end = (mane.base_y + clip_h) * clip_h / page_h;
-	}
-	else
-	    if (y_bar) {
-		XDestroyWindow(DISP, y_bar);
-		y_bar = (Window) 0;
-	    }
-}
-
-void
-home(scrl)
-	wide_bool	scrl;
-{
-	int	x = 0, y = 0;
-
-	if (page_w > clip_w) {
-	    x = (page_w - clip_w) / 2;
-	    if (x > home_x / mane.shrinkfactor)
-		x = home_x / mane.shrinkfactor;
-	}
-	if (page_h > clip_h) {
-	    y = (page_h - clip_h) / 2;
-	    if (y > home_y / mane.shrinkfactor)
-		y = home_y / mane.shrinkfactor;
-	}
-	if (scrl)
-	    scrollmane(x, y);
-	else {
-	    mane.base_x = x;
-	    mane.base_y = y;
-	    if (currwin.win == mane.win) {
-		currwin.base_x = x;
-		currwin.base_y = y;
-	    }
-	    if (x_bar) paint_x_bar();
-	    if (y_bar) paint_y_bar();
-	}
-}
-
-/*
- *	Same as home(), except move to the bottom of the page.
- */
-
-static	void
-home_bottom P1C(wide_bool, scrl)
-{
-	int	x = 0, y = 0;
-
-	if (page_w > clip_w) {
-	    x = (page_w - clip_w) / 2;
-	    if (x > home_x / mane.shrinkfactor)
-		x = home_x / mane.shrinkfactor;
-	}
-	if (page_h > clip_h)
-	    y = page_h - clip_h;
-	mane.base_x = x;
-	mane.base_y = y;
-	if (currwin.win == mane.win) {
-	    currwin.base_x = x;
-	    currwin.base_y = y;
-	}
-	if (x_bar) paint_x_bar();
-	if (y_bar) paint_y_bar();
-}
-
-#define	get_xy()
-#define	window_x 0
-#define	window_y 0
-#define	mane_base_x	mane.base_x
-#define	mane_base_y	mane.base_y
-#endif	/* not TOOLKIT */
 
 
 /*
@@ -2269,18 +1948,6 @@ popdown_callback(w, client_data, call_data)
 
 #endif /* MOTIF */
 
-#if !TOOLKIT
-
-void
-showmessage(message)
-	_Xconst	char	*message;
-{
-	get_xy();
-	XDrawImageString(DISP, mane.win, copyGC,
-	    5 - window_x, 5 + X11HEIGHT - window_y, message, strlen(message));
-}
-
-#endif /* not TOOLKIT */
 
 
 /* |||
@@ -2297,7 +1964,6 @@ static	Boolean	have_arg	= False;
 static	int	number		= 0;
 static	int	sign		= 1;
 
-#if TOOLKIT
 
 #define	GET_ARG4(arg, param, param2, default)		\
 		if (*num_params > 0)			\
@@ -2353,46 +2019,6 @@ static	int	sign		= 1;
 	    }								\
 	}
 
-#else /* not TOOLKIT */
-
-static	unsigned char	keychar;
-
-#define	GET_ARG4(arg, param, param2, default)		\
-		if (have_arg) {				\
-		    arg = (param2);			\
-		    have_arg = False;			\
-		    number = 0;				\
-		    sign = 1;				\
-		}					\
-		else					\
-		    {default}
-
-#define	GET_ARG(arg, default)				\
-		GET_ARG4(arg, NA, sign * number, arg = (default);)
-
-#define	GET_ARG6(arg, param, c, param_c, param2, default)\
-		if (have_arg) {				\
-		    arg = (param2);			\
-		    have_arg = False;			\
-		    number = 0;				\
-		    sign = 1;				\
-		}					\
-		else					\
-		    {default;}
-
-#define	TOGGLE(arg)					\
-		if (have_arg) {				\
-		    int	tmparg = number;		\
-							\
-		    have_arg = False;			\
-		    number = 0;				\
-		    sign = 1;				\
-							\
-		    if ((tmparg != 0) == arg)		\
-			return;				\
-		}
-
-#endif /* not TOOLKIT */
 
 
 static
@@ -2400,14 +2026,10 @@ ACTION(Act_digit)
 {
 	unsigned int	digit;
 
-#if TOOLKIT
 	if (*num_params != 1 || (digit = **params - '0') > 9) {
 	    XBell(DISP, 0);
 	    return;
 	}
-#else
-	digit = keychar - '0';
-#endif
 	have_arg = True;
 	number = number * 10 + digit;
 }
@@ -2522,7 +2144,6 @@ ACTION(Act_center)
 	    return;		/* button actions do not provide events */
 #endif
 
-#if TOOLKIT
 #if !MOTIF
 
 	x = event->xkey.x - clip_w / 2;
@@ -2547,18 +2168,6 @@ ACTION(Act_center)
 	  -x - window_x, -y - window_y);
 
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-
-	x = clip_w / 2 - event->xkey.x;
-	if (x > mane.base_x) x = mane.base_x;
-	y = clip_h / 2 - event->xkey.y;
-	if (y > mane.base_y) y = mane.base_y;
-	scrollwindow(&mane, mane.base_x - x, mane.base_y - y);
-	if (x_bar) paint_x_bar();
-	if (y_bar) paint_y_bar();
-	XWarpPointer(DISP, None, None, 0, 0, 0, 0, x, y);
-
-#endif /* not TOOLKIT */
 
 }
 
@@ -2566,9 +2175,7 @@ static
 ACTION(Act_set_keep_flag)
 {
 
-#if TOOLKIT
 	if (*num_params == 0) {
-#endif
 	    if (have_arg) {
 		resource.keep_flag = (number != 0);
 		have_arg = False;
@@ -2577,19 +2184,16 @@ ACTION(Act_set_keep_flag)
 	    }
 	    else
 		resource.keep_flag = !resource.keep_flag;
-#if TOOLKIT
 	}
 	else
 	    resource.keep_flag = (**params == 't'
 	      ? !resource.keep_flag
 	      : atoi(*params));
-#endif
 }
 
 static
 ACTION(Act_left)
 {
-#if TOOLKIT
 #if !MOTIF
 	if (x_bar != NULL)
 	    XtCallCallbacks(x_bar, XtNscrollProc,
@@ -2603,18 +2207,11 @@ ACTION(Act_left)
 	  : (int) (-atof(*params) * clip_w)) - window_x,
 	  (int) (page_w - clip_w));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	if (mane.base_x > 0)
-	    scrollmane(mane.base_x - 2 * (int) clip_w / 3, mane.base_y);
-	else
-	    XBell(DISP, 0);
-#endif /* not TOOLKIT */
 }
 
 static
 ACTION(Act_right)
 {
-#if TOOLKIT
 #if !MOTIF
 	if (x_bar != NULL)
 	    XtCallCallbacks(x_bar, XtNscrollProc,
@@ -2628,18 +2225,11 @@ ACTION(Act_right)
 	  : (int) (atof(*params) * clip_w)) - window_x,
 	  (int) (page_w - clip_w));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	if (mane.base_x < (int) page_w - (int) clip_w)
-	    scrollmane(mane.base_x + 2 * (int) clip_w / 3, mane.base_y);
-	else
-	    XBell(DISP, 0);
-#endif /* not TOOLKIT */
 }
 
 static
 ACTION(Act_up)
 {
-#if TOOLKIT
 #if !MOTIF
 	if (y_bar != NULL)
 	    XtCallCallbacks(y_bar, XtNscrollProc,
@@ -2653,18 +2243,11 @@ ACTION(Act_up)
 	  : (int) (-atof(*params) * clip_h)) - window_y,
 	  (int) (page_h - clip_h));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	if (mane.base_y > 0)
-	    scrollmane(mane.base_x, mane.base_y - 2 * (int) clip_h / 3);
-	else
-	    XBell(DISP, 0);
-#endif /* not TOOLKIT */
 }
 
 static
 ACTION(Act_down)
 {
-#if TOOLKIT
 #if !MOTIF
 	if (y_bar != NULL)
 	    XtCallCallbacks(y_bar, XtNscrollProc,
@@ -2678,19 +2261,12 @@ ACTION(Act_down)
 	  : (int) (atof(*params) * clip_h)) - window_y,
 	  (int) (page_h - clip_h));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	if (mane.base_y < (int) page_h - (int) clip_h)
-	    scrollmane(mane.base_x, mane.base_y + 2 * (int) clip_h / 3);
-	else
-	    XBell(DISP, 0);
-#endif /* not TOOLKIT */
 }
 
 static
 ACTION(Act_down_or_next)
 {
 	if (!resource.keep_flag) {
-#if TOOLKIT
 #if !MOTIF
 	    if (y_bar != NULL) {
 		get_xy();
@@ -2712,12 +2288,6 @@ ACTION(Act_down_or_next)
 		return;
 	    }
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	    if (mane.base_y < (int) page_h - (int) clip_h) {
-		scrollmane(mane.base_x, mane.base_y + 2 * (int) clip_h / 3);
-		return;
-	    }
-#endif /* not TOOLKIT */
 	} /* !keep_flag */
 
 	if (current_page < total_pages - 1) {
@@ -2736,7 +2306,6 @@ static
 ACTION(Act_up_or_previous)
 {
 	if (!resource.keep_flag) {
-#if TOOLKIT
 #if !MOTIF
 	    if (y_bar != NULL) {
 		get_xy();
@@ -2758,12 +2327,6 @@ ACTION(Act_up_or_previous)
 		return;
 	    }
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	    if (mane.base_y > 0) {
-		scrollmane(mane.base_x, mane.base_y - 2 * (int) clip_h / 3);
-		return;
-	    }
-#endif /* not TOOLKIT */
 	} /* !keep_flag */
 
 	if (current_page > 0) {
@@ -3104,16 +2667,6 @@ ACTION(Act_set_expert_mode)
 
 #endif /* BUTTONS */
 
-#if !TOOLKIT
-
-static
-ACTION(Act_redraw)
-{
-	ev_flags |= EV_NEWPAGE;
-	XFlush(DISP);
-}
-
-#endif /* not TOOLKIT */
 
 static
 ACTION(Act_reread_dvi_file)
@@ -3169,8 +2722,6 @@ ACTION(Act_magnifier)
 	XSetWindowAttributes	attr;
 #if XAW
 	Window			throwaway;
-#elif !TOOLKIT
-	struct mg_size_rec	*size_ptr = mg_size + event->xbutton.button - 1;
 #endif
 
 
@@ -3201,7 +2752,6 @@ ACTION(Act_magnifier)
 	    return;
 #endif
 
-#if TOOLKIT
 
 	if (event->type != ButtonPress || mouse_release != null_mouse
 	  || alt.win != (Window) 0 || mane.shrinkfactor == 1
@@ -3238,18 +2788,6 @@ ACTION(Act_magnifier)
 	  0, 0, &mag_conv_x, &mag_conv_y, &throwaway);
 #endif
 
-#else /* not TOOLKIT */
-
-	if (mouse_release != null_mouse || alt.win != (Window) 0
-	  || mane.shrinkfactor == 1 || size_ptr->w <= 0) {
-	    XBell(DISP, 0);
-	    return;
-	}
-
-	alt.width = size_ptr->w;
-	alt.height = size_ptr->h;
-
-#endif /* not TOOLKIT */
 
 	mag_x = event->xbutton.x + mag_conv_x;
 	mag_y = event->xbutton.y + mag_conv_y;
@@ -3347,7 +2885,6 @@ ACTION(Act_drag)
 	if (mouse_release != null_mouse && mouse_release != drag_release)
 	    return;
 
-#if TOOLKIT
 
 	if (*num_params != 1) return;
 	switch (**params) {
@@ -3357,14 +2894,6 @@ ACTION(Act_drag)
 	    default:   return;
 	}
 
-#else /* not TOOLKIT */
-
-	drag_flags = event->xbutton.button;
-	if (drag_flags <= 0 || drag_flags > 3)
-	    return;
-	drag_flags = drag_flags ^ (drag_flags >> 1);
-
-#endif /* not TOOLKIT */
 
 	if (mouse_release == null_mouse) {
 	    mouse_motion = drag_motion;
@@ -3404,7 +2933,6 @@ drag_motion P1C(XEvent *, event)
 #endif
 
 	if (drag_flags & 2) {	/* if horizontal motion */
-#if TOOLKIT
 #if !MOTIF
 	    if (x_bar != NULL)
 		XtCallCallbacks(x_bar, XtNscrollProc,
@@ -3415,15 +2943,10 @@ drag_motion P1C(XEvent *, event)
 	      drag_last_x - event->xbutton.x_root - window_x,
 	      (int) (page_w - clip_w));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	    scrollmane(mane.base_x + drag_last_x - event->xbutton.x_root,
-	      mane.base_y);
-#endif /* not TOOLKIT */
 	    drag_last_x = event->xbutton.x_root;
 	}
 
 	if (drag_flags & 1) {	/* if vertical motion */
-#if TOOLKIT
 #if !MOTIF
 	    if (y_bar != NULL)
 		XtCallCallbacks(y_bar, XtNscrollProc,
@@ -3434,10 +2957,6 @@ drag_motion P1C(XEvent *, event)
 	      drag_last_y - event->xbutton.y_root - window_y,
 	      (int) (page_h - clip_h));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	    scrollmane(mane.base_x,
-	      mane.base_y + drag_last_y - event->xbutton.y_root);
-#endif /* not TOOLKIT */
 	    drag_last_y = event->xbutton.y_root;
 	}
 }
@@ -3464,7 +2983,6 @@ static	int	wheel_button	= -1;
 static
 ACTION(Act_wheel)
 {
-#if TOOLKIT
 	int	dist;
 
 	if (*num_params == 0) {
@@ -3480,15 +2998,8 @@ ACTION(Act_wheel)
 	get_xy();
 	(void) set_bar_value(y_bar, dist - window_y, (int) (page_h - clip_h));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	scrollmane(mane.base_x,
-	  mane.base_y + (event->xbutton.button == 5
-	  ? resource.wheel_unit : -resource.wheel_unit));
-#endif /* not TOOLKIT */
 
-#if TOOLKIT
 	if (event != NULL)
-#endif
 	    wheel_button = event->xbutton.button;
 }
 
@@ -3497,7 +3008,6 @@ static	int	wheel_h_button	= -1;
 static
 ACTION(Act_hwheel)
 {
-#if TOOLKIT
 	int	dist;
 
 	if (*num_params == 0) {
@@ -3513,19 +3023,11 @@ ACTION(Act_hwheel)
 	get_xy();
 	(void) set_bar_value(x_bar, dist - window_x, (int) (page_w - clip_w));
 #endif /* MOTIF */
-#else /* not TOOLKIT */
-	scrollmane(mane.base_x + (event->xbutton.button == 7
-	  ? resource.wheel_unit : -resource.wheel_unit),
-	  mane.base_y);
-#endif /* not TOOLKIT */
 
-#if TOOLKIT
 	if (event != NULL)
-#endif
 	    wheel_h_button = event->xbutton.button;
 }
 
-#if TOOLKIT
 static
 ACTION(Act_wheel_actions)
 {
@@ -3552,12 +3054,10 @@ ACTION(Act_wheel_actions)
 		}
 	    }
 }
-#endif /* TOOLKIT */
 
 
 /* Internal mouse actions.  */
 
-#if TOOLKIT
 
 static
 ACTION(Act_motion)
@@ -3584,7 +3084,6 @@ ACTION(Act_release)
 	mouse_release(event);
 }
 
-#endif /* TOOLKIT */
 
 
 /* Actions for source specials.  */
@@ -3651,7 +3150,6 @@ ACTION(Act_show_all_boxes)
 #undef	TOGGLE
 
 
-#if TOOLKIT
 
 	/*ARGSUSED*/
 void
@@ -3679,21 +3177,15 @@ handle_expose(widget, closure, ev, cont)
 }
 
 #undef	event
-#endif	/* TOOLKIT */
 
 
 void
-#if TOOLKIT
 /* ARGSUSED */
 handle_property_change(widget, junk, ev, cont)
 	Widget	widget;
 	XtPointer junk;
 	XEvent	*ev;
 	Boolean	*cont;		/* unused */
-#else /* !TOOLKIT */
-handle_property_change(ev)
-	XEvent *ev;
-#endif
 #define	event	(&(ev->xproperty))
 {
 	char	*src_goto_property;
@@ -4559,7 +4051,6 @@ read_events(ret_mask)
 		}
 	    }
 
-#if TOOLKIT
 
 	    XtNextEvent(&event);
 	    if (resized) get_geom();
@@ -4570,153 +4061,6 @@ read_events(ret_mask)
 	    }
 	    (void) XtDispatchEvent(&event);
 
-#else /* not TOOLKIT */
-
-	    XNextEvent(DISP, &event);
-	    if (event.xany.window == mane.win || event.xany.window == alt.win) {
-		struct WindowRec *wr = &mane;
-
-		if (event.xany.window == alt.win) {
-		    wr = &alt;
-		    /* check in case we already destroyed the window */
-		    if (alt_stat < 0) { /* destroy upon exposure */
-			alt_stat = 0;
-			mag_release(&event);
-			continue;
-		    }
-		    else
-			alt_stat = 0;
-		}
-		switch (event.type) {
-		case GraphicsExpose:
-		case Expose:
-		    expose(wr, event.xexpose.x, event.xexpose.y,
-			event.xexpose.width, event.xexpose.height);
-		    break;
-
-		case ButtonPress:
-		    if (resource.wheel_unit != 0 && (event.xbutton.button == 4
-		      || event.xbutton.button == 5))
-			Act_wheel(&event);
-		    else if (resource.wheel_unit != 0
-		      && (event.xbutton.button == 6
-		      || event.xbutton.button == 7))
-			Act_hwheel(&event);
-		    else if (event.xbutton.state & ControlMask) {
-			switch (event.xbutton.button) {
-			    case 1:  Act_source_special(&event); break;
-			    case 2:  Act_show_source_specials(&event); break;
-			    case 3:  Act_show_all_boxes(&event); break;
-			}
-		    }
-		    else if (event.xbutton.state & ShiftMask)
-			Act_drag(&event);
-		    else
-			Act_magnifier(&event);
-		    break;
-
-		case MotionNotify:
-		    mouse_motion(&event);
-		    break;
-
-		case ButtonRelease:
-		    if (event.xbutton.button == wheel_button)
-			wheel_button = -1;
-		    else if (event.xbutton.button == wheel_h_button)
-			wheel_h_button = -1;
-		    else
-			mouse_release(&event);
-		    break;
-		}	/* end switch */
-	    }	/* end if window == {mane,alt}.win */
-
-	    else if (event.xany.window == x_bar) {
-		if (event.type == Expose)
-		    XFillRectangle(DISP, x_bar, copyGC,
-			x_bgn, 1, x_end - x_bgn, BAR_WID);
-		else if (event.type == MotionNotify)
-		    scrollmane(event.xmotion.x * page_w / clip_w,
-			mane.base_y);
-		else switch (event.xbutton.button)
-		{
-		    case 1:
-			scrollmane(mane.base_x + event.xbutton.x, mane.base_y);
-			break;
-		    case 2:
-			scrollmane(event.xbutton.x * page_w / clip_w,
-			    mane.base_y);
-			break;
-		    case 3:
-			scrollmane(mane.base_x - event.xbutton.x, mane.base_y);
-		}
-	    }
-
-	    else if (event.xany.window == y_bar) {
-		if (event.type == Expose)
-		    XFillRectangle(DISP, y_bar, copyGC,
-			1, y_bgn, BAR_WID, y_end - y_bgn);
-		else if (event.type == MotionNotify)
-		    scrollmane(mane.base_x,
-			event.xmotion.y * page_h / clip_h);
-		else switch (event.xbutton.button)
-		{
-		    case 1:
-			scrollmane(mane.base_x, mane.base_y + event.xbutton.y);
-			break;
-		    case 2:
-			scrollmane(mane.base_x,
-			    event.xbutton.y * page_h / clip_h);
-			break;
-		    case 3:
-			scrollmane(mane.base_x, mane.base_y - event.xbutton.y);
-		}
-	    }
-
-	    else if (event.xany.window == top_level)
-		switch (event.type) {
-		case ConfigureNotify:
-		    if (event.xany.window == top_level &&
-			(event.xconfigure.width != window_w ||
-			event.xconfigure.height != window_h)) {
-			    Window old_mane_win = mane.win;
-
-			    window_w = event.xconfigure.width;
-			    window_h = event.xconfigure.height;
-			    reconfig();
-			    if (old_mane_win == (Window) 0) {
-				ev_flags |= EV_NEWPAGE;
-				home_action = home;
-			    }
-		    }
-		    break;
-
-		case MapNotify:		/* if running w/o WM */
-		    if (mane.win == (Window) 0) {
-			reconfig();
-			ev_flags |= EV_NEWPAGE;
-			home_action = home;
-		    }
-		    break;
-
-		case KeyPress:
-		    {
-#define			TRSIZE	4
-
-			char	trbuf[TRSIZE];
-
-			if (XLookupString(&event.xkey, trbuf, TRSIZE,
-			  (KeySym *) NULL, (XComposeStatus *) NULL) == 1
-			  && (keychar = *trbuf) < 128)
-			    (actions[keychar])(&event);
-		    }
-		    break;
-
-		case PropertyNotify:
-		    handle_property_change(&event);
-		    break;
-		}
-
-#endif	/* not TOOLKIT */
 
 	}
 }
@@ -4800,12 +4144,10 @@ redraw_page()
 		    return;
 	    }
 #endif
-#if TOOLKIT
 	    /* This discards the expose event generated by home() */
 	    if (read_events(EV_NOWAIT) & EV_GE_NEWPAGE)
 		return;
 	    can_exposures(&mane);
-#endif
 	}
 
 #if COLOR
diff --git a/special.c b/special.c
@@ -696,13 +696,11 @@ static	int		XDviIOErrorHandler P1C(Display *, disp)
 void
 ps_init_paths()
 {
-#if TOOLKIT
 	static	Boolean	done_already	= False;
 
 	if (done_already)
 	    return;
 	done_already = True;
-#endif
 
 #if	CFGFILE
 
diff --git a/util.c b/util.c
@@ -278,7 +278,7 @@ xmemdup(str, len)
 #endif /* not KPATHSEA */
 
 
-#if TOOLKIT && !HAVE_STRERROR && !defined strerror
+#if !HAVE_STRERROR && !defined strerror
 
 /*
  *	Replacement of system routine.
diff --git a/xdvi.c b/xdvi.c
@@ -130,7 +130,6 @@ extern	double	atof ARGS((_Xconst char *));
 #include <X11/keysym.h>
 #include "xdvi.icon"
 
-#ifdef	TOOLKIT
 
 #ifdef	OLD_X11_TOOLKIT
 #include <X11/Atoms.h>
@@ -212,11 +211,6 @@ typedef struct _LateBindings {
 
 # endif /* HAVE_X11_INTRINSICI_H */
 
-#else	/* not TOOLKIT */
-
-typedef	int		Position;
-
-#endif	/* not TOOLKIT */
 
 #if XlibSpecificationRelease < 5
 typedef	char		*XPointer;
@@ -298,17 +292,10 @@ static	Dimension	bwidth	= 2;
 
 #define	fore_Pixel	resource._fore_Pixel
 #define	back_Pixel	resource._back_Pixel
-#ifdef	TOOLKIT
 struct _resource	resource;
 #define	brdr_Pixel	resource._brdr_Pixel
 #define	hl_Pixel	resource._hl_Pixel
 #define	cr_Pixel	resource._cr_Pixel
-#else /* not TOOLKIT */
-static	_Xconst char	*brdr_color;
-static	_Xconst char	*high_color;
-static	_Xconst char	*curs_color;
-static	Pixel		hl_Pixel, cr_Pixel;
-#endif	/* not TOOLKIT */
 
 XColor	cr_Color;
 
@@ -323,7 +310,6 @@ struct WindowRec alt	= {(Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0};
 struct WindowRec currwin= {(Window) 0, 1, 0, 0, 0, 0, MAXDIM, 0, MAXDIM, 0};
 
 #ifdef	lint
-#ifdef	TOOLKIT
 WidgetClass	widgetClass;
 #ifndef MOTIF
 WidgetClass	viewportWidgetClass;
@@ -337,13 +323,10 @@ WidgetClass	xmFormWidgetClass, xmBulletinBoardWidgetClass;
 WidgetClass	xmPushButtonWidgetClass;
 #endif	/* BUTTONS */
 #endif /* MOTIF */
-#endif	/* TOOLKIT */
 #endif	/* lint */
 
 static	char *	atom_names[]	= {"XDVI WINDOWS", "DVI NAME", "SRC GOTO",
-#if TOOLKIT
 				   "WM_DELETE_WINDOW",
-#endif
 #if XAW
 				   "WM_PROTOCOLS",
 #endif
@@ -363,7 +346,6 @@ static	_Xconst char	*subst_val[] = {
 #endif
 					"-mgs[n] <size>"};
 
-#ifdef	TOOLKIT
 
 static	XrmOptionDescRec	options[] = {
 {"-s",		".shrinkFactor", XrmoptionSepArg,	(XPointer) NULL},
@@ -963,243 +945,6 @@ static	Arg	form_args[] = {
 };
 #endif
 
-#else	/* not TOOLKIT */
-
-static	char	*display;
-static	char	*geometry;
-static	char	*margins;
-static	char	*offsets;
-static	Boolean	hush;
-static	Boolean	iconic	= False;
-
-#define	ADDR(x)	(XPointer) &resource.x
-
-static	struct option {
-	_Xconst	char	*name;
-	_Xconst	char	*resource;
-	enum {FalseArg, TrueArg, StickyArg, SepArg}
-			argclass;
-	enum {BooleanArg, Bool3Arg, StringArg, NumberArg, FloatArg}
-			argtype;
-	int		classcount;
-	_Xconst	char	*usagestr;
-	XPointer	address;
-}	options[] = {
-{"+",		NULL,		StickyArg, StringArg, 1,
-  NULL,		(XPointer) &curr_page},
-{"-s",		"shrinkFactor", SepArg, NumberArg, 1,
-  "shrink",	(XPointer) &shrink_factor},
-#ifndef VMS
-{"-S",		NULL,		SepArg, NumberArg, 2,
-  "density",	ADDR(_density)},
-{"-density",	"densityPercent", SepArg, NumberArg, 1,
-  silent,	ADDR(_density)},
-#else
-{"-density",	"densityPercent", SepArg, NumberArg, 1,
-  "density",	ADDR(_density)},
-#endif
-#if COLOR
-{"-nocolor",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(_use_color)},
-{"+nocolor",	"color",	TrueArg, BooleanArg, 1,
-  NULL,		ADDR(_use_color)},
-#endif
-#ifdef	GREY
-{"-nogrey",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(_use_grey)},
-{"+nogrey",	"grey",		TrueArg, BooleanArg, 1,
-  NULL,		ADDR(_use_grey)},
-{"-gamma",	"gamma",	SepArg,	FloatArg, 1,
-  "g",		ADDR(_gamma)},
-{"-install",	NULL,		TrueArg, Bool3Arg, 2,
-  NULL,		ADDR(install)},
-{"-noinstall",	"install",	FalseArg, Bool3Arg, 1,
-  NULL,		ADDR(install)},
-#endif
-{"-p",		"pixelsPerInch", SepArg, NumberArg, 1,
-  "pixels",	ADDR(_pixels_per_inch)},
-{"-margins",	"Margin",	SepArg,	StringArg, 3,
-  "dimen",	(XPointer) &margins},
-{"-sidemargin",	"sideMargin",	SepArg,	StringArg, 1,
-  "dimen",	ADDR(sidemargin)},
-{"-topmargin",	"topMargin",	SepArg,	StringArg, 1,
-  "dimen",	ADDR(topmargin)},
-{"-offsets",	"Offset",	SepArg,	StringArg, 3,
-  "dimen",	(XPointer) &offsets},
-{"-xoffset",	"xOffset",	SepArg,	StringArg, 1,
-  "dimen",	ADDR(xoffset)},
-{"-yoffset",	"yOffset",	SepArg,	StringArg, 1,
-  "dimen",	ADDR(yoffset)},
-{"-paper",	"paper",	SepArg,	StringArg, 1,
-  "papertype",	ADDR(paper)},
-{"-altfont",	"altFont",	SepArg,	StringArg, 1,
-  "font",	ADDR(_alt_font)},
-#ifdef MKTEXPK
-{"-nomakepk",	"makePk",	FalseArg, BooleanArg, 2,
-  NULL,		ADDR(makepk)},
-{"+nomakepk",	"makePk",	TrueArg, BooleanArg, 1,
-  NULL,		ADDR(makepk)},
-#endif
-{"-mfmode",	"mfMode",	SepArg,	StringArg, 1,
-  "mode-def",	ADDR(mfmode)},
-{"-editor",	"editor",	SepArg,	StringArg, 1,
-  "editor",	ADDR(editor)},
-{"-sourceposition","sourcePosition", SepArg, StringArg, 1,
-  "\"linenumber filename\"",ADDR(src_pos)},
-{"-nofork",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(src_fork)},
-{"+nofork",	"fork",		TrueArg, BooleanArg, 1,
-  NULL,		ADDR(src_fork)},
-{"-l",		NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(_list_fonts)},
-{"+l",		"listFonts",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(_list_fonts)},
-#if FREETYPE
-{"-nofreetypefonts", NULL,	FalseArg, BooleanArg, 2,
-  NULL,		ADDR(freetype)},
-{"+nofreetypefonts", "freetypeFonts", TrueArg, BooleanArg, 1,
-  NULL,		ADDR(freetype)},
-#endif
-{"-rv",		NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(reverse)},
-{"+rv",		"reverseVideo",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(reverse)},
-{"-mgs",	NULL,		SepArg, StringArg, 2,
-  subst,	ADDR(mg_arg[0])},
-{"-mgs1",	"magnifierSize1",SepArg, StringArg, 1,
-  silent,	ADDR(mg_arg[0])},
-{"-mgs2",	"magnifierSize2",SepArg, StringArg, 1,
-  silent,	ADDR(mg_arg[1])},
-{"-mgs3",	"magnifierSize3",SepArg, StringArg, 1,
-  silent,	ADDR(mg_arg[2])},
-{"-mgs4",	"magnifierSize4",SepArg, StringArg, 1,
-  silent,	ADDR(mg_arg[3])},
-{"-mgs5",	"magnifierSize5",SepArg, StringArg, 1,
-  silent,	ADDR(mg_arg[4])},
-{"-warnspecials", NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(_warn_spec)},
-{"+warnspecials", "warnSpecials", FalseArg, BooleanArg, 1,
-  NULL,		ADDR(_warn_spec)},
-{"-hush",	NULL,		TrueArg, BooleanArg, 6,
-  NULL,		(XPointer) &hush},
-{"+hush",	"Hush",		FalseArg, BooleanArg, 5,
-  NULL,		(XPointer) &hush},
-{"-hushchars",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(_hush_chars)},
-{"+hushchars",	"hushLostChars", FalseArg, BooleanArg, 1,
-  NULL,		ADDR(_hush_chars)},
-{"-hushchecksums", NULL,	TrueArg, BooleanArg, 2,
-  NULL,		ADDR(_hush_chk)},
-{"+hushchecksums","hushChecksums", FalseArg, BooleanArg, 1,
-  NULL,		ADDR(_hush_chk)},
-{"-safer",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(safer)},
-{"+safer",	"safer",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(safer)},
-{"-bw",		NULL,		SepArg,	NumberArg, 2,
-  "width",	(XPointer) &bwidth},
-{"-borderwidth", "borderWidth",	SepArg,	NumberArg, 1,
-  silent,	(XPointer) &bwidth},
-{"-fg",		NULL,		SepArg,	StringArg, 2,
-  "color",	ADDR(fore_color)},
-{"-foreground",	"foreground",	SepArg,	StringArg, 1,
-  silent,	ADDR(fore_color)},
-{"-bg",		NULL,		SepArg,	StringArg, 2,
-  "color",	ADDR(back_color)},
-{"-background",	"background",	SepArg,	StringArg, 1,
-  silent,	ADDR(back_color)},
-{"-hl",		"highlight",	SepArg,	StringArg, 1,
-  "color",	(XPointer) &high_color},
-{"-bd",		NULL,		SepArg,	StringArg, 2,
-  "color",	(XPointer) &brdr_color},
-{"-bordercolor","borderColor",	SepArg,	StringArg, 1,
-  silent,	(XPointer) &brdr_color},
-{"-cr",		"cursorColor",	SepArg,	StringArg, 1,
-  "color",	(XPointer) &curs_color},
-#ifndef VMS
-{"-display",	NULL,		SepArg,	StringArg, 1,
-  "host:display", (XPointer) &display},
-#else
-{"-display",	NULL,		SepArg,	StringArg, 1,
-  "host::display", (XPointer) &display},
-#endif
-{"-geometry",	"geometry",	SepArg,	StringArg, 1,
-  "geometry",	(XPointer) &geometry},
-{"-icongeometry","iconGeometry",StickyArg, StringArg, 1,
-  "geometry",	ADDR(icon_geometry)},
-{"-iconic",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		(XPointer) &iconic},
-{"+iconic",	"iconic",	FalseArg, BooleanArg, 1,
-  NULL,		(XPointer) &iconic},
-{"-keep",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(keep_flag)},
-{"+keep",	"keepPosition",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(keep_flag)},
-{"-copy",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(copy)},
-{"+copy",	"copy",		FalseArg, BooleanArg, 1,
-  NULL,		ADDR(copy)},
-{"-thorough",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(thorough)},
-{"+thorough",	"thorough",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(thorough)},
-{"-wheelunit",	"wheelUnit",	SepArg,	NumberArg, 1,
-  "pixels",	ADDR(wheel_unit)},
-#if PS
-{"-nopostscript", NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(_postscript)},
-{"+nopostscript", "postscript",	TrueArg, BooleanArg, 1,
-  NULL,		ADDR(_postscript)},
-{"-allowshell",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(allow_shell)},
-{"+allowshell",	"allowShell",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(allow_shell)},
-#ifdef	PS_DPS
-{"-nodps",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(useDPS)},
-{"+nodps",	"dps",		TrueArg, BooleanArg, 1,
-  NULL,		ADDR(useDPS)},
-#endif
-#ifdef	PS_NEWS
-{"-nonews",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(useNeWS)},
-{"+nonews",	"news",		TrueArg, BooleanArg, 1,
-  NULL,		ADDR(useNeWS)},
-#endif
-#ifdef	PS_GS
-{"-noghostscript",NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(useGS)},
-{"+noghostscript","ghostscript", TrueArg, BooleanArg, 1,
-  NULL,		ADDR(useGS)},
-{"-nogssafer",	NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(gs_safer)},
-{"+nogssafer",	"gsSafer",	TrueArg, BooleanArg, 1,
-  NULL,		ADDR(gs_safer)},
-{"-gsalpha",	NULL,		TrueArg, BooleanArg, 2,
-  NULL,		ADDR(gs_alpha)},
-{"+gsalpha",	"gsAlpha",	FalseArg, BooleanArg, 1,
-  NULL,		ADDR(gs_alpha)},
-{"-interpreter", "interpreter",	SepArg,	StringArg, 1,
-  "path",	ADDR(gs_path)},
-{"-gspalette",	"palette",	SepArg,	StringArg, 1,
-  "monochrome|grayscale|color",	ADDR(gs_palette)},
-#endif
-#endif	/* PS */
-{"-noscan", NULL,		FalseArg, BooleanArg, 2,
-  NULL,		ADDR(prescan)},
-{"+noscan",	"prescan",	TrueArg, BooleanArg, 1,
-  NULL,		ADDR(prescan)},
-{"-debug",	"debugLevel",	SepArg,	StringArg, 1,
-  "bitmask",	ADDR(debug_arg)},
-{"-version",	NULL,		TrueArg, BooleanArg, 3,
-  NULL,		ADDR(version_flag)},
-{"+version",	"version",	FalseArg, BooleanArg, 2,
-  NULL,		ADDR(version_flag)},
-{"--version",	NULL,		TrueArg, BooleanArg, 1,
-  NULL,		ADDR(version_flag)},
-};
-
-#endif	/* not TOOLKIT */
 
 static	void	usage VARGS((_Xconst char *, ...)) NORETURN;
 
@@ -1217,12 +962,8 @@ usage(va_alist)
 	_Xconst char *message;
 #endif
 	va_list	args;
-#if TOOLKIT
 	XrmOptionDescRec *opt;
 	_Xconst	char	**usageptr = usagestr;
-#else
-	struct option	*opt;
-#endif
 	_Xconst char	**sv	= subst_val;
 	_Xconst char	*str1;
 	_Xconst char	*str2;
@@ -1242,7 +983,6 @@ usage(va_alist)
 
 	Fputs("\n\nUsage: xdvi [+[<page>]]", stderr);
 	for (opt = options; opt < options + XtNumber(options); ++opt) {
-#if TOOLKIT
 	    str1 = opt->option;
 	    if (*str1 != '-') continue;
 	    str2 = NULL;
@@ -1273,27 +1013,6 @@ usage(va_alist)
 		str1 = *usageptr++;
 		str2 = NULL;
 	    }
-#else /* not TOOLKIT */
-	    str1 = opt->name;
-	    str2 = opt->usagestr;
-	    if (*str1 != '-' || str2 == silent) continue;
-	    if (str2 == subst) {
-		str1 = *sv++;
-		str2 = NULL;
-	    }
-	    n = strlen(str1) + 3;
-	    if (str2 != NULL) n += strlen(str2) + 3;
-	    if (col + n < 80) Putc(' ', stderr);
-	    else {
-		Fputs("\n\t", stderr);
-		col = 8 - 1;
-	    }
-	    if (str2 == NULL)
-		Fprintf(stderr, "[%s]", str1);
-	    else
-		Fprintf(stderr, "[%s <%s>]", str1, str2);
-	    col += n;
-#endif /* not TOOLKIT */
 	}
 	if (col + 9 < 80) Putc(' ', stderr);
 	else Fputs("\n\t", stderr);
@@ -1347,7 +1066,6 @@ atopix(arg, allow_minus)
  **	Main program starts here.
  **/
 
-#ifdef	TOOLKIT
 
 #ifdef GREY
 static	Arg	temp_args1[] = {
@@ -1548,254 +1266,6 @@ XdviCvtStringToBool3(dpy, args, num_args, fromVal, toVal, closure_ret)
 
 #endif /* GREY */
 
-#else	/* not TOOLKIT */
-
-struct _resource	resource = {
-	/* wheel_unit		*/	80,
-	/* density		*/	40,
-#ifdef	GREY
-	/* gamma		*/	1.0,
-#endif
-	/* pixels_per_inch	*/	BDPI,
-	/* sidemargin		*/	NULL,
-	/* topmargin		*/	NULL,
-	/* xoffset		*/	NULL,
-	/* yoffset		*/	NULL,
-	/* paper		*/	DEFAULT_PAPER,
-	/* alt_font		*/	ALTFONT,
-#ifdef MKTEXPK
-	/* makepk		*/	True,
-#endif
-	/* mfmode		*/	MFMODE,
-	/* editor		*/	NULL,
-	/* src_pos		*/	NULL,
-	/* src_fork		*/	True,
-	/* list_fonts		*/	False,
-#if FREETYPE
-	/* freetype		*/	True,
-#endif
-	/* reverse		*/	False,
-	/* warn_spec		*/	False,
-	/* hush_chars		*/	False,
-	/* hush_chk		*/	False,
-	/* safer		*/	False,
-	/* fore_color		*/	NULL,
-	/* back_color		*/	NULL,
-	/* fore_Pixel		*/	(Pixel) 0,
-	/* back_Pixel		*/	(Pixel) 0,
-	/* icon_geometry	*/	NULL,
-	/* keep_flag		*/	False,
-	/* copy			*/	False,
-	/* thorough		*/	False,
-#if PS
-	/* postscript		*/	True,
-	/* allow_shell		*/	False,
-#ifdef	PS_DPS
-	/* useDPS		*/	True,
-#endif
-#ifdef	PS_NEWS
-	/* useNeWS		*/	True,
-#endif
-#ifdef	PS_GS
-	/* useGS		*/	True,
-	/* gs_safer		*/	True,
-	/* gs_alpha		*/	False,
-	/* gs_path		*/	GS_PATH,
-	/* gs_palette		*/	"Color",
-#endif
-#endif	/* PS */
-	/* prescan		*/	True,
-	/* debug_arg		*/	NULL,
-	/* version_flag		*/	False,
-	/* mg_arg		*/	{NULL, NULL, NULL, NULL, NULL},
-#if COLOR
-	/* use_color		*/	True,
-#endif
-#ifdef	GREY
-	/* use_grey		*/	True,
-	/* install		*/	Maybe,
-#endif
-};
-
-static	Pixel
-string_to_pixel(strp)		/* adapted from the toolkit */
-	char	**strp;
-{
-	char	*str = *strp;
-	Status	status;
-	XColor	color, junk;
-
-	if (*str == '#') {	/* an rgb definition */
-	    status = XParseColor(DISP, our_colormap, str, &color);
-	    if (status != 0)
-		status = XAllocColor(DISP, our_colormap, &color);
-	}
-	else	/* a name */
-	    status = XAllocNamedColor(DISP, our_colormap, str, &color, &junk);
-	if (status == 0) {
-	    WARN1(XmDIALOG_WARNING,
-	      "Cannot allocate colormap entry\nfor \"%s\"", str);
-	    *strp = NULL;
-	    return (Pixel) 0;
-	}
-	return color.pixel;
-}
-
-/*
- *	Process the option table.  This is not guaranteed for all possible
- *	option tables, but at least it works for this one.
- */
-
-static	void
-parse_options(argc, argv)
-	int argc;
-	char **argv;
-{
-	char		**arg;
-	char		**argvend = argv + argc;
-	char		*optstring;
-	XPointer	addr;
-	struct option	*opt, *lastopt, *candidate;
-	int		len1, len2, matchlen;
-
-	/*
-	 * Step 1.  Process command line options.
-	 */
-	for (arg = argv + 1; arg < argvend; ++arg) {
-	    len1 = strlen(*arg);
-	    candidate = NULL;
-	    matchlen = 0;
-	    for (opt = options; opt < options + XtNumber(options); ++opt) {
-		len2 = strlen(opt->name);
-		if (opt->argclass == StickyArg) {
-		    if (matchlen <= len2 && !strncmp(*arg, opt->name, len2)) {
-			candidate = opt;
-			matchlen = len2;
-		    }
-		}
-		else if (len1 <= len2 && matchlen <= len1 &&
-		    !strncmp(*arg, opt->name, len1)) {
-		    if (len1 == len2) {
-			candidate = opt;
-			break;
-		    }
-		    if (matchlen < len1) candidate = opt;
-		    else if (candidate && candidate->argclass != StickyArg)
-			candidate = NULL;
-		    matchlen = len1;
-		}
-	    }
-	    if (candidate == NULL) {
-		if (**arg == '-')
-		    usage("Invalid argument \"%s\".", *arg);
-		else if (dvi_name)
-		    usage(
-		      "More than one dvi file name given:\n\t\"%s\", \"%s\".",
-		      dvi_name, *arg);
-		else {
-		    dvi_name = *arg;
-		    continue;
-		}
-	    }
-		/* flag it for subsequent processing */
-	    candidate->resource = (char *) candidate;
-		/* store the value */
-	    addr = candidate->address;
-	    switch (candidate->argclass) {
-		case FalseArg:	*((Boolean *) addr) = False; continue;
-		case TrueArg:	*((Boolean *) addr) = True; continue;
-		case StickyArg:	optstring = *arg + strlen(candidate->name);
-		    break;
-		case SepArg:
-		    ++arg;
-		    if (arg >= argvend)
-		      usage("Option \"%s\" appears without an argument.",
-			arg[-1]);
-		    optstring = *arg;
-		    break;
-	    }
-	    switch (candidate->argtype) {
-		case StringArg:	*((char **) addr) = optstring; break;
-		case NumberArg:	*((int *) addr) = atoi(optstring); break;
-		case FloatArg:  *((float *) addr) = atof(optstring); break;
-		default:  ;
-	    }
-	}
-	/*
-	 * Step 2.  Propagate classes for command line arguments.  Backwards.
-	 */
-	for (opt = options + XtNumber(options) - 1; opt >= options; --opt)
-	    if (opt->resource == (char *) opt) {
-		addr = opt->address;
-		lastopt = opt + opt->classcount;
-		for (candidate = opt; candidate < lastopt; ++candidate) {
-		    if (candidate->resource != NULL) {
-			switch (opt->argtype) {
-			    case BooleanArg:
-			    case Bool3Arg:	/* same type as Boolean */
-				*((Boolean *) candidate->address) =
-				    *((Boolean *) addr);
-				break;
-			    case StringArg:
-				*((char **) candidate->address) =
-				    *((char **) addr);
-				break;
-			    case NumberArg:
-				*((int *) candidate->address) = *((int *) addr);
-				break;
-			    case FloatArg:
-				*((float *) candidate->address) =
-				    *((float *) addr);
-				break;
-			}
-			candidate->resource = NULL;
-		    }
-		}
-	    }
-
-	if ((DISP = XOpenDisplay(display)) == NULL)
-	    oops("Can't open display");
-	SCRN = DefaultScreenOfDisplay(DISP);
-	/*
-	 * Step 3.  Handle resources (including classes).
-	 */
-	for (opt = options; opt < options + XtNumber(options); ++opt)
-	    if (opt->resource &&
-		    ((optstring = XGetDefault(DISP, prog, opt->resource)) ||
-		    (optstring = XGetDefault(DISP, "XDvi", opt->resource))))
-		{
-		    lastopt = opt + opt->classcount;
-		    for (candidate = opt; candidate < lastopt; ++candidate)
-			if (candidate->resource != NULL) switch (opt->argtype) {
-			    case Bool3Arg:
-				if (       memicmp(optstring, "maybe", 6) == 0)
-				{
-				    * (Bool3 *) candidate->address = Maybe;
-				    break;
-				}
-				/* otherwise, fall through; the underlying */
-				/* types of Bool3 and Boolean are the same. */
-			    case BooleanArg:
-				* (Boolean *) candidate->address =
-				    (  memicmp(optstring, "true", 5) == 0
-				    || memicmp(optstring, "yes", 4) == 0
-				    || memicmp(optstring, "on", 3) == 0
-				    || memicmp(optstring, "1", 2) == 0);
-				break;
-			    case StringArg:
-				* (char **) candidate->address = optstring;
-				break;
-			    case NumberArg:
-				* (int *) candidate->address = atoi(optstring);
-				break;
-			    case FloatArg:
-				* (float *) candidate->address =
-				    atof(optstring);
-			}
-		}
-}
-
-#endif	/* not TOOLKIT */
 
 /*
  *	Routines for running as source-special client.
@@ -2127,7 +1597,6 @@ static	struct findrec			search_text	= {
 #endif /* EXTRA_APP_DEFAULTS */
 
 
-#if TOOLKIT
 
 struct modifierinf {
 	int		len;
@@ -2389,7 +1858,6 @@ compile_wheel_actions()
 	*wactpp = NULL;
 }
 
-#endif /* TOOLKIT */
 
 
 /*
@@ -2402,13 +1870,6 @@ main(argc, argv)
 	char **argv;
 {
 
-#ifndef	TOOLKIT
-	XSizeHints	size_hints;
-	XWMHints	wmhints;
-	int		flag;
-	int		x_thick	= 0;
-	int		y_thick	= 0;
-#endif	/* TOOLKIT */
 #ifdef MOTIF
 	Widget		menubar;
 	Widget		scale_menu;
@@ -2435,7 +1896,6 @@ main(argc, argv)
 	argv0 = argv[0];
 #endif
 
-#if TOOLKIT
 
 	top_level = XtInitialize(prog, "XDvi", options, XtNumber(options),
 	  &argc, argv);
@@ -2529,11 +1989,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 	    prog = resource.progname;
 #endif
 
-#else	/* not TOOLKIT */
-
-	parse_options(argc, argv);
-
-#endif /* not TOOLKIT */
 
 	if (resource.version_flag) {
 	    Printf("xdvi version %s\n", VERSION);
@@ -2555,9 +2010,7 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 	if ((atoms[0] = XInternAtom(DISP, atom_names[0], False)) == None
 	  || (atoms[1] = XInternAtom(DISP, atom_names[1], False)) == None
 	  || (atoms[2] = XInternAtom(DISP, atom_names[2], False)) == None
-# if TOOLKIT
 	  || (atoms[3] = XInternAtom(DISP, atom_names[3], False)) == None
-# endif
 # if XAW
 	  || (atoms[4] = XInternAtom(DISP, atom_names[4], False)) == None
 # endif
@@ -2608,7 +2061,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 		    our_colormap = XCreateColormap(DISP,
 		      RootWindowOfScreen(SCRN), our_visual, AllocNone);
 		    XInstallColormap(DISP, our_colormap);
-# if TOOLKIT
 		    temp_args1[0].value = (XtArgVal) our_depth;
 		    temp_args1[1].value = (XtArgVal) our_visual;
 		    temp_args1[2].value = (XtArgVal) our_colormap;
@@ -2635,15 +2087,6 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 			val.addr = (XtPointer) &our_colormap;
 			XrmPutResource(&db, "XDvi*colormap", XtRColormap, &val);
 		    }
-# else
-		    /* Can't use {Black,White}PixelOfScreen() any more */
-		    if (!resource.fore_color)
-			resource.fore_color =
-			  (resource.reverse ? "white" : "black");
-		    if (!resource.back_color)
-			resource.back_color =
-			  (resource.reverse ? "black" : "white");
-# endif
 		}
 		XFree(list);
 	    }
@@ -2664,10 +2107,8 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 	    XAllocColor(DISP, our_colormap, &tmp_color);
 
 	    our_colormap = XCopyColormapAndFree(DISP, our_colormap);
-# if TOOLKIT
 	    temp_args1a[0].value = (XtArgVal) our_colormap;
 	    XtSetValues(top_level, temp_args1a, 1);
-# endif
 	}
 
 #endif /* GREY */
@@ -2675,15 +2116,11 @@ or invalid argument:\n\t\"%s\", \"%s\".",
 	enable_intr();
 
 	if (dvi_name == NULL) {
-#if TOOLKIT
 	    postpone_popups = False;
 	    Act_open_dvi_file(NULL, NULL, NULL, 0);
 	    (void) read_events(EV_GE_NEWDOC);
 	    ev_flags &= ~EV_NEWDOC;
 	    postpone_popups = True;
-#else
-	    usage("You must give a dvi file name.");
-#endif
 	}
 	else {
 	    char	*new_name;
@@ -2841,25 +2278,12 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
 	 *	values, but I don't think that makes any difference.)
 	 */
 
-#if GREY && TOOLKIT
+#if GREY
 	XtGetApplicationResources(top_level, (XtPointer) &resource,
 	  app_pixel_resources, XtNumber(app_pixel_resources),
 	  (ArgList) NULL, 0);
 #endif
 
-#ifndef TOOLKIT
-	fore_Pixel = (resource.fore_color
-	  ? string_to_pixel(&resource.fore_color)
-	  : (resource.reverse ? WhitePixelOfScreen(SCRN)
-	    : BlackPixelOfScreen(SCRN)));
-	back_Pixel = (resource.back_color
-	  ? string_to_pixel(&resource.back_color)
-	  : (resource.reverse ? BlackPixelOfScreen(SCRN)
-	    : WhitePixelOfScreen(SCRN)));
-	brdr_Pixel = (brdr_color ? string_to_pixel(&brdr_color) : fore_Pixel);
-	hl_Pixel = (high_color ? string_to_pixel(&high_color) : fore_Pixel);
-	cr_Pixel = (curs_color ? string_to_pixel(&curs_color) : fore_Pixel);
-#endif	/* not TOOLKIT */
 
 	copy = resource.copy;
 
@@ -2919,7 +2343,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
 	 *	(which in turn affects whether init_pix is called).
 	 */
 
-#if TOOLKIT
 
 		/* The following code is lifted from Xterm */
 	if (resource.icon_geometry != NULL) {
@@ -3245,64 +2668,11 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
 	set_shrink_factor(mane.shrinkfactor);
 #endif
 
-#else	/* not TOOLKIT */
-
-	screen_w = WidthOfScreen(SCRN) - 2*bwidth;
-	screen_h = HeightOfScreen(SCRN) - 2*bwidth;
-
-	size_hints.flags = PMinSize;
-	size_hints.min_width = size_hints.min_height = 50;
-	size_hints.x = size_hints.y = 0;
-
-	/* compute largest possible window */
-	flag = 0;
-	if (geometry != NULL) {
-	    flag = XParseGeometry(geometry, &size_hints.x, &size_hints.y,
-	      &window_w, &window_h);
-	    if (flag & (XValue | YValue))
-		size_hints.flags |= USPosition;
-	    if (flag & (WidthValue | HeightValue))
-		size_hints.flags |= USSize;
-	}
-	if (!(flag & WidthValue)) window_w = screen_w;
-	if (!(flag & HeightValue)) window_h = screen_h;
-
-	if (shrink_factor == 0) {
-	    /* compute best shrink factor based on window_w and window_h */
-	    shrink_factor = ROUNDUP(unshrunk_page_w, window_w - 2);
-	    i = ROUNDUP(unshrunk_page_h, window_h - 2);
-	    if (i >= shrink_factor) shrink_factor = i;
-	    if (shrink_factor > 1) bak_shrink = shrink_factor;
-	    mane.shrinkfactor = shrink_factor;
-	    init_page();
-	}
-
-	if (window_w < page_w) x_thick = BAR_THICK;
-	if (window_h < page_h + x_thick) y_thick = BAR_THICK;
-	if (!(flag & WidthValue)) {
-	    window_w = page_w + y_thick;
-	    if (window_w > screen_w) {
-		x_thick = BAR_THICK;
-		window_w = screen_w;
-	    }
-	    size_hints.flags |= PSize;
-	}
-	if (!(flag & HeightValue)) {
-	    window_h = page_h + x_thick;
-	    if (window_h > screen_h) window_h = screen_h;
-	    size_hints.flags |= PSize;
-	}
-
-	if (flag & XNegative) size_hints.x += screen_w - window_w;
-	if (flag & YNegative) size_hints.y += screen_h - window_h;
-
-#endif	/* not TOOLKIT */
 
 	/*
 	 *	Step 5:  Realize the widgets (or windows).
 	 */
 
-#if TOOLKIT
 
 #if BUTTONS && !MOTIF
 	if (!resource.expert)
@@ -3351,116 +2721,6 @@ argument is to override any papersize specials in the dvi file.\n\n", stderr);
 	    backing_store = attrs.backing_store;
 	}
 
-#else	/* not TOOLKIT */
-
-	size_hints.width = window_w;
-	size_hints.height = window_h;
-#ifndef GREY
-	top_level = XCreateSimpleWindow(DISP, RootWindowOfScreen(SCRN),
-	  size_hints.x, size_hints.y, window_w, window_h, bwidth,
-	  brdr_Pixel, back_Pixel);
-#else
-	{
-	    XSetWindowAttributes attr;
-
-	    attr.border_pixel = brdr_Pixel;
-	    attr.background_pixel = back_Pixel;
-	    attr.colormap = our_colormap;
-	    top_level = XCreateWindow(DISP, RootWindowOfScreen(SCRN),
-	      size_hints.x, size_hints.y, window_w, window_h, bwidth,
-	      our_depth, InputOutput, our_visual,
-	      CWBorderPixel | CWBackPixel | CWColormap, &attr);
-	}
-#endif
-	{	/* See also set_titles() in dvi-init-c.  */
-	    char	*title_name;
-	    char	*icon_name;
-	    size_t	baselen;
-	    Boolean	icon_name_malloced = False;
-
-	    icon_name = rindex(dvi_name, '/');
-	    if (icon_name != NULL) ++icon_name;
-	      else icon_name = dvi_name;
-	    baselen = strlen(icon_name);
-	    if (baselen > 4 && memcmp(icon_name + baselen - 4, ".dvi", 4) == 0)
-	    {
-		/* remove the .dvi */
-		char *p;
-
-		baselen -= 4;
-		p = xmalloc(baselen + 1);
-		memcpy(p, icon_name, baselen);
-		p[baselen] = '\0';
-		icon_name = p;
-		icon_name_malloced = True;
-	    }
-
-	    title_name = xmalloc(baselen + 8);
-	    memcpy(title_name, "Xdvi:  ", 7);
-	    memcpy(title_name + 7, icon_name, baselen + 1);
-
-	    XSetStandardProperties(DISP, top_level, title_name, icon_name,
-	      (Pixmap) 0, argv, argc, &size_hints);
-
-	    free(title_name);
-	    if (icon_name_malloced)
-		free(icon_name);
-	}
-
-	wmhints.flags = InputHint | StateHint | IconPixmapHint;
-	wmhints.input = True;	/* window manager must direct input */
-	wmhints.initial_state = iconic ? IconicState : NormalState;
-	wmhints.icon_pixmap = XCreateBitmapFromData(DISP,
-	    RootWindowOfScreen(SCRN), (_Xconst char *) xdvi_bits,
-	    xdvi_width, xdvi_height);
-	if (resource.icon_geometry != NULL) {
-	    int junk;
-
-	    wmhints.flags |= IconPositionHint;
-	    (void) XGeometry(DISP, DefaultScreen(DISP), resource.icon_geometry,
-		"", 0, 0, 0, 0, 0, &wmhints.icon_x, &wmhints.icon_y,
-		&junk, &junk);
-	}
-	XSetWMHints(DISP, top_level, &wmhints);
-
-	XSelectInput(DISP, top_level,
-	  KeyPressMask | StructureNotifyMask | PropertyChangeMask);
-	XMapWindow(DISP, top_level);
-	XFlush(DISP);
-
-	{
-	    static KeySym list[2] = {XK_Caps_Lock, XK_Num_Lock};
-
-#define	rebindkey(ks, str)	XRebindKeysym(DISP, (KeySym) ks, \
-		  (KeySym *) NULL, 0, (_Xconst ubyte *) str, 1); \
-		XRebindKeysym(DISP, (KeySym) ks, \
-		  list, 1, (_Xconst ubyte *) str, 1); \
-		XRebindKeysym(DISP, (KeySym) ks, \
-		  list + 1, 1, (_Xconst ubyte *) str, 1); \
-		XRebindKeysym(DISP, (KeySym) ks, \
-		  list, 2, (_Xconst ubyte *) str, 1);
-
-	    rebindkey(XK_Home, "^");
-	    rebindkey(XK_Left, "l");
-	    rebindkey(XK_Up, "u");
-	    rebindkey(XK_Right, "r");
-	    rebindkey(XK_Down, "d");
-	    rebindkey(XK_Prior, "b");
-	    rebindkey(XK_Next, "f");
-#ifdef XK_KP_Left
-	    rebindkey(XK_KP_Home, "^");
-	    rebindkey(XK_KP_Left, "l");
-	    rebindkey(XK_KP_Up, "u");
-	    rebindkey(XK_KP_Right, "r");
-	    rebindkey(XK_KP_Down, "d");
-	    rebindkey(XK_KP_Prior, "b");
-	    rebindkey(XK_KP_Next, "f");
-	    rebindkey(XK_KP_Delete, "\177");
-#endif /* def XK_KP_Left */
-	}
-#undef	rebindkey
-
-#endif	/* not TOOLKIT */
 
 	image = XCreateImage(DISP, our_visual, 1, XYBitmap, 0,
 			     (char *) NULL, 0, 0, BMBITS, 0);
diff --git a/xdvi.h b/xdvi.h
@@ -93,11 +93,8 @@ NOTE:
 #include <X11/Xfuncs.h>
 #endif
 
-#undef	TOOLKIT
-
 #if XAW || MOTIF
 
-#define	TOOLKIT	1
 #include <X11/Intrinsic.h>
 #if (defined(VMS) && (XtSpecificationRelease <= 4)) || defined(lint)
 # include <X11/IntrinsicP.h>
@@ -109,17 +106,7 @@ NOTE:
 # endif
 #endif
 
-#else /* not TOOLKIT */
-
-#define	XtNumber(arr)	(sizeof(arr)/sizeof(arr[0]))
-#define	XtWindow(win)	(win)
-typedef	unsigned long	Pixel;
-typedef	char		Boolean;
-typedef	unsigned int	Dimension;
-#undef	BUTTONS
-#undef	EXTRA_APP_DEFAULTS
-
-#endif /* not TOOLKIT */
+#endif /* XAW || MOTIF */
 
 #if EXTRA_APP_DEFAULTS && !SELFAUTO
 #define	SELFAUTO 1
@@ -595,16 +582,14 @@ EXTERN	unsigned short	current_timestamp INIT(0);
  */
 
 extern	struct _resource {
-#if TOOLKIT && CFGFILE
+#if CFGFILE
 	_Xconst char	*progname;
 #endif
-#if TOOLKIT
 	int		shrinkfactor;
 	_Xconst char	*main_translations;
 	_Xconst char	*wheel_translations;
 	int		dvips_hang;
 	int		dvips_fail_hang;
-#endif
 	int		wheel_unit;
 	int		_density;
 #ifdef	GREY
@@ -633,17 +618,11 @@ extern	struct _resource {
 	Boolean		_hush_chars;
 	Boolean		_hush_chk;
 	Boolean		safer;
-#if defined(VMS) || !defined(TOOLKIT)
-	_Xconst	char	*fore_color;
-	_Xconst	char	*back_color;
-#endif
 	Pixel		_fore_Pixel;
 	Pixel		_back_Pixel;
-#ifdef TOOLKIT
 	Pixel		_brdr_Pixel;
 	Pixel		_hl_Pixel;
 	Pixel		_cr_Pixel;
-#endif
 	_Xconst	char	*icon_geometry;
 	Boolean		keep_flag;
 	Boolean		copy;
@@ -688,9 +667,7 @@ extern	struct _resource {
 	Boolean		_use_grey;
 	Bool3		install;
 #endif
-#if TOOLKIT
 	_Xconst char	*dvips_path;
-#endif
 } resource;
 
 /* As a convenience, we define the field names without leading underscores
@@ -711,9 +688,6 @@ extern	struct _resource {
 #define	use_grey	resource._use_grey
 #endif
 
-#ifndef TOOLKIT
-EXTERN	Pixel		brdr_Pixel;
-#endif
 
 #if GREY
 EXTERN	Pixel		plane_masks[4];
@@ -825,10 +799,8 @@ EXTERN	time_t		dvi_time;		/* last modification time */
 EXTERN	ino_t		dvi_inode;		/* used for source specials */
 EXTERN	unsigned char	*dvi_property;		/* for setting in window */
 EXTERN	size_t		dvi_property_length;
-#if TOOLKIT
 EXTERN	Boolean		titles_are_stale INIT(True);
 						/* replace icon/window titles */
-#endif
 EXTERN	_Xconst char	*prog;
 EXTERN	int		bak_shrink;		/* last shrink factor != 1 */
 EXTERN	Dimension	window_w, window_h;
@@ -838,10 +810,8 @@ EXTERN	int		home_x, home_y;
 
 EXTERN	Display		*DISP;
 EXTERN	Screen		*SCRN;
-#if TOOLKIT
 extern	XtActionsRec	Actions[];
 extern	Cardinal	num_actions;
-#endif
 #if XAW
 EXTERN	XtAccelerators	accels_cr, accels_cr_click;
 #endif
@@ -862,7 +832,6 @@ EXTERN	Boolean		copy;
 
 EXTERN	Cursor		redraw_cursor, ready_cursor, drag_cursor[3];
 
-#if TOOLKIT
 struct xdvi_action {
 	struct xdvi_action *next;
 	XtActionProc	proc;
@@ -880,7 +849,6 @@ struct wheel_acts {
 };
 
 EXTERN	struct wheel_acts	*wheel_actions;
-#endif
 
 #if MOTIF && BUTTONS
 EXTERN	XtTranslations	wheel_trans_table	INIT(NULL);
@@ -976,7 +944,6 @@ EXTERN	Boolean		drawing_mag	INIT(False);
 
 #define	shrink_factor	currwin.shrinkfactor
 
-#if TOOLKIT
 EXTERN	Widget		top_level	INIT(0);
 EXTERN	Widget		vport_widget, draw_widget, clip_widget;
 # if MOTIF
@@ -992,12 +959,6 @@ EXTERN	Widget		panel_widget;
 EXTERN	Cursor		panel_cursor	INIT(0);
 #  endif
 # endif
-#else /* not TOOLKIT */
-EXTERN	Window		top_level	INIT(0);
-
-#define	BAR_WID		12	/* width of darkened area */
-#define	BAR_THICK	15	/* gross amount removed */
-#endif /* not TOOLKIT */
 
 #if XAW
 #define	WARN(t, s)	(void) warning_popup(s, "OK", NULL)
@@ -1022,18 +983,15 @@ EXTERN	Window		top_level	INIT(0);
  * and then raise them later, due to unpredictable window manager behavior.
  */
 
-#if TOOLKIT
 EXTERN	Boolean		postpone_popups		INIT(True);
 EXTERN	size_t		n_init_popups		INIT(0);
 EXTERN	Widget		*init_popups;
 EXTERN	size_t		alloc_init_popups	INIT(0);
-#endif
 
 /*
  * Structure to use for status popups.
  */
 
-#if TOOLKIT
 struct status_popup {
 	Widget	shell;
 	Widget	label;
@@ -1041,7 +999,6 @@ struct status_popup {
 	Boolean	popped;
 	Boolean	spurious;
 };
-#endif
 
 EXTERN	char	*ffline	INIT(NULL);	/* an array used by filefind to store */
 					/* the file name being formed.  */
@@ -1138,9 +1095,7 @@ EXTERN	Atom	atoms[3];
 #define	ATOM_XDVI_WINDOWS	(atoms[0])
 #define	ATOM_DVI_FILE		(atoms[1])
 #define	ATOM_SRC_GOTO		(atoms[2])
-#if TOOLKIT
 #define	XA_WM_DELETE_WINDOW	(atoms[3])
-#endif
 #if XAW
 #define	XA_WM_PROTOCOLS		(atoms[4])
 #endif
@@ -1174,9 +1129,7 @@ extern	struct psprocs	{
 _XFUNCPROTOBEGIN
 
 extern	int	atopix ARGS((_Xconst char *, wide_bool));
-#if TOOLKIT
 extern	Bool	compile_action ARGS((_Xconst char *, struct xdvi_action **));
-#endif
 #if BUTTONS
 extern	void	create_buttons ARGS((void));
 #if XAW
@@ -1196,12 +1149,10 @@ extern	void	expose ARGS((struct WindowRec *, int, int,
 		  unsigned int, unsigned int));
 extern	void	home ARGS((wide_bool));
 extern	void	reconfig ARGS((void));
-#if TOOLKIT
 extern	void	handle_resize ARGS((Widget, XtPointer, XEvent *, Boolean *));
 extern	void	handle_expose ARGS((Widget, XtPointer, XEvent *, Boolean *));
 extern	void	handle_property_change ARGS((Widget, XtPointer, XEvent *,
 		  Boolean *));
-#endif
 #if XAW
 extern	void	handle_messages ARGS((Widget, XtPointer, XEvent *, Boolean *));
 #elif MOTIF
@@ -1215,9 +1166,6 @@ extern	void	scale_pulldown_callback ARGS((Widget, XtPointer, XtPointer));
 extern	void	set_shrink_factor ARGS((int));
 extern	void	popdown_callback ARGS((Widget, XtPointer, XtPointer));
 #endif
-#if !TOOLKIT
-extern	void	showmessage ARGS((_Xconst char *));
-#endif
 extern	void	set_chld ARGS((struct xchild *));
 extern	void	clear_chld ARGS((struct xchild *));
 extern	void	set_io ARGS((struct xio *));
@@ -1320,7 +1268,7 @@ extern	void	*xrealloc ARGS((void *, unsigned));
 extern	char	*xstrdup ARGS((_Xconst char *));
 extern	char	*xmemdup ARGS((_Xconst char *, size_t));
 #endif
-#if TOOLKIT && !HAVE_STRERROR && !defined strerror
+#if !HAVE_STRERROR && !defined strerror
 extern	char	*strerror ARGS((int));
 #endif
 extern	void	expandline ARGS((size_t));