diff -ur xc/config/cf.old/Imake.cf xc/config/cf/Imake.cf
--- xc/config/cf.old/Imake.cf	Tue Dec  5 16:40:00 1995
+++ xc/config/cf/Imake.cf	Sat May 25 20:27:28 1996
@@ -395,13 +395,19 @@
 # define Win32Architecture
 #endif /* WIN32 */
 
-#ifdef linux 
+#ifdef linux
 # define MacroIncludeFile <linux.cf>
 # define MacroFile linux.cf
 # undef linux
 # define LinuxArchitecture
-# define i386Architecture
-# undef i386
+# ifdef 386
+#  define i386Architecture
+#  undef i386
+# endif
+# if defined(__sparc__) || defined(sparc)
+#  define SparcArchitecture
+#  undef sparc
+# endif
 #endif /* linux */
 
 #ifdef __uxp__
diff -ur xc/config/cf.old/Imake.rules xc/config/cf/Imake.rules
--- xc/config/cf.old/Imake.rules	Wed Jan 17 11:09:00 1996
+++ xc/config/cf/Imake.rules	Fri Jun  7 14:59:42 1996
@@ -2195,9 +2195,9 @@
 #ifndef MakeDirectories
 #define MakeDirectories(step,dirs)					@@\
 step::									@@\
-	@MakeFlagsToShellFlags(i,set +e); \				@@\
+	@MakeFlagsToShellFlags(i,set +e); 				@@\
 	DirFailPrefix@for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \	@@\
-		set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \	@@\
+		set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi; \ @@\
 	done
 #endif /* MakeDirectories */
 
diff -ur xc/config/cf.old/linux.cf xc/config/cf/linux.cf
--- xc/config/cf.old/linux.cf	Fri Feb  2 19:00:00 1996
+++ xc/config/cf/linux.cf	Sat Aug 24 11:03:02 1996
@@ -4,20 +4,20 @@
 #define OSName			Linux
 #endif
 #ifndef OSVendor
-#define OSVendor		Slackware 2.3.0 ELF
+#define OSVendor		RedHat 3.0.4 (rembrandt)
 #endif
 #ifndef OSMajorVersion
-#define OSMajorVersion		1
+#define OSMajorVersion		2
 #endif
 #ifndef OSMinorVersion
-#define OSMinorVersion		2
+#define OSMinorVersion		0
 #endif
 #ifndef OSTeenyVersion
-#define OSTeenyVersion		11
+#define OSTeenyVersion		15
 #endif
 
 #ifndef UseElfFormat
-#if OSMinorVersion > 1
+#if OSMinorVersion > 1 || OSMajorVersion > 1
 #define UseElfFormat		YES
 #else
 #define UseElfFormat		NO
@@ -49,7 +49,7 @@
 #define SetTtyGroup		YES
 
 #if UseElfFormat
-#if OSMinorVersion > 1
+#if OSMinorVersion > 1 || OSMajorVersion > 1
 #define CcCmd			gcc
 #define AsCmd			as
 #define LdCmd			ld
@@ -59,15 +59,23 @@
 #define LdCmd			ld -m elf_i386
 #endif
 #define AsmDefines		-D__ELF__
+#ifdef i386Architecture
 #define CplusplusCmd		g++ -b i486-linuxelf
 #else
+#define CplusplusCmd		g++
+#endif
+#else
 #define CcCmd			gcc
-#if OSMinorVersion < 2
+#if OSMinorVersion < 2 && OSMajorVersion < 2
 #define AsCmd			as
 #define LdCmd			ld
 #else
+#ifdef i386Architecture
 #define AsCmd			/usr/i486-linuxaout/bin/as
 #define LdCmd			ld -m i386linux
+#else
+#error a.out not supported.
+#endif
 #endif
 #define AsmDefines		-DUSE_GAS -U__ELF__
 #endif
@@ -79,15 +87,31 @@
 #define PreProcessCmd		CcCmd -E
 #define PostIncDir		`CcCmd --print-libgcc-file-name | sed 's/libgcc.a/include/'`
 #define LdCombineFlags		-r
+#ifdef i386Architecture
 #define OptimizedCDebugFlags	-O2 -m486
 #define StandardDefines		-Dlinux -D__i386__ -D_POSIX_SOURCE \
 				-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
+#elif defined(SparcArchitecture)
+#define OptimizedCDebugFlags	-O2
+#define StandardDefines		-Dlinux -D__sparc__ -D_POSIX_SOURCE \
+				-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
+#else
+#error Architecture not supported.
+#endif
 #define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
 #define HasWChar32		YES
 #define StandardCppDefines	-traditional StandardDefines
+#ifdef i386Architecture
 #define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
 #define ExtensionOSDefines	-DXTESTEXT1
 #define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines
+#elif defined(SparcArchitecture)
+#define ServerOSDefines		-DDDXOSINIT
+/* #define ExtensionOSDefines	-DXTESTEXT1 -- Not supported yet*/
+#define ServerExtraDefines	-DGCCUSESGAS
+#else
+#error Architecture not supported.
+#endif
 #define ConnectionFlags		-DUNIXCONN -DTCPCONN
 #define InstUidFlags		-s -m 4711
 
@@ -112,4 +136,24 @@
 #endif
 
 #include <lnxLib.rules>
+#ifdef i386Architecture
 #include <xfree86.cf>
+#elif defined(SparcArchitecture)
+#ifndef Xsun24Server
+#define Xsun24Server	YES		/* Multiple depths, Color, Mono */
+#endif
+#ifndef XsunServer
+#define XsunServer	YES		/* Color 8-bit and Mono */
+#endif
+#ifndef XsunMonoServer
+#define XsunMonoServer	YES		/* Mono only */
+#endif
+#ifndef HasNdbm
+#define HasNdbm		YES
+#endif
+#ifndef DBMLibrary
+#define DBMLibrary	/usr/lib/libdb.a
+#endif
+#else
+#error Architecture not supported.
+#endif
diff -ur xc/config/cf.old/site.def xc/config/cf/site.def
--- xc/config/cf.old/site.def	Wed Jan  3 00:00:00 1996
+++ xc/config/cf/site.def	Fri Jun  7 16:28:08 1996
@@ -32,6 +32,9 @@
 
 #ifdef BeforeVendorCF
 
+#undef ForceNormalLib
+#define ForceNormalLib	YES
+
 /* #include <host.def> */
 
 /*
@@ -100,6 +103,9 @@
 #endif
 */
 
+#if defined(SparcArchitecture) && defined(LinuxArchitecture)
+#define InstallXserverSetUID YES
+#endif
 /* #include <host.def> */
 
 #endif /* AfterVendorCF */
diff -ur xc.vanilla/fonts/PEX/to_wfont.y xc/fonts/PEX/to_wfont.y
--- xc.vanilla/fonts/PEX/to_wfont.y	Mon Nov 21 23:11:41 1994
+++ xc/fonts/PEX/to_wfont.y	Sun May 26 10:43:00 1996
@@ -617,7 +617,7 @@
 	}
 
 	(void) fclose(fp);
-	freeall();
+/*	freeall(); */
 #	undef BY_BYE
 }
 
diff -ur xc.vanilla/lib/Xau/Imakefile xc/lib/Xau/Imakefile
--- xc.vanilla/lib/Xau/Imakefile	Thu Sep 21 17:28:17 1995
+++ xc/lib/Xau/Imakefile	Fri Jun  7 17:34:52 1996
@@ -6,6 +6,7 @@
 #define LibName Xau
 #define SoRev SOXAUTHREV
 
+
 #include <Threads.tmpl>
 
        LINTLIBS = $(LINTXLIB)
--- xc/programs/Xserver/Imakefile.orig	Fri Feb  2 18:44:00 1996
+++ xc/programs/Xserver/Imakefile	Sat Aug 24 11:04:46 1996
@@ -11,7 +11,7 @@
 #include <Server.tmpl>
 
 #define PreFbLibs $(DIX) $(OS) $(FONT)
-#define BarePostFbLibs $(MFB) $(MI)
+#define BarePostFbLibs $(MFB) $(MI) $(CBRT)
 #define PostFbLibs BarePostFbLibs $(EXTENSIONS)
 #define NoMfbBarePostFbLibs $(MI)
 #define NoMfbPostFbLibs NoMfbBarePostFbLibs $(EXTENSIONS)
@@ -176,9 +176,9 @@
 DDXDIR1 = hw/sun
 SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS)
 #ifndef AmoebaArchitecture
-SUNOBJS = hw/sun/sunInit.o
+SUNOBJS = hw/sun/sunInit.o hw/sun/sunGX.o hw/sun/sunCfb.o
 #else
-SUNOBJS = hw/sun/sunInitColor.o
+SUNOBJS = hw/sun/sunInitColor.o hw/sun/sunGX.o hw/sun/sunCfb.o
 #endif
 SUNLIBS = hw/sun/libsun.a CFB8Libs
 SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SYSLIBS))
@@ -198,7 +198,7 @@
 CFB32DIR = cfb32
 DDXDIR1 = hw/sun
 SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS)
-SUN24OBJS = hw/sun/sunInitMulti.o
+SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/sunGX.o hw/sun/sunCfb.o hw/sun/sunCfb24.o
 SUN24LIBS = hw/sun/libsun.a CFBLibs
 SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS),$(SUN24LIBS),$(SYSLIBS))
 #ifndef ServerToInstall
diff -ur xc.vanilla/programs/Xserver/cfb/stipsparc.s xc/programs/Xserver/cfb/stipsparc.s
--- xc.vanilla/programs/Xserver/cfb/stipsparc.s	Mon Apr 18 02:29:09 1994
+++ xc/programs/Xserver/cfb/stipsparc.s	Mon May 27 09:24:03 1996
@@ -85,7 +85,7 @@
 #define ForEachBits	LY4
 #define NextBits	LY5
 
-#ifdef SVR4
+#if defined(SVR4) || ( defined(linux) && defined(__ELF__) )
 #ifdef TETEXT
 #define	_cfbStippleStack	cfbStippleStackTE
 #else
diff -ur xc.vanilla/programs/Xserver/cfb/stipsprc32.s xc/programs/Xserver/cfb/stipsprc32.s
--- xc.vanilla/programs/Xserver/cfb/stipsprc32.s	Mon Apr 18 02:29:10 1994
+++ xc/programs/Xserver/cfb/stipsprc32.s	Mon Jun  3 10:57:49 1996
@@ -81,7 +81,7 @@
 #define ForEachBits	LY4
 #define NextBits	LY5
 
-#ifdef SVR4
+#if defined(SVR4) || ( defined(linux) && defined(__ELF__) )
 #ifdef TETEXT
 #define	_cfb32StippleStack	cfb32StippleStackTE
 #else
diff -urN xc/programs/Xserver/hw/sun.old/Imakefile xc/programs/Xserver/hw/sun/Imakefile
--- xc/programs/Xserver/hw/sun.old/Imakefile	Thu Sep 15 00:00:00 1994
+++ xc/programs/Xserver/hw/sun/Imakefile	Thu Aug 22 14:11:57 1996
@@ -16,21 +16,25 @@
 SRCS =	$(SRCS1) kbd_mode.c constype.c
 
 #ifdef i386Architecture
-OFILES = sunInit.o
+OFILES = sunInit.o sunGX.o sunCfb.o sunCfb24.o
 #else
-OFILES = sunInit.o sunInitMono.o sunInExMono.o sunInitMulti.o
+OFILES = sunInit.o sunInitMono.o sunInExMono.o sunInitMulti.o sunGX.o sunCfb.o sunCfb24.o
 #endif
 
-OBJS = 	sunCfb.o \
-	sunCfb24.o \
-	sunCursor.o \
+#ifdef LinuxArchitecture
+LINUXOBJS = linux.o
+#else
+LINUXOBJS =
+#endif
+
+OBJS =  sunCursor.o \
 	sunFbs.o \
 	sunIo.o \
 	sunKbd.o \
 	sunMfb.o \
 	sunMouse.o \
-	sunGX.o \
-	sunKeyMap.o
+	sunKeyMap.o \
+	$(LINUXOBJS)
 
    INCLUDES = -I. -I../.. -I../../mi -I../../mfb -I../../cfb -I../../cfb32 \
 	      -I../../include -I$(INCLUDESRC) -I$(FONTINCSRC)
@@ -45,6 +49,10 @@
 
 NormalLibraryTarget(sun,$(OBJS))
 NormalLintTarget($(SRCS1))
+
+SpecialCObjectRule(sunCfb,,)
+SpecialCObjectRule(sunCfb24,,)
+SpecialCObjectRule(sunGX,,)
 
 #ifndef i386Architecture
 sunInExMono.o: $(ICONFIGFILES)
diff -urN xc/programs/Xserver/hw/sun.old/constype.c xc/programs/Xserver/hw/sun/constype.c
--- xc/programs/Xserver/hw/sun.old/constype.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/constype.c	Tue Aug 20 20:34:44 1996
@@ -49,25 +49,30 @@
     int argc;
     char **argv;
 {
-    char *wu_fbid();
-    int retval = -1;
-    char *consoleid, *dev;
+    int fbtype = -1;
+    char *fbname, *dev;
     int print_num = 0;
+    int error;
 
     if (argc > 1 && argv[1][0] == '/') {
 	dev = argv[1];
 	argc--; argv++;
     } else
+#ifndef linux
 	dev = "/dev/fb";
-    consoleid = wu_fbid(dev, &retval);
+#else
+	dev = "/dev/fb0";
+#endif
+    error = wu_fbid(dev, &fbname, &fbtype);
     if (argc > 1 && strncmp (argv[1], "-num", strlen(argv[1])) == 0)
 	print_num = 1;
 
-    printf ("%s", consoleid ? consoleid : "tty");
+    printf ("%s", fbname ? fbname : "tty");
     if (print_num) {
-	printf (" %d", retval);
+	printf (" %d", fbtype);
     }
     putchar ('\n');
+    return error;
 }
 #include <sys/ioctl.h>
 #include <sys/file.h>
@@ -76,12 +81,22 @@
 #include <sys/fbio.h>
 #else
 #ifndef __NetBSD__
+# ifndef linux
 #include <sun/fbio.h>
+# else
+#include <asm/fbio.h>
+# endif
 #else
 #include <machine/fbio.h>
 #endif
 #endif
 
+/* Sun doesn't see fit to update <sys/fbio.h> to reflect the addition
+ * of the TCX 
+ */
+#define XFBTYPE_TCX		21
+#define XFBTYPE_LASTPLUSONE	22
+
 /* decoding as of Release 3.4 : fbio.h 1.3 87/01/09 SMI */
 	/* the convention for entries in this table is to translate the
 	 * macros for frame buffer codes (in <sun/fbio.h>) to short names
@@ -91,46 +106,82 @@
 	 *	FBTYPE_SUNxGP		becomes gpx
 	 *	FBTYPE_NOTSUN[1-9]	becomes ns[A-J]
 	 */
-static char *decode_fb[FBTYPE_LASTPLUSONE] = {
+static char *decode_fb[] = {
 	"bw1", "cg1",
 	"bw2", "cg2",
 	"gp2",
 	"bw3", "cg3",
-	"bw4", "cg4",
+	"cg8", "cg4",
 	"nsA", "nsB", "nsC", 
-#if FBTYPE_LASTPLUSONE > 12
-	"gx", "rop", "vid", 
-	"res5", "res4", "res3", "res2", "res1"
+#ifdef FBTYPE_SUNFAST_COLOR
+	"gx/cg6", 
+#endif
+#ifdef FBTYPE_SUNROP_COLOR
+	"rop", 
+#endif
+#ifdef FBTYPE_SUNFB_VIDEO
+	"vid", 
+#endif
+#ifdef FBTYPE_SUNGIFB
+	"gifb", 
+#endif
+#ifdef FBTYPE_SUNGPLAS
+	"plas", 
+#endif
+#ifdef FBTYPE_SUNGP3
+	"gp3/cg12", 
+#endif
+#ifdef FBTYPE_SUNGT
+	"gt", 
+#endif
+#ifdef FBTYPE_SUNLEO
+	"leo/zx", 
+#endif
+#ifdef FBTYPE_MDICOLOR
+	"mdi/cg14",
 #endif
 	};
 
-char *
-wu_fbid(fbname, retval)
-	char *fbname;
-	int *retval;
+int wu_fbid(devname, fbname, fbtype)
+	char* devname;
+	char** fbname;
+	int* fbtype;
 {
 	struct fbgattr fbattr;
 	int fd, ioctl_ret;
-	*retval = -1;
-	if ( (fd = open(fbname, O_RDWR, 0)) == -1 )
-		return(0);
-		/* FBIOGATTR fails for early frame buffer types */
+	if ( (fd = open(devname, O_RDWR, 0)) == -1 ) {
+	    *fbname = "unable to open fb";
+	    return 2;
+	}
+	/* FBIOGATTR fails for early frame buffer types */
 	if (ioctl_ret = ioctl(fd,FBIOGATTR,&fbattr)) {	/*success=>0(false)*/
-		ioctl_ret = ioctl(fd, FBIOGTYPE, &fbattr.fbtype);
+	    ioctl_ret = ioctl(fd, FBIOGTYPE, &fbattr.fbtype);
 	}
-	*retval = fbattr.fbtype.fb_type;
 	close(fd);
-	if ( ioctl_ret == -1 )
-		return(0);
-	    /* The binary is obsolete and needs to be re-compiled:
-	     * the ioctl returned a value beyond what was possible
-	     * when the program was compiled */
-	if (fbattr.fbtype.fb_type>=FBTYPE_LASTPLUSONE)
-		return("unk");
-	    /* The source is obsolete.  The table "decode_fb" does not
-	     * have entries for some of the values returned by the ioctl.
-	     * Compare <sun/fbio.h> to the entries in "decode_fb" */
-	if ( decode_fb[fbattr.fbtype.fb_type] == 0 )	/* decode_fb is obs */
-                return("unk");
-	return(decode_fb[fbattr.fbtype.fb_type]);
+	if ( ioctl_ret == -1 ) {
+	    *fbname = "ioctl on fb failed";
+	    return 2;
+	}
+	*fbtype = fbattr.fbtype.fb_type;
+	/* The binary is obsolete and needs to be re-compiled:
+	 * the ioctl returned a value beyond what was possible
+	 * when the program was compiled */
+	if (fbattr.fbtype.fb_type>=FBTYPE_LASTPLUSONE) {
+	    if (fbattr.fbtype.fb_type == XFBTYPE_TCX) {
+		*fbname = "tcx";
+		return 0;
+	    } else {
+		*fbname = "unk";
+		return 1;
+	    }
+	}
+	/* The source is obsolete.  The table "decode_fb" does not
+	 * have entries for some of the values returned by the ioctl.
+	 * Compare <sun/fbio.h> to the entries in "decode_fb" */
+	if ( decode_fb[fbattr.fbtype.fb_type] == NULL ) {
+            *fbname = "unk";
+	    return 1;
+	}
+	*fbname = decode_fb[fbattr.fbtype.fb_type];
+	return 0;
 }
diff -urN xc/programs/Xserver/hw/sun.old/constype.man xc/programs/Xserver/hw/sun/constype.man
--- xc/programs/Xserver/hw/sun.old/constype.man	Fri Dec 15 14:00:00 1995
+++ xc/programs/Xserver/hw/sun/constype.man	Tue Aug 20 20:31:49 1996
@@ -1,29 +1,55 @@
 .\" $XConsortium: constype.man /main/10 1995/12/15 13:59:44 gildea $
 .TH CONSTYPE 1 "Release 6.1" "X Version 11"
 .SH NAME
-constype - print type of Sun console
+constype \- print type of Sun console
 .SH SYNOPSIS
 .B "constype"
+[
+.I device_name
+] [
+.B \-num
+]
 .SH DESCRIPTION
-.I Consoletype
-prints on the standard output the Sun code for the type of display
-that the console is. It is one of:
+The 
+.I constype
+program
+writes on the standard output the Sun code for the type of display
+that the console is.
+The types output include these:
 .sp 2
 .in +0.5i
 .nf
 bw?	Black and White, where ? is 1-4. (eg) 3-50s are bw2
 cg?	Colour Graphics display, where ? is 1-4
 gp?	Optional Graphics Processor board, where ? is 1-2
-ns?	Not Sun display - where ? is A-J
+ns?	Not Sun display \(em where ? is A-J
 .fi
 .in -0.5i
 .sp 2
 This is useful in determining startup values and defaults for window
 systems.
+.LP
+The
+.I device_name
+argument, if given, is the device to examine.
+If not given,
+.I /dev/fb
+is used.
+.LP
+The
+.B \-num
+option causes
+.I constype
+to follow the type keyword with the numeric value of that type,
+as returned by the FBIOGATTR or FBIOGTYPE ioctl and defined in fbio.h.
+This is useful if the type is not recognized by the program.
+.SH "EXIT STATUS"
+The program exits with status 0 if it identified a known console type,
+1 if the type was unknown, and 2 if the device could not be opened or
+another error occurred.
 .SH BUGS
 Not tested on all monitor types
 .SH COPYRIGHT 
 Copyright 1988, SRI
 .SH AUTHOR
 Doug Moran <moran@ai.sri.com>
-
diff -urN xc/programs/Xserver/hw/sun.old/kbd_mode.c xc/programs/Xserver/hw/sun/kbd_mode.c
--- xc/programs/Xserver/hw/sun.old/kbd_mode.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/kbd_mode.c	Tue Jul  2 17:30:55 1996
@@ -53,8 +53,37 @@
 #endif
 #else
 #ifndef __NetBSD__
+# ifndef linux
 #include <sundev/kbio.h>
 #include <sundev/kbd.h>
+# else
+#include <asm/kbio.h>
+/*
+ * Commands to the Sun-2 keyboard.
+ */
+#define KBD_CMD_RESET           0x01    /* Reset keyboard as if power-up */
+#define KBD_CMD_BELL            0x02    /* Turn on the bell */
+#define KBD_CMD_NOBELL          0x03    /* Turn off the bell */
+#define KBD_CMD_LED1            0x04    /* Turn on LED 1 */
+#define KBD_CMD_NOLED1          0x05    /* Turn off LED 1 */
+#define KBD_CMD_LED2            0x06    /* Turn on LED 2 */
+#define KBD_CMD_NOLED2          0x07    /* Turn off LED 2 */
+ 
+/*
+ * Commands to the Type 3 keyboard.  KBD_CMD_BELL & KBD_CMD_NOBELL work
+ * as well.
+ */
+#define KBD_CMD_CLICK           0x0A    /* Turn on the click annunciator */
+#define KBD_CMD_NOCLICK         0x0B    /* Turn off the click annunciator */
+ 
+/*
+ * Commands to the Type 4 keyboard, in addition to those above.
+ */
+#define KBD_CMD_SETLED          0x0E    /* Set keyboard LED's */
+#define KBD_CMD_GETLAYOUT       0x0F    /* Request that keyboard indicate layout
+ */
+
+# endif
 #else
 #include <machine/kbio.h>
 #include <machine/kbd.h>
@@ -107,9 +136,27 @@
     led = 0;
     if (ioctl(kbd_fd, KIOCSLED, &led))
 	die("Couldn't set LEDs");
+    led = 0xE;
+    if (ioctl(kbd_fd, KIOCSLED, &led))
+	die("Couldn't set LEDs");
+    sleep(1);
+    led = 0x1;
+    if (ioctl(kbd_fd, KIOCSLED, &led))
+	die("Couldn't set LEDs");
+    sleep(1);
+    led = 0;
+    if (ioctl(kbd_fd, KIOCSLED, &led))
+	die("Couldn't set LEDs");
 #endif
 #ifdef KIOCCMD
     click = KBD_CMD_NOCLICK;
+    if (ioctl(kbd_fd, KIOCCMD, &click))
+	die("Couldn't set click");
+    click = KBD_CMD_BELL;
+    if (ioctl(kbd_fd, KIOCCMD, &click))
+	die("Couldn't set click");
+    sleep(1);
+    click = KBD_CMD_NOBELL;
     if (ioctl(kbd_fd, KIOCCMD, &click))
 	die("Couldn't set click");
 #endif
diff -urN xc/programs/Xserver/hw/sun.old/linux.c xc/programs/Xserver/hw/sun/linux.c
--- xc/programs/Xserver/hw/sun.old/linux.c	Thu Jan  1 01:00:00 1970
+++ xc/programs/Xserver/hw/sun/linux.c	Mon Aug 26 09:31:48 1996
@@ -0,0 +1,379 @@
+/* $Xsun: xc/programs/Xserver/hw/xc/programs/Xserver/hw/sun/linux.c,v 3.3 1995/06/24 10:29:11 dawes Exp $ */
+/*
+ * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
+ * Copyright 1993 by David Wexelblat <dwex@goblin.org>
+ * Copyright 1996 by Jakub Jelinek <jj@sunsite.mff.cuni.cz>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Orest Zborowski and David Wexelblat 
+ * not be used in advertising or publicity pertaining to distribution of 
+ * the software without specific, written prior permission.  Orest Zborowski
+ * and David Wexelblat make no representations about the suitability of this 
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ *
+ * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD 
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+ * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID WEXELBLAT BE LIABLE 
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: linux.c /main/4 1995/11/13 05:58:38 kaleb $ */
+
+#define NEED_EVENTS
+#include "sun.h"
+#include <linux/vt.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <asm/ioctls.h>
+#include <signal.h>
+#include <linux/kd.h>
+#include <errno.h>
+#include <stdio.h>
+
+static Bool KeepTty = FALSE;
+static int VTnum = -1;
+static int activeVT = -1;
+int consoleFd = -1;
+int vtno;
+static Bool linuxExiting = FALSE;
+Bool vtRequestsPending = FALSE;
+Bool vtOn = TRUE;
+Bool vtSema = TRUE;
+DevicePtr linuxMouse, linuxKeyboard;
+Bool NoVT = FALSE;
+static int cursorOn = FALSE;
+static console_screen_idx = 0;
+static PixmapPtr ppix = NULL;
+static pointer sunscreen = NULL;
+
+static void linuxEnterLeaveVT(Bool enter)
+{
+    ScreenPtr pScreen = screenInfo.screens[console_screen_idx];
+    PixmapPtr pspix = sunGetScreenPixmap (console_screen_idx);
+    BoxRec pixBox;
+    RegionRec pixReg;
+    DDXPointRec pixPt;
+    int i;
+
+    if (!pspix) return;
+    pixBox.x1 = 0; pixBox.x2 = pScreen->width;
+    pixBox.y1 = 0; pixBox.y2 = pScreen->height;
+    pixPt.x = 0; pixPt.y = 0;
+    (pScreen->RegionInit)(&pixReg, &pixBox, 1);
+    if (enter) {
+        if (pspix->devPrivate.ptr != sunscreen && ppix) {
+            pspix->devPrivate.ptr = sunscreen;
+            sunDoBitBlt(&ppix->drawable, &pspix->drawable, ppix->drawable.bitsPerPixel, &pixReg, &pixPt);
+        }
+    } else {
+    	ppix = (pScreen->CreatePixmap)(pScreen, pScreen->width, 
+    				       pScreen->height, pScreen->rootDepth);
+    	if (ppix) {
+    	    sunDoBitBlt(&pspix->drawable, &ppix->drawable, ppix->drawable.bitsPerPixel, &pixReg, &pixPt);
+    	    sunscreen = pspix->devPrivate.ptr;
+    	    pspix->devPrivate.ptr = ppix->devPrivate.ptr;
+    	}
+    }
+}
+
+void linuxSetConsoleFb (int idx)
+{
+    console_screen_idx = idx;
+}
+
+static void vtRequest(int sig)
+{
+    vtRequestsPending = TRUE;
+    signal(SIGUSR1,vtRequest);
+}
+
+static void linuxEnterLeaveDev(Bool enter)
+{
+    int j;
+
+    if (enter && sunFbs [console_screen_idx].vtchange)
+	(*sunFbs [console_screen_idx].vtchange) (console_screen_idx, enter);
+    linuxEnterLeaveVT(enter);
+    if (enter) {
+    	int fd;
+    	Firm_event evBuf[20];
+    	sunKbdPrivPtr kbdPriv;
+    	DeviceIntPtr pKeyboard;
+    	
+	SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
+	EnableDevice((DeviceIntPtr)linuxMouse);
+	EnableDevice((DeviceIntPtr)linuxKeyboard);
+	pKeyboard = (DeviceIntPtr)LookupKeyboardDevice();
+	kbdPriv = (sunKbdPrivPtr)(pKeyboard->public.devicePrivate);
+	fd = kbdPriv->fd;
+	read (fd, evBuf, sizeof(evBuf));
+    } else {
+    	if (sunFbs [console_screen_idx].vtchange)
+	    (*sunFbs [console_screen_idx].vtchange) (console_screen_idx, enter);
+	DisableDevice((DeviceIntPtr)linuxMouse);
+	DisableDevice((DeviceIntPtr)linuxKeyboard);
+    }
+}
+
+static void VTSwitch()
+{
+    if (NoVT) return;	
+    vtRequestsPending = FALSE;
+    if (vtSema) {
+	if (!linuxExiting)
+	    linuxEnterLeaveDev(FALSE);
+	else
+	    ErrorF("Exiting...\n\n");
+	if (ioctl(consoleFd, VT_RELDISP, 1) < 0) {
+	    if (!linuxExiting)
+	        linuxEnterLeaveDev(TRUE);
+	    else
+	    	ErrorF("Exiting failed\n\n");
+	} else {
+	    CursorPtr pCursor;
+	    sunCursorPtr pCurPriv;
+	
+	    vtSema = FALSE;
+            pCurPriv = (&(GetScreenPrivate(screenInfo.screens[console_screen_idx])->hardwareCursor));
+            if (pCurPriv && pCurPriv->has_cursor && pCurPriv->pCursor != NULL) {
+    	        pCursor = pCurPriv->pCursor;
+	    	sunDisableCursor(screenInfo.screens[console_screen_idx]);
+	    	pCurPriv->pCursor = pCursor;
+    	    }
+	    vtOn = FALSE;
+	}
+    } else {
+	sunCursorPtr pCurPriv;
+	
+    	vtOn = TRUE;
+    	
+        pCurPriv = (&(GetScreenPrivate(screenInfo.screens[console_screen_idx])->hardwareCursor));
+        if (pCurPriv && pCurPriv->has_cursor && pCurPriv->pCursor != NULL) {
+	    sunRealizeCursor(screenInfo.screens[console_screen_idx], pCurPriv->pCursor);
+    	}
+	if (ioctl(consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
+	    vtOn = FALSE;
+	    return;
+	}
+	vtSema = TRUE;
+	sunRefreshColormap (console_screen_idx);
+	linuxEnterLeaveDev(TRUE);
+    }
+}
+
+/* ARGSUSED */
+void linuxBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
+{
+}
+
+/* ARGSUSED */
+void linuxWakeup(pointer blockData, int result, pointer pReadmask)
+{
+    if (vtRequestsPending) VTSwitch();
+}
+
+void OpenLinuxConsole()
+{
+    int i, fd;
+    struct vt_mode VT;
+    char vtname[11];
+    struct vt_stat vts;
+
+    if (NoVT) return;
+    for (i = 0; i < MAXSCREENS; i++)
+    	sunFbs [i].vtchange = 0;
+    if (serverGeneration == 1) 
+    {
+	/* check if we're run with euid==0 */
+	if (geteuid() != 0)
+	{
+	    FatalError("OpenLinuxConsole: Server must be suid root\n");
+	}
+
+	RegisterBlockAndWakeupHandlers(linuxBlock, linuxWakeup, (void *)0);
+	/*
+	 * setup the virtual terminal manager
+	 */
+	if (VTnum != -1)
+	{
+	    vtno = VTnum;
+	}
+	else 
+	{
+	    if ((fd = open("/dev/console",O_WRONLY,0)) < 0) 
+	    {
+		FatalError(
+		    "OpenLinuxConsole: Cannot open /dev/console (%s)\n",
+		    strerror(errno));
+	    }
+	    if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) ||
+		(vtno == -1))
+	    {
+		FatalError("OpenLinuxConsole: Cannot find a free VT\n");
+	    }
+	    close(fd);
+	}
+	ErrorF("(using VT number %d)\n\n", vtno);
+
+	sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
+
+	if (!KeepTty)
+	{
+	    setpgrp();
+	}
+
+	if ((consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
+	{
+	    FatalError("OpenLinuxConsole: Cannot open %s (%s)\n",
+		       vtname, strerror(errno));
+	}
+
+	/* change ownership of the vt */
+	chown(vtname, getuid(), getgid());
+
+	/*
+	 * the current VT device we're running on is not "console", we want
+	 * to grab all consoles too
+	 */
+	chown("/dev/console", getuid(), getgid());
+	chown("/dev/tty0", getuid(), getgid());
+
+	/*
+	 * Linux doesn't switch to an active vt after the last close of a vt,
+	 * so we do this ourselves by remembering which is active now.
+	 */
+	if (ioctl(consoleFd, VT_GETSTATE, &vts) == 0)
+	{
+	    activeVT = vts.v_active;
+	}
+	
+	if (!KeepTty)
+	{
+	    /*
+	     * Detach from the controlling tty to avoid char loss
+	     */
+	    if ((i = open("/dev/tty",O_RDWR)) >= 0)
+	    {
+		ioctl(i, TIOCNOTTY, 0);
+		close(i);
+	    }
+	}
+
+	/*
+	 * now get the VT
+	 */
+	if (ioctl(consoleFd, VT_ACTIVATE, vtno) != 0)
+	{
+	    ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n");
+	}
+	if (ioctl(consoleFd, VT_WAITACTIVE, vtno) != 0)
+	{
+	    ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n");
+	}
+	if (ioctl(consoleFd, VT_GETMODE, &VT) < 0) 
+	{
+	    FatalError ("OpenLinuxConsole: VT_GETMODE failed\n");
+	}
+
+	signal(SIGUSR1, vtRequest);
+
+	VT.mode = VT_PROCESS;
+	VT.relsig = SIGUSR1;
+	VT.acqsig = SIGUSR1;
+	if (ioctl(consoleFd, VT_SETMODE, &VT) < 0) 
+	{
+	    FatalError("OpenLinuxConsole: VT_SETMODE VT_PROCESS failed\n");
+	}
+    }
+    else 
+    {
+	/* serverGeneration != 1 */
+	/*
+	 * now get the VT
+	 */
+	if (ioctl(consoleFd, VT_ACTIVATE, vtno) != 0)
+	{
+	    ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n");
+	}
+	if (ioctl(consoleFd, VT_WAITACTIVE, vtno) != 0)
+	{
+	    ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n");
+	}
+    }
+    return;
+}
+
+void CloseLinuxConsole()
+{
+    struct vt_mode   VT;
+    int j;
+
+    if (NoVT) return;
+    /*
+     * Perform a switch back to the active VT when we were started
+     */
+    for (j = 0; j < MAXSCREENS; j++) {
+    	if (sunFbs[j].fd != -1) {
+    	    if (sunFbs[j].origcmap.count == 16) {
+    	        ioctl(sunFbs[j].fd, FBIOPUTCMAP, &sunFbs[j].origcmap);
+    	    }
+    	    close(sunFbs[j].fd);
+    	}
+    }
+    if (ioctl(consoleFd, VT_GETMODE, &VT) != -1)
+    {
+	VT.mode = VT_AUTO;
+	if (ioctl(consoleFd, VT_SETMODE, &VT) < 0) { /* set dflt vt handling */
+	    ErrorF("OpenLinuxConsole: VT_SETMODE failed\n");
+	}
+    }
+    linuxExiting = TRUE;
+    if (activeVT >= 0)
+    {
+	if (ioctl(consoleFd, VT_ACTIVATE, activeVT) < 0) {
+	    ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n");
+	}
+	if (ioctl(consoleFd, VT_WAITACTIVE, activeVT) < 0) {
+	    ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n");
+	}
+	activeVT = -1;
+    }
+    close(consoleFd);                /* make the vt-manager happy */
+    return;
+}
+
+int linuxProcessArgument (int argc, char *argv[], int i)
+{
+	/*
+	 * Keep server from detaching from controlling tty.  This is useful 
+	 * when debugging (so the server can receive keyboard signals).
+	 */
+	if (!strcmp(argv[i], "-novt"))
+	{
+		NoVT = TRUE;
+		return 1;
+	}
+	if (!strcmp(argv[i], "-keeptty"))
+	{
+		KeepTty = TRUE;
+		return 1;
+	}
+	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
+	{
+		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
+		{
+			UseMsg();
+			VTnum = -1;
+			return 0;
+		}
+		return 1;
+	}
+	return 0;
+}
diff -urN xc/programs/Xserver/hw/sun.old/sun.h xc/programs/Xserver/hw/sun/sun.h
--- xc/programs/Xserver/hw/sun.old/sun.h	Sun Oct  8 11:11:00 1995
+++ xc/programs/Xserver/hw/sun/sun.h	Sat Aug 24 11:54:39 1996
@@ -1,4 +1,3 @@
-
 /* $XConsortium: sun.h /main/56 1995/10/08 11:12:03 kaleb $ */
 
 /*-
@@ -33,10 +32,15 @@
 /* system headers common to both SunOS and Solaris */
 #include <sys/param.h>
 #include <sys/file.h>
-#include <sys/filio.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
 
+#ifndef linux
+#include <sys/filio.h>
+#else
+#include <linux/termios.h>
+#endif
+
 #ifdef SVR4
 # ifdef X_POSIX_C_SOURCE
 #  define _POSIX_C_SOURCE X_POSIX_C_SOURCE
@@ -51,8 +55,8 @@
 
 #include <fcntl.h>
 
-#ifndef __bsdi_
-# ifndef __NetBSD__
+#if !defined(__bsdi_) && !defined(linux)
+# ifndef __NetBSD__ 
 #  ifndef i386
 #   include <poll.h>
 #  else
@@ -86,7 +90,7 @@
 # include <stropts.h>
 # define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000)
 #else
-# ifndef __NetBSD__
+# if !defined (__NetBSD__) && !defined (linux)
 #  include <sun/fbio.h>
 #  include <sundev/kbd.h>
 #  include <sundev/kbio.h>
@@ -99,6 +103,57 @@
 extern int setrlimit();
 extern int getpagesize();
 # else
+#  ifdef linux
+#define KB_KLUNK        0x00            /* Micro Switch 103SD32-2 */
+#define KB_VT100        0x01            /* Keytronics VT100 compatible */
+#define KB_SUN2         0x02            /* Sun-2 custom keyboard */
+#define KB_SUN3         0x03            /* Type 3 Sun keyboard */
+#define KB_SUN4         0x04            /* Type 4 Sun keyboard */
+#define KB_VT220        0x81            /* Emulation vt220 */
+#define KB_VT220I       0x82            /* International vt220 Emulation */
+
+#define KB_ASCII        0x0F            /* Ascii terminal masquerading as kbd */
+
+/*
+ * Commands to the Sun-2 keyboard.
+ */
+#define KBD_CMD_RESET           0x01    /* Reset keyboard as if power-up */
+#define KBD_CMD_BELL            0x02    /* Turn on the bell */
+#define KBD_CMD_NOBELL          0x03    /* Turn off the bell */
+#define KBD_CMD_LED1            0x04    /* Turn on LED 1 */
+#define KBD_CMD_NOLED1          0x05    /* Turn off LED 1 */
+#define KBD_CMD_LED2            0x06    /* Turn on LED 2 */
+#define KBD_CMD_NOLED2          0x07    /* Turn off LED 2 */
+ 
+/*
+ * Commands to the Type 3 keyboard.  KBD_CMD_BELL & KBD_CMD_NOBELL work
+ * as well.
+ */
+#define KBD_CMD_CLICK           0x0A    /* Turn on the click annunciator */
+#define KBD_CMD_NOCLICK         0x0B    /* Turn off the click annunciator */
+ 
+/*
+ * Commands to the Type 4 keyboard, in addition to those above.
+ */
+#define KBD_CMD_SETLED          0x0E    /* Set keyboard LED's */
+#define KBD_CMD_GETLAYOUT       0x0F    /* Request that keyboard indicate layout
+ */
+ 
+/*
+ * Type 4 keyboard LED masks (used to set LED's)
+ */
+#define LED_NUM_LOCK    0x1
+#define LED_COMPOSE     0x2
+#define LED_SCROLL_LOCK 0x4
+#define LED_CAPS_LOCK   0x8
+
+# include <asm/fbio.h>
+# include <asm/kbio.h>
+# include <asm/vuid_event.h>
+# include <asm/memreg.h>
+# include <signal.h>
+#endif
+
 #  ifdef __NetBSD__
 #   include <machine/fbio.h>
 #   include <machine/kbd.h>
@@ -113,6 +168,21 @@
 #  endif
 # endif
 #endif
+
+/*
+ * Sun doesn't see fit to add the TCX to <sys/fbio.h>
+ */
+#ifdef SVR4
+/* On SunOS 4.1.x the TCX pretends to be a CG3 */
+#define XFBTYPE_TCX		21
+#define XFBTYPE_LASTPLUSONE	22
+#else
+#ifdef linux
+#define XFBTYPE_TCX FBTYPE_TCXCOLOR
+#define XFBTYPE_LASTPLUSONE	22
+#endif
+#endif
+
 extern int gettimeofday();
 
 /* 
@@ -168,6 +238,7 @@
 # define BWTWO2DEV	"/dev/fbs/bwtwo2"
 # define BWTWO3DEV	"/dev/fbs/bwtwo3"
 # define CGEIGHT0DEV	"/dev/fbs/cgeight0"
+# define TCX0DEV	"/dev/fbs/tcx0"
 #else
 # define CGTWO0DEV	"/dev/cgtwo0"
 # define CGTWO1DEV	"/dev/cgtwo1"
@@ -187,6 +258,10 @@
 # define BWTWO2DEV	"/dev/bwtwo2"
 # define BWTWO3DEV	"/dev/bwtwo3"
 # define CGEIGHT0DEV	"/dev/cgeight0"
+# define TCX0DEV	"/dev/tcx0"
+# define TCX1DEV	"/dev/tcx1"
+# define TCX2DEV	"/dev/tcx2"
+# define TCX3DEV	"/dev/tcx3"
 #endif
 
 /*
@@ -246,6 +321,16 @@
     struct fbtype   info;	/* Frame buffer characteristics */
     void	    (*EnterLeave)();/* screen switch */
     unsigned char*  fbPriv;	/* fbattr stuff, for the real type */
+#ifdef linux
+    struct fbcmap   origcmap;
+    void	    (*vtchange)(
+#if NeedFunctionPrototypes
+    int /* screen */,
+    int /* enter */
+#endif
+    );
+    void *	    private;
+#endif    
 } fbFd;
 
 typedef Bool (*sunFbInitProc)(
@@ -262,6 +347,12 @@
     char*		name;	/* /usr/include/fbio names */
 } sunFbDataRec;
 
+#ifdef linux
+extern Bool		vtOn;
+#else
+#define vtOn TRUE
+#endif
+
 #ifdef XKB
 extern Bool		noXkbExtension;
 #endif
@@ -477,5 +568,37 @@
     Colormap* /* pCmapList */
 #endif
 );
+
+#ifdef linux
+
+extern void sunDoBitBlt(
+#if NeedFunctionPrototypes
+    DrawablePtr /* ppix */,
+    DrawablePtr /* pspix */,
+    int /* bpp */,
+    RegionPtr /* pixReg */,
+    DDXPointPtr /* pixPt */
+#endif
+);
+
+extern void sunRefreshColormap(
+#if NeedFunctionPrototypes
+    int /* idx */
+#endif
+);
+
+extern PixmapPtr sunGetScreenPixmap(
+#if NeedFunctionPrototypes
+    int /* screen */
+#endif
+);
+
+extern void linuxSetConsoleFb(
+#if NeedFunctionPrototypes
+    int /* idx */
+#endif
+);
+
+#endif
 
 #endif
diff -urN xc/programs/Xserver/hw/sun.old/sunCfb.c xc/programs/Xserver/hw/sun/sunCfb.c
--- xc/programs/Xserver/hw/sun.old/sunCfb.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/sunCfb.c	Sat Aug 24 11:54:56 1996
@@ -97,6 +97,7 @@
 {
     struct fbcmap sunCmap;
 
+    if (!vtOn) return;
     sunCmap.index = dex;
     sunCmap.count = count;
     sunCmap.red = &rmap[dex];
@@ -243,7 +244,7 @@
 
     for (i = 1; i < argc; i++)
 	if (strcmp (argv[i], "-mono") == 0)
-	    ErrorF ("-mono not appropriate for CG3/CG4/CG6\n");
+	    ErrorF ("-mono not appropriate for CG3/CG4/CG6/TCX\n");
 }
 
 /*
@@ -269,8 +270,21 @@
 	cfbCreateDefColormap, sunSaveScreen, 0);
 }
 
-#if !defined(i386) && !defined(__bsdi__) /* { */
+Bool sunTCX8Init (screen, pScreen, argc, argv)
+    int	    	  screen;    	/* what screen am I going to be */
+    ScreenPtr	  pScreen;  	/* The Screen to initialize */
+    int	    	  argc;	    	/* The number of the Server's arguments. */
+    char    	  **argv;   	/* The arguments themselves. Don't change! */
+{
+    checkMono (argc, argv);
+    sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+    return sunInitCommon (screen, pScreen, (off_t) 0,
+	sunCfbScreenInit, CGScreenInit,
+	cfbCreateDefColormap, sunSaveScreen, 0);
+}
 
+#if !defined(i386) && !defined(__bsdi__) /* { */
+#ifndef linux /* Only have definitions for cg6 */
 #ifdef SVR4
 #include <sys/cg2reg.h>
 #else
@@ -399,6 +413,7 @@
 	cfbCreateDefColormap, sunSaveScreen, (int) ((CG4Ptr) 0)->cpixel);
 }
 
+#endif /* !linux */
 #ifdef FBTYPE_SUNFAST_COLOR /* { */
 
 #define CG6_MMAP_OFFSET 0x70000000
@@ -421,8 +436,9 @@
 			sunFbs[screen].info.fb_height + CG6_IMAGE_OFFSET
 	if ((fb = sunMemoryMap (FBSIZE,
 			     (off_t) CG6_MMAP_OFFSET, 
-			     sunFbs[screen].fd)) == NULL)
+			     sunFbs[screen].fd)) == NULL) {
 	    return FALSE;
+        }
 	sunFbs[screen].fb = fb;
 #undef FBSIZE
     }
@@ -436,8 +452,9 @@
 	    sunFbs[screen].info.fb_depth))
 	return FALSE;
     if (sunNoGX == FALSE) {
-	if (!sunGXInit (pScreen, &sunFbs[screen]))
+	if (!sunGXInit (pScreen, &sunFbs[screen])) {
 	    return FALSE;
+	}
     }
     if (!sunCfbFinishScreenInit(pScreen,
 	    sunFbs[screen].fb + CG6_IMAGE_OFFSET,
@@ -445,14 +462,16 @@
 	    sunFbs[screen].info.fb_height,
 	    monitorResolution, monitorResolution, 
 	    sunFbs[screen].info.fb_width,
-	    sunFbs[screen].info.fb_depth))
+	    sunFbs[screen].info.fb_depth)) {
 	return FALSE;
+    }
     if (sunNoGX == FALSE) {
 	miSetZeroLineBias(pScreen, GXZEROLINEBIAS);
     }
     CGScreenInit (pScreen);
-    if (!sunScreenInit (pScreen))
+    if (!sunScreenInit (pScreen)) {
 	return FALSE;
+    }
     sunSaveScreen (pScreen, SCREEN_SAVER_OFF);
     return cfbCreateDefColormap(pScreen);
 }
diff -urN xc/programs/Xserver/hw/sun.old/sunCfb24.c xc/programs/Xserver/hw/sun/sunCfb24.c
--- xc/programs/Xserver/hw/sun.old/sunCfb24.c	Wed Apr  6 00:00:00 1994
+++ xc/programs/Xserver/hw/sun/sunCfb24.c	Sat Aug 24 13:30:08 1996
@@ -1,4 +1,3 @@
-
 /* $XConsortium: sunCfb24.c,v 1.3 94/04/05 11:29:31 dpw Exp $ */
 
 /*
@@ -51,7 +50,7 @@
 #define PIXPG_24BIT_COLOR_INDEX (PIXPG_24BIT_COLOR << 25)
 #define PR_FORCE_UPDATE (1 << 24)
 
-static void CG24UpdateColormap(pScreen, index, count, rmap, gmap, bmap)
+static void sunCG8UpdateColormap(pScreen, index, count, rmap, gmap, bmap)
     ScreenPtr	pScreen;
     int		index, count;
     u_char	*rmap, *gmap, *bmap;
@@ -65,10 +64,10 @@
     sunCmap.blue = &bmap[index];
 
     if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) == -1)
-	FatalError( "CG24UpdateColormap: FBIOPUTCMAP failed\n");
+	FatalError( "sunCG8UpdateColormap: FBIOPUTCMAP failed\n");
 }
 
-static void CG24StoreColors (pmap, ndef, pdefs)
+static void sunCG8StoreColors (pmap, ndef, pdefs)
     ColormapPtr pmap;
     int ndef;
     xColorItem* pdefs;
@@ -96,12 +95,12 @@
       bmap[(i & pVisual->blueMask) >> pVisual->offsetBlue] = (pdefs->blue >> 8);
     pdefs++;
   }
-  CG24UpdateColormap (pmap->pScreen, 0, 256, rmap, gmap, bmap);
+  sunCG8UpdateColormap (pmap->pScreen, 0, 256, rmap, gmap, bmap);
 }
 
 #define CG8_COLOR_OFFSET 0x40000
 
-static void CG24ScreenInit (pScreen)
+static void sunCG8ScreenInit (pScreen)
     ScreenPtr pScreen;
 {
 #ifndef STATIC_COLOR
@@ -117,8 +116,8 @@
     pScreen->InstallColormap = sunInstallColormap;
     pScreen->UninstallColormap = sunUninstallColormap;
     pScreen->ListInstalledColormaps = sunListInstalledColormaps;
-    pScreen->StoreColors = CG24StoreColors;
-    pPrivate->UpdateColormap = CG24UpdateColormap;
+    pScreen->StoreColors = sunCG8StoreColors;
+    pPrivate->UpdateColormap = sunCG8UpdateColormap;
     if (sunFlipPixels) {
 	Pixel pixel = pScreen->whitePixel;
 	pScreen->whitePixel = pScreen->blackPixel;
@@ -135,7 +134,114 @@
 {
     sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
     return sunInitCommon (screen, pScreen, (off_t) 0,
-	cfb32ScreenInit, CG24ScreenInit,
+	cfb32ScreenInit, sunCG8ScreenInit,
 	cfbCreateDefColormap, sunSaveScreen, CG8_COLOR_OFFSET);
 }
 
+#define TCX_MMAP_RAM_OFFSET	0x01000000
+#define TCX_MMAP_CONTROL_OFFSET	0x28000000
+
+#define TCX_CPLANE_MODE	0x3000000
+
+static void sunTCX24UpdateColormap(pScreen, index, count, rmap, gmap, bmap)
+    ScreenPtr	pScreen;
+    int		index, count;
+    u_char	*rmap, *gmap, *bmap;
+{
+}
+
+static void sunTCX24StoreColors (pmap, ndef, pdefs)
+    ColormapPtr pmap;
+    int ndef;
+    xColorItem* pdefs;
+{
+}
+
+static void sunTCX24ScreenInit (pScreen)
+    ScreenPtr pScreen;
+{
+    SetupScreen (pScreen);
+
+    pScreen->InstallColormap = sunInstallColormap;
+    pScreen->UninstallColormap = sunUninstallColormap;
+    pScreen->ListInstalledColormaps = sunListInstalledColormaps;
+    pScreen->StoreColors = sunTCX24StoreColors;
+    pPrivate->UpdateColormap = sunTCX24UpdateColormap;
+    if (sunFlipPixels) {
+	Pixel pixel = pScreen->whitePixel;
+	pScreen->whitePixel = pScreen->blackPixel;
+	pScreen->blackPixel = pixel;
+    }
+}
+
+#ifdef linux
+static void tcx_vtchange (screen, enter)
+    int screen;
+    int enter;
+{
+    unsigned	*p, *q;
+    
+    memset (sunFbs[screen].fb, 0, sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height * 4);
+    if (enter)
+        for (p = sunFbs[screen].private, q = p + sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height; p < q; p++)
+	    *p = (*p & 0xffffff) | TCX_CPLANE_MODE;
+}
+#endif
+
+Bool sunTCX24Init (screen, pScreen, argc, argv)
+    int		    screen;    	/* what screen am I going to be */
+    ScreenPtr	    pScreen;  	/* The Screen to initialize */
+    int		    argc;    	/* The number of the Server's arguments. */
+    char	    **argv;   	/* The arguments themselves. Don't change! */
+{
+    pointer	fb;
+    unsigned	*p, *q;
+
+    if (!sunScreenAllocate (pScreen))
+	return FALSE;
+    if (!sunFbs[screen].fb) {
+#define FBSIZE (size_t) sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height * 4
+	if ((fb = sunMemoryMap (FBSIZE,
+			     (off_t) TCX_MMAP_RAM_OFFSET, 
+			     sunFbs[screen].fd)) == NULL) {
+	    return FALSE;
+        }
+	sunFbs[screen].fb = fb;
+	if ((p = sunMemoryMap (FBSIZE,
+			    (off_t) TCX_MMAP_CONTROL_OFFSET,
+			    sunFbs[screen].fd)) == NULL) {
+	    return FALSE;
+	}
+#ifdef linux
+	sunFbs[screen].vtchange = tcx_vtchange;
+	sunFbs[screen].private = (void *)p;
+#endif	    
+	memset (fb, 0, FBSIZE);
+	for (q = p + (FBSIZE / 4); p < q; p++)
+	    *p = (*p & 0xffffff) | TCX_CPLANE_MODE;
+#undef FBSIZE
+    }
+    sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+    if (!cfb32SetupScreen (pScreen, 
+	    sunFbs[screen].fb,
+	    sunFbs[screen].info.fb_width, 
+	    sunFbs[screen].info.fb_height,
+	    monitorResolution, monitorResolution, 
+	    sunFbs[screen].info.fb_width))
+	return FALSE;
+    if (!cfbSetVisualTypes (24, 1 << TrueColor, 8))
+        return FALSE;
+    if (!cfb32FinishScreenInit (pScreen, 
+	    sunFbs[screen].fb,
+	    sunFbs[screen].info.fb_width, 
+	    sunFbs[screen].info.fb_height,
+	    monitorResolution, monitorResolution, 
+	    sunFbs[screen].info.fb_width))
+	return FALSE;
+    sunTCX24ScreenInit (pScreen);
+    if (!sunScreenInit (pScreen)) {
+	return FALSE;
+    }
+    sunSaveScreen (pScreen, SCREEN_SAVER_OFF);
+    return cfbCreateDefColormap(pScreen);
+}
diff -urN xc/programs/Xserver/hw/sun.old/sunCursor.c xc/programs/Xserver/hw/sun/sunCursor.c
--- xc/programs/Xserver/hw/sun.old/sunCursor.c	Mon Apr 18 00:00:00 1994
+++ xc/programs/Xserver/hw/sun/sunCursor.c	Tue Jun  4 11:06:20 1996
@@ -46,7 +46,7 @@
 
 static void sunLoadCursor();
 
-static Bool
+Bool
 sunRealizeCursor (pScreen, pCursor)
     ScreenPtr	pScreen;
     CursorPtr	pCursor;
@@ -54,6 +54,7 @@
     SetupCursor(pScreen);
     int	    x, y;
 
+    if (!vtOn) return TRUE;
     /* miRecolorCursor does this */
     if (pCurPriv->pCursor == pCursor)
     {
@@ -119,6 +120,7 @@
     DDXPointRec	ptSrc;
     unsigned char   source_temp[1024], mask_temp[1024];
 
+    if (!vtOn) return;
     fbcursor.set = FB_CUR_SETALL;
     fbcursor.enable = 1;
     fbcursor.pos.x = x;
@@ -182,6 +184,7 @@
     SetupCursor(pScreen);
     struct fbcurpos pos;
 
+    if (!vtOn) return;
     pos.x = x;
     pos.y = y;
     ioctl (sunFbs[pScreen->myNum].fd, FBIOSCURPOS, &pos);
@@ -266,6 +269,7 @@
     SetupCursor (pScreen);
     struct fbcursor fbcursor;
 
+    if (!vtOn) return;
     if (pCurPriv->has_cursor)
     {
     	fbcursor.set = FB_CUR_SETCUR;
diff -urN xc/programs/Xserver/hw/sun.old/sunFbs.c xc/programs/Xserver/hw/sun/sunFbs.c
--- xc/programs/Xserver/hw/sun.old/sunFbs.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/sunFbs.c	Thu May 23 19:00:46 1996
@@ -103,7 +103,7 @@
     mapsize = ((int) len + pagemask) & ~pagemask;
     addr = 0;
 
-#if !defined(__bsdi__) && !defined(_MAP_NEW)
+#if !defined(linux) && (!defined(__bsdi__) && !defined(_MAP_NEW))
     if ((addr = (caddr_t) valloc (mapsize)) == NULL) {
 	Error ("Couldn't allocate frame buffer memory");
 	(void) close (fd);
@@ -118,12 +118,13 @@
      */
     if ((int)(mapaddr = (pointer) mmap (addr,
 		mapsize,
-		PROT_READ | PROT_WRITE, MAP_PRIVATE,
-		fd, off)) == -1)
+		PROT_READ | PROT_WRITE, MAP_PRIVATE|_MAP_NEW,
+		fd, off)) == -1){
 	mapaddr = (pointer) mmap (addr,
 		    mapsize,
-		    PROT_READ | PROT_WRITE, MAP_SHARED,
+		    PROT_READ | PROT_WRITE, MAP_SHARED|_MAP_NEW,
 		    fd, off);
+}
     if (mapaddr == (pointer) -1) {
 	Error ("mapping frame buffer memory");
 	(void) close (fd);
@@ -267,8 +268,9 @@
     if (!fb) {
 	if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size, 
 			     offset, 
-			     sunFbs[scrn].fd)) == NULL)
+			     sunFbs[scrn].fd)) == NULL) {
 	    return FALSE;
+        }
 	sunFbs[scrn].fb = fb;
     }
     /* mfbScreenInit() or cfbScreenInit() */
diff -urN xc/programs/Xserver/hw/sun.old/sunGX.c xc/programs/Xserver/hw/sun/sunGX.c
--- xc/programs/Xserver/hw/sun.old/sunGX.c	Tue Aug  1 09:56:00 1995
+++ xc/programs/Xserver/hw/sun/sunGX.c	Fri May 31 13:27:44 1996
@@ -418,7 +418,7 @@
     int width, height;
     int dstx, dsty;
 {
-    if (pSrcDrawable->type != DRAWABLE_WINDOW)
+    if (pSrcDrawable->type != DRAWABLE_WINDOW || !vtOn)
 	return cfbCopyArea (pSrcDrawable, pDstDrawable,
             pGC, srcx, srcy, width, height, dstx, dsty);
     return cfbBitBlt (pSrcDrawable, pDstDrawable,
@@ -552,6 +552,8 @@
     RegionPtr		ret;
     int			(*doBitBlt)();
 
+    if (!vtOn) return cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+    
     if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8)
     {
     	if (bitPlane == 1)
@@ -664,6 +666,11 @@
     int		    n;
     int		    xorg, yorg;
 
+    if (!vtOn) {
+        cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
+        return;
+    }
+
     priv = (cfbPrivGC *) pGC->devPrivates[cfbGCPrivateIndex].ptr;
     prgnClip = priv->pCompositeClip;
     prect = prectInit;
@@ -815,6 +822,10 @@
     register int    r;
     BoxPtr	    extents;
 
+    if (!vtOn) {
+        (gxPriv->FillSpans)(pDrawable, pGC, n, ppt, pwidth, fSorted);
+        return;
+    }
     GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask)
     if (gxPriv->stipple)
 	GXStippleInit(gx,gxPriv->stipple);
@@ -1074,6 +1085,10 @@
     int			old_width = 0;
 #endif
 
+    if (!vtOn) {
+        (gxPriv->PolyFillArc)(pDraw, pGC, narcs, parcs);
+        return;
+    }
     GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
     if (gxPriv->stipple)
 	GXStippleInit(gx,gxPriv->stipple);
@@ -1191,6 +1206,10 @@
     } GXPointRec, *GXPointPtr;
     GXPointPtr	    tri, qua;
 
+    if (!vtOn) {
+        (gxPriv->FillPolygon)(pDrawable, pGC, shape, mode, count, ptsIn);
+        return;
+    }
     if (count < 3)
 	return;
     if (shape != Convex && count > 4)
@@ -1324,6 +1343,10 @@
     int		    r;
     unsigned char   *baseAddr, *loAddr, *hiAddr, *saveAddr = 0, save;
 
+    if (!vtOn) {
+        (gxPriv->PolySegment)(pDrawable, pGC, nseg, pSeg);
+        return;
+    }
     GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
     if (gxPriv->stipple)
 	GXStippleInit(gx,gxPriv->stipple);
@@ -1391,6 +1414,10 @@
     Bool	    careful;
     Bool	    capNotLast;
 
+    if (!vtOn) {
+        (gxPriv->Polylines)(pDrawable, pGC, mode, npt, ppt);
+        return;
+    }
     if (!--npt)
 	return;
     GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask);
@@ -1513,6 +1540,11 @@
     int		    r;
     int		    x, y;
 
+    if (!vtOn) {
+        miPolyRectangle (pDrawable, pGC, nrect, prect);
+        return;
+    }
+    
     GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_N,pGC->planemask);
     if (gxPriv->stipple)
 	GXStippleInit(gx,gxPriv->stipple);
@@ -1551,6 +1583,11 @@
     BoxPtr	    extents;
     BoxRec	    box;
 
+    if (!vtOn) {
+        sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+        (gxPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+        return;
+    }
     clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip;
     extents = &clip->extents;
 
@@ -1634,6 +1671,11 @@
     RegionPtr	    clip;
     unsigned long   rop;
 
+    if (!vtOn) {
+        sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+        (gxPriv->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+        return;
+    }
     widthGlyph = FONTMAXBOUNDS(pfont,characterWidth);
     h = FONTASCENT(pfont) + FONTDESCENT(pfont);
     clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip;
@@ -1744,6 +1786,11 @@
     CharInfoPtr *ppci;		/* array of character info */
     pointer pglyphBase;		/* start of array of glyphs */
 {
+    if (!vtOn) {
+        sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC);
+        (gxPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+        return;
+    }
     sunGXTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (char *) 1);
 }
 
@@ -2380,6 +2427,19 @@
 		pGC->ops->devPrivate.val = 1;
 	    }
 	}
+#ifdef linux	
+	if (newops = cfbMatchCommon (pGC, devPriv))
+	{
+	    gxPriv->FillSpans = newops->FillSpans;
+	    gxPriv->PolyFillArc = newops->PolyFillArc;
+	    gxPriv->FillPolygon = newops->FillPolygon;
+	    gxPriv->PolySegment = newops->PolySegment;
+	    gxPriv->Polylines = newops->Polylines;
+	    gxPriv->PolyGlyphBlt = newops->PolyGlyphBlt;
+	    gxPriv->ImageGlyphBlt = newops->ImageGlyphBlt;
+	}
+#endif	
+	
     }
 
     canGX = pGC->fillStyle == FillSolid || gxPriv->stipple;
@@ -2388,8 +2448,15 @@
     if (new_line)
     {
 	pGC->ops->FillPolygon = miFillPolygon;
-	if (devPriv->oneRect && canGX)
+	if (devPriv->oneRect && canGX) 
+	{
+#ifdef linux	
+	    gxPriv->FillPolygon = miFillPolygon;
+	    if (pGC->fillStyle == FillSolid)
+	        gxPriv->FillPolygon = (devPriv->rop == GXcopy) ? cfbFillPoly1RectCopy : cfbFillPoly1RectGeneral;
+#endif	        
 	    pGC->ops->FillPolygon = sunGXFillPoly1Rect;
+	}
 	if (pGC->lineWidth == 0)
 	{
 	    if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid))
@@ -2420,6 +2487,10 @@
 	    {
 		if (devPriv->oneRect && canGX && widOK)
 		{
+#ifdef linux		
+		    gxPriv->PolySegment = cfb8SegmentSS1Rect;
+		    gxPriv->Polylines = cfb8LineSS1Rect;
+#endif		    
 		    pGC->ops->PolySegment = sunGXPolySeg1Rect;
 		    pGC->ops->Polylines = sunGXPolylines1Rect;
 		}
@@ -2466,6 +2537,13 @@
         {
 	    if (pGC->fillStyle == FillSolid) 
 	    {
+#ifdef linux
+		gxPriv->PolyGlyphBlt = 
+#ifdef WriteBitGroup
+			(devPriv->rop == GXcopy) ? cfbPolyGlyphBlt8 : 
+#endif
+			miPolyGlyphBlt;
+#endif	    
 		if (TERMINALFONT (pGC->font))
 		    pGC->ops->PolyGlyphBlt = sunGXPolyTEGlyphBlt;
 		else
@@ -2483,9 +2561,14 @@
 
 
     if (new_fillspans) {
-	if (canGX)
-	    pGC->ops->FillSpans = sunGXFillSpans;
-	else switch (pGC->fillStyle) {
+	switch (pGC->fillStyle) {
+	case FillSolid:
+	    switch(devPriv->rop) {
+	        case GXcopy: pGC->ops->FillSpans = cfbSolidSpansCopy; break;
+	        case GXxor: pGC->ops->FillSpans = cfbSolidSpansXor; break;
+	        default: pGC->ops->FillSpans = cfbSolidSpansGeneral; break;
+	    }
+	    break;
 	case FillTiled:
 	    if (devPriv->pRotatedPixmap)
 	    {
@@ -2512,6 +2595,12 @@
 	default:
 	    FatalError("cfbValidateGC: illegal fillStyle\n");
 	}
+	if (canGX) {
+#ifdef linux	
+	    gxPriv->FillSpans = pGC->ops->FillSpans;
+#endif	    
+	    pGC->ops->FillSpans = sunGXFillSpans;
+	}
     } /* end of new_fillspans */
 
     if (new_fillarea) {
@@ -2519,6 +2608,11 @@
 	pGC->ops->PolyFillArc = miPolyFillArc;
 	if (canGX)
 	{
+#ifdef linux
+	    gxPriv->PolyFillArc = miPolyFillArc;
+	    if (pGC->fillStyle == FillSolid)
+		gxPriv->PolyFillArc = (devPriv->rop == GXcopy) ? cfbPolyFillArcSolidCopy : cfbPolyFillArcSolidGeneral;	    
+#endif	
 	    pGC->ops->PolyFillArc = sunGXPolyFillArc;
 	    pGC->ops->PolyFillRect = sunGXPolyFillRect;
 	    if (devPriv->oneRect)
@@ -2554,6 +2648,20 @@
     gxPriv = sunGXGetGCPrivate(pGC);
     gxPriv->type = DRAWABLE_WINDOW;
     gxPriv->stipple = 0;
+#ifdef linux    
+    gxPriv->FillSpans = cfbSolidSpansCopy;
+    gxPriv->PolyFillArc = cfbPolyFillArcSolidCopy;
+    gxPriv->FillPolygon = miFillPolygon;
+    gxPriv->PolySegment = cfbSegmentSS;
+    gxPriv->Polylines = cfbLineSS;
+#ifdef WriteBitGroup    
+    gxPriv->PolyGlyphBlt = cfbImageGlyphBlt8;
+    gxPriv->ImageGlyphBlt = cfbPolyGlyphBlt8;
+#else
+    gxPriv->PolyGlyphBlt = miImageGlyphBlt;
+    gxPriv->ImageGlyphBlt = miPolyGlyphBlt;
+#endif    
+#endif    
     return TRUE;
 }
 
@@ -2733,6 +2841,10 @@
     WindowPtr	pBgWin;
     pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr);
 
+    if (!vtOn) {
+    	cfbPaintWindow(pWin, pRegion, what);
+        return;
+    }
     switch (what) {
     case PW_BACKGROUND:
 	stipple = sunGXGetWindowPrivate(pWin);
@@ -2828,6 +2940,11 @@
     WindowPtr pwinRoot;
     extern WindowPtr *WindowTable;
 
+    if (!vtOn) {
+    	cfbCopyWindow(pWin, ptOldOrg, prgnSrc);
+    	return;
+    }
+    
     pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
 
     prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
diff -urN xc/programs/Xserver/hw/sun.old/sunGX.h xc/programs/Xserver/hw/sun/sunGX.h
--- xc/programs/Xserver/hw/sun.old/sunGX.h	Mon Apr 18 00:00:00 1994
+++ xc/programs/Xserver/hw/sun/sunGX.h	Fri May 31 10:27:07 1996
@@ -229,6 +229,89 @@
 typedef struct _sunGXPrivGC {
     int		    type;
     sunGXStipplePtr stipple;
+    
+    void	(* FillSpans)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*nInit*/,
+		DDXPointPtr /*pptInit*/,
+		int * /*pwidthInit*/,
+		int /*fSorted*/
+#endif
+);
+
+    void	(* Polylines)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*mode*/,
+		int /*npt*/,
+		DDXPointPtr /*pptInit*/
+#endif
+);
+
+    void	(* PolySegment)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*nseg*/,
+		xSegment * /*pSegs*/
+#endif
+);
+
+    void	(* PolyArc)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*narcs*/,
+		xArc * /*parcs*/
+#endif
+);
+
+    void	(* FillPolygon)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*shape*/,
+		int /*mode*/,
+		int /*count*/,
+		DDXPointPtr /*pPts*/
+#endif
+);
+
+    void	(* PolyFillArc)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*narcs*/,
+		xArc * /*parcs*/
+#endif
+);
+
+    void	(* ImageGlyphBlt)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*x*/,
+		int /*y*/,
+		unsigned int /*nglyph*/,
+		CharInfoPtr * /*ppci*/,
+		pointer /*pglyphBase*/
+#endif
+);
+
+    void	(* PolyGlyphBlt)(
+#if NeedNestedPrototypes
+		DrawablePtr /*pDrawable*/,
+		GCPtr /*pGC*/,
+		int /*x*/,
+		int /*y*/,
+		unsigned int /*nglyph*/,
+		CharInfoPtr * /*ppci*/,
+		pointer /*pglyphBase*/
+#endif
+);
 } sunGXPrivGCRec, *sunGXPrivGCPtr;
 
 #define sunGXGetGCPrivate(g)	    ((sunGXPrivGCPtr) \
diff -urN xc/programs/Xserver/hw/sun.old/sunInit.c xc/programs/Xserver/hw/sun/sunInit.c
--- xc/programs/Xserver/hw/sun.old/sunInit.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/sunInit.c	Sat Aug 24 12:07:39 1996
@@ -1,4 +1,3 @@
-/* $XConsortium: sunInit.c /main/77 1995/10/05 07:36:49 kaleb $ */
 /*
  * sunInit.c --
  *	Initialization functions for screen/keyboard/mouse, etc.
@@ -50,6 +49,10 @@
 #include    "mi.h"
 #include    "mibstore.h"
 #include    "cfb.h"
+#include <errno.h>
+#ifdef linux
+#include    <sys/stat.h>
+#endif
 
 /* maximum pixmap depth */
 #ifndef SUNMAXDEPTH
@@ -75,6 +78,7 @@
 #define CG4I NULL
 #define CG6I NULL
 #define CG8I NULL
+#define TCXI NULL
 #else /* }{ */
 extern Bool sunCG3Init(
 #if NeedFunctionPrototypes
@@ -85,7 +89,7 @@
 #endif
 );
 #define CG3I sunCG3Init
-#if defined(i386) || defined(__bsdi__) /* { */
+#if defined(linux) || defined(i386) || defined(__bsdi__) /* { */
 #define CG2I NULL
 #define CG4I NULL
 #else /* }{ */
@@ -121,7 +125,23 @@
 #else /* }{ */
 #define CG6I NULL
 #endif /* } */
+
+#ifdef XFBTYPE_TCX  /* { */
+static Bool sunTCXInit(
+#if NeedFunctionPrototypes
+    int /* screen */,
+    ScreenPtr /* pScreen */,
+    int /* argc */,
+    char** /* argv */
+#endif
+);
+#define TCXI sunTCXInit
+#else /* }{ */
+#define TCXI NULL
+#endif /* } */
+
 #if SUNMAXDEPTH > 8 /* { */
+#ifdef FBTYPE_MEMCOLOR /* { */
 extern Bool sunCG8Init(
 #if NeedFunctionPrototypes
     int /* screen */,
@@ -134,6 +154,10 @@
 #else /* }{ */
 #define CG8I NULL
 #endif /* } */
+#else /* }{ */
+#define CG8I NULL
+#endif /* } */
+
 #endif /* } */
 
 extern KeySymsRec sunKeySyms[];
@@ -168,7 +192,7 @@
  * The name member in the following table corresponds to the 
  * FBTYPE_* macros defined in /usr/include/xc/programs/Xserver/hw/sun/fbio.h file
  */
-sunFbDataRec sunFbData[FBTYPE_LASTPLUSONE] = {
+sunFbDataRec sunFbData[XFBTYPE_LASTPLUSONE] = {
   { NULL, "SUN1BW        (bw1)" },
   { NULL, "SUN1COLOR     (cg1)" },
   { BW2I, "SUN2BW        (bw2)" },	
@@ -199,6 +223,9 @@
 #ifdef FBTYPE_MDICOLOR
   { NULL, "MDICOLOR      (cgfourteen)" },
 #endif
+#ifdef XFBTYPE_TCX
+  { TCXI, "TCX           (tcx)" },
+#endif
 #endif /* } */
 };
 
@@ -239,8 +266,15 @@
 #endif /* } */
 #if SUNMAXDEPTH > 8 /* { */
     CGEIGHT0DEV,
+#ifdef XFBTYPE_TCX
+    TCX0DEV,
+#endif
 #endif /* } */
+#ifndef linux
     "/dev/fb"
+#else
+    "/dev/fb0"
+#endif
 };
 #endif /* } */
 
@@ -260,6 +294,40 @@
 };
 #define NUMFORMATS	(sizeof formats)/(sizeof formats[0])
 
+#if SUNMAXDEPTH > 1 /* { */
+#ifdef XFBTYPE_TCX /* { */
+extern Bool sunTCX8Init(
+#if NeedFunctionPrototypes
+    int /* screen */,
+    ScreenPtr /* pScreen */,
+    int /* argc */,
+    char** /* argv */
+#endif
+);
+
+#if SUNMAXDEPTH > 8
+extern Bool sunTCX24Init(
+#if NeedFunctionPrototypes
+    int /* screen */,
+    ScreenPtr /* pScreen */,
+    int /* argc */,
+    char** /* argv */
+#endif
+);
+#endif
+
+static Bool sunTCXInit(int screen, ScreenPtr pScreen, int argc, char** argv)
+{
+#if SUNMAXDEPTH > 8
+    if (sunFbs [screen].info.fb_depth > 8) /* Is it 24bit deep TCX or just tcx-8-bit? */
+    	return sunTCX24Init (screen, pScreen, argc, argv);
+    else
+#endif
+        return sunTCX8Init (screen, pScreen, argc, argv);
+}
+#endif /* } */
+#endif /* } */
+
 /*
  * OpenFrameBuffer --
  *	Open a frame buffer according to several rules.
@@ -279,7 +347,11 @@
     static int		devFbUsed;
 
     sunFbs[screen].fd = -1;
+#ifndef linux    
     if (strcmp (device, "/dev/fb") == 0 && devFbUsed)
+#else
+    if (strcmp (device, "/dev/fb0") == 0 && devFbUsed)
+#endif    
 	return FALSE;
     if (access (device, R_OK | W_OK) == -1)
 	return FALSE;
@@ -311,9 +383,9 @@
 	    if (fbattr)
 		sunFbs[screen].info = fbattr->fbtype;
 	    sunFbs[screen].fbPriv = (pointer) fbattr;
-	    if (fbattr && 
-		fbattr->fbtype.fb_type < FBTYPE_LASTPLUSONE && 
-		!sunFbData[fbattr->fbtype.fb_type].init) {
+	    if ((fbattr) && 
+		(fbattr->fbtype.fb_type < FBTYPE_LASTPLUSONE) && 
+		(!sunFbData[fbattr->fbtype.fb_type].init)) {
 		int _i;
 		ret = FALSE;
 		for (_i = 0; _i < FB_ATTR_NEMUTYPES; _i++) {
@@ -334,6 +406,23 @@
     }
     if (!ret)
 	sunFbs[screen].fd = -1;
+#ifdef linux
+    else {
+        struct stat st;
+        
+        sunFbs[screen].origcmap.index = 0;
+        sunFbs[screen].origcmap.count = 16;
+        sunFbs[screen].origcmap.red = (unsigned char *)xalloc(64);
+        sunFbs[screen].origcmap.green = (unsigned char *)xalloc(64);
+        sunFbs[screen].origcmap.blue = (unsigned char *)xalloc(64);
+        if (ioctl (sunFbs[screen].fd, FBIOGETCMAP, &(sunFbs[screen].origcmap)) < 0)
+            sunFbs[screen].origcmap.count = 0;
+	if (fstat (sunFbs[screen].fd, &st) >= 0) {
+	    if (!(st.st_rdev & 0xff)) {
+	    }
+	}
+    }
+#endif	
     return ret;
 }
 
@@ -442,7 +531,7 @@
  * matter since no 386i has ever been shipped with a type 3 keyboard.
  * SunOS 4.1 no longer needs this kludge.
  */
-#if !defined(i386) && !defined(KIOCGKEY)
+#if !defined(i386) && defined(KIOCGKEY)
 #define TYPE4KEYBOARDOVERRIDE
 #endif
 
@@ -504,7 +593,11 @@
 	}
 #endif
 	sunKbdPriv.fd = open ("/dev/kbd", O_RDWR, 0);
+	if (sunKbdPriv.fd < 0)
+	    FatalError ("Cannot open /dev/kbd, error %d\n", errno);
 	sunPtrPriv.fd = open ("/dev/mouse", O_RDWR, 0);
+	if (sunPtrPriv.fd < 0)
+	    FatalError ("Cannot open /dev/mouse, error %d\n", errno);
 	getKbdType ();
 	if (sunKbdPriv.type == KB_SUN4) {
 	    (void) ioctl (sunKbdPriv.fd, KIOCLAYOUT, &sunKbdPriv.layout);
@@ -520,6 +613,9 @@
     }
 }
 
+#ifdef linux
+extern void OpenLinuxConsole();
+#endif
 /*-
  *-----------------------------------------------------------------------
  * InitOutput --
@@ -579,6 +675,9 @@
 	    ErrorF("InitOutput: can't put stderr in non-block mode\n");
 	}
     }
+#ifdef linux
+    OpenLinuxConsole();
+#endif    
     pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
     pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
     pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@@ -596,16 +695,20 @@
 	for (scr = 0; scr < MAXSCREENS; scr++)
 	    sunFbs[scr].fd = -1;
 	devList = GetDeviceList (argc, argv);
-	for (i = 0, scr = 0; devList[i] != NULL && scr < MAXSCREENS; i++)
-	    if (OpenFrameBuffer (devList[i], scr))
+	for (i = 0, scr = 0; devList[i] != NULL && scr < MAXSCREENS; i++) {
+	    if (OpenFrameBuffer (devList[i], scr)) {
 		scr++;
+            }
+        }
 	sunDevsInited = TRUE;
 	xfree (devList);
     }
-    for (scr = 0; scr < MAXSCREENS; scr++)
-	if (sunFbs[scr].fd != -1)
+    for (scr = 0; scr < MAXSCREENS; scr++) {
+	if (sunFbs[scr].fd != -1) {
 	    (void) AddScreen (sunFbData[sunFbs[scr].info.fb_type].init, 
 			      argc, argv);
+	}
+    }
     (void) OsSignal(SIGWINCH, SIG_IGN);
 }
 
@@ -630,11 +733,18 @@
 {
     DevicePtr	p, k;
     extern Bool mieqInit();
+#ifdef linux
+    extern DevicePtr linuxMouse, linuxKeyboard;
+#endif    
 
     p = AddInputDevice(sunMouseProc, TRUE);
     k = AddInputDevice(sunKbdProc, TRUE);
     if (!p || !k)
 	FatalError("failed to create input devices in InitInput");
+#ifdef linux
+    linuxMouse = p;
+    linuxKeyboard = k;
+#endif	
 
     RegisterPointerDevice(p);
     RegisterKeyboardDevice(k);
@@ -664,7 +774,6 @@
     }
 }
 
-
 #if SUNMAXDEPTH == 8
 
 Bool
@@ -850,14 +959,14 @@
 	bsFuncs = &cfbBSFuncRec;
 	break;
     case 16:
-	pScreen->CloseScreen = cfb16CloseScreen;
+	pScreen->CloseScreen = cfbCloseScreen;
 	pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr =
 	    pScreen->devPrivate;
 	pScreen->devPrivate = oldDevPrivate;
 	bsFuncs = &cfb16BSFuncRec;
 	break;
     case 32:
-	pScreen->CloseScreen = cfb32CloseScreen;
+	pScreen->CloseScreen = cfbCloseScreen;
 	pScreen->devPrivates[cfb32ScreenPrivateIndex].ptr =
 	    pScreen->devPrivate;
 	pScreen->devPrivate = oldDevPrivate;
@@ -887,3 +996,71 @@
 
 #endif  /* SUNMAXDEPTH == 32 */
 #endif  /* SUNMAXDEPTH */
+
+#ifdef linux
+void
+sunDoBitBlt(ppix, pspix, bpp, pixReg, pixPt)
+    DrawablePtr ppix, pspix;
+    int bpp;
+    RegionPtr pixReg;
+    DDXPointPtr pixPt;
+{
+    switch (bpp) {
+    	case 1:
+    	    mfbDoBitblt(ppix, pspix, GXcopy, pixReg, pixPt);
+    	    break;
+#if SUNMAXDEPTH > 1
+    	case 8:
+    	    cfbDoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFF);
+    	    break;
+#endif
+#if SUNMAXDEPTH > 8
+    	case 16:
+    	    cfb16DoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFFFF);
+    	    break;
+    	case 24:
+    	case 32:
+    	    cfb32DoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFFFFFFFF);
+    	    break;
+#endif
+    }
+}
+
+void
+sunRefreshColormap(idx)
+    int idx;
+{
+    SetupScreen(screenInfo.screens[idx]);
+    ColormapPtr cmap;
+
+#if SUNMAXDEPTH > 1
+    /* Hack to restore correct cmap */
+    cmap = pPrivate->installedMap;
+    if (cmap) {
+	WalkTree(cmap->pScreen,TellLostMap,(pointer) &(cmap->mid));
+	pPrivate->installedMap = NULL;
+	sunInstallColormap(cmap);
+    }
+#endif
+}
+
+PixmapPtr
+sunGetScreenPixmap(screen)
+    int screen;
+{
+    ScreenPtr pScreen = screenInfo.screens [screen];
+    
+    switch (pScreen->rootDepth) {
+    	case 1: return (PixmapPtr) pScreen->devPrivate;
+#if SUNMAXDEPTH > 1
+    	case 8:	return (PixmapPtr) pScreen->devPrivate;
+#endif    	
+#if SUNMAXDEPTH > 8
+    	case 16: return (PixmapPtr) pScreen->devPrivates [cfb16ScreenPrivateIndex].ptr;
+    	case 24:
+    	case 32: return (PixmapPtr) pScreen->devPrivates [cfb32ScreenPrivateIndex].ptr;
+#endif
+    	default: ErrorF ("Wrong depth %d\n", pScreen->rootDepth); return NULL;
+    }
+}
+#endif
diff -urN xc/programs/Xserver/hw/sun.old/sunIo.c xc/programs/Xserver/hw/sun/sunIo.c
--- xc/programs/Xserver/hw/sun.old/sunIo.c	Thu Oct  5 07:36:00 1995
+++ xc/programs/Xserver/hw/sun/sunIo.c	Tue Jun  4 11:15:57 1996
@@ -188,7 +188,13 @@
 void
 ddxGiveUp()
 {
+#ifdef linux
+    extern void CloseLinuxConsole();
+#endif    
     AbortDDX ();
+#ifdef linux
+    CloseLinuxConsole();
+#endif    
 }
 
 int
@@ -199,6 +205,13 @@
 {
     extern void UseMsg();
 
+#ifdef linux
+    extern int linuxProcessArgument(int argc, char *argv[], int i);
+    int ret;
+    
+    ret = linuxProcessArgument(argc, argv, i);
+    if (ret) return ret;
+#endif
 #ifndef XKB
     if (strcmp (argv[i], "-ar1") == 0) {	/* -ar1 int */
 	if (++i >= argc) UseMsg ();
@@ -277,4 +290,10 @@
     ErrorF("-cg4frob            don't use the mono plane of the cgfour\n");
     ErrorF("-noGX               treat the GX as a dumb frame buffer\n");
 #endif
+#ifdef linux
+    ErrorF("vtXX                use the specified VT number\n");
+    ErrorF("-keeptty               ");
+    ErrorF("don't detach controlling tty (for debugging only)\n");
+#endif
 }
+
diff -urN xc/programs/Xserver/hw/sun.old/sunKbd.c xc/programs/Xserver/hw/sun/sunKbd.c
--- xc/programs/Xserver/hw/sun.old/sunKbd.c	Sat Feb  3 15:49:00 1996
+++ xc/programs/Xserver/hw/sun/sunKbd.c	Tue Jul  2 17:56:19 1996
@@ -80,6 +80,11 @@
 extern KeySymsRec sunKeySyms[];
 extern SunModmapRec* sunModMaps[];
 
+#ifdef linux
+extern int consoleFd;
+#include <linux/vt.h>
+#endif
+
 long	  	  sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE;
 long	  	  sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY;
 
@@ -783,7 +788,7 @@
 	|| ksym == SunXK_Compose
 	|| (keyModifiers & LockMask))) 
 	return TRUE;
-
+	
     kptr = &device->key->down[keycode >> 3];
     bit = 1 << (keycode & 7);
     if ((*kptr & bit) &&
@@ -835,6 +840,10 @@
     xEvent		xE;
     BYTE		keycode;
     CARD8		keyModifiers;
+#ifdef linux
+    KeySym		ksym;
+    extern Bool		NoVT;
+#endif    
 
     keycode = (fe->id & 0x7f) + MIN_KEYCODE;
 
@@ -855,6 +864,33 @@
     xE.u.keyButtonPointer.time = TVTOMILLI(fe->time);
     xE.u.u.type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress);
     xE.u.u.detail = keycode;
+    
+#ifdef linux
+    if ((device->key->state & ControlMask)
+    	&& (device->key->state & Mod3Mask))
+    	switch (ksym = device->key->curKeySyms.map[(fe->id - 1) * device->key->curKeySyms.mapWidth]) {
+    		case XK_BackSpace:
+    			if (xE.u.u.type == KeyPress)
+    			    GiveUp(0);
+    			return;
+    		case XK_F1:
+    		case XK_F2:
+    		case XK_F3:
+    		case XK_F4:
+    		case XK_F5:
+    		case XK_F6:
+    		case XK_F7:
+    		case XK_F8:
+    		case XK_F9:
+    		case XK_F10:
+    		case XK_F11:
+    		case XK_F12:
+    			if (!NoVT && xE.u.u.type == KeyPress)
+    			    ioctl(consoleFd, VT_ACTIVATE, ksym - XK_F1 + 1);
+    			return;
+    	}
+#endif
+
 #ifdef XKB
     if (noXkbExtension) {
 #endif
diff -ur xc.vanilla/programs/Xserver/include/servermd.h xc/programs/Xserver/include/servermd.h
--- xc.vanilla/programs/Xserver/include/servermd.h	Thu Jan  4 23:21:22 1996
+++ xc/programs/Xserver/include/servermd.h	Thu May 23 19:00:46 1996
@@ -133,7 +133,7 @@
 
 #if (defined(sun) && !(defined(i386) && defined(SVR4))) || \
     (defined(AMOEBA) && (defined(sparc) || defined(mc68000))) || \
-    (defined(__NetBSD__) && (defined(__sparc__) || defined(mc68000)))
+    (defined(__NetBSD__) && (defined(__sparc__) || defined(mc68000))) || (defined(__linux__) && defined(sparc))
 
 #if defined(sun386) || defined(sun5)
 # define IMAGE_BYTE_ORDER	LSBFirst        /* Values for the SUN only */
@@ -313,7 +313,7 @@
      (defined(__NetBSD__) && defined(__i386__)) || \
      defined(__FreeBSD__) || \
      defined(MACH386) || \
-     defined(linux) || \
+     (defined(linux) && !defined(sparc)) || \
      (defined(AMOEBA) && defined(i80386)) || \
      defined(MINIX))
 
diff -ur xc.vanilla/programs/Xserver/mi/miarc.c xc/programs/Xserver/mi/miarc.c
--- xc.vanilla/programs/Xserver/mi/miarc.c	Wed Dec  6 23:05:38 1995
+++ xc/programs/Xserver/mi/miarc.c	Thu May 23 19:00:46 1996
@@ -69,7 +69,7 @@
 #include "Xfuncproto.h"
 
 static double miDsin(), miDcos(), miDasin(), miDatan2();
-double	cbrt(
+extern double	cbrt(
 #if NeedFunctionPrototypes
 	     double
 #endif
diff -ur xc.vanilla/programs/rgb/Imakefile xc/programs/rgb/Imakefile
--- xc.vanilla/programs/rgb/Imakefile	Sat Jan 27 00:22:18 1996
+++ xc/programs/rgb/Imakefile	Tue May 28 10:11:30 1996
@@ -20,7 +20,11 @@
          OBJS = $(OBJS1) $(OBJS2)
      PROGRAMS = $(RGB_PROG) showrgb
 #if !UseRgbTxt
-#ifdef BSD386Architecture
+#if defined(SparcArchitecture) && defined(LinuxArchitecture)
+#define LinuxSparc
+#endif
+
+#if defined(BSD386Architecture) ||defined(LinuxSparc)
     DATAFILES = rgb.db
       DATADEP = rgb.db
 #else
@@ -39,6 +43,9 @@
        DBMLIB = DBMLibrary -lucb
 #endif
 #endif /*!UseRgbTxt */
+#if defined(LinuxSparc)
+       DBMLIB = -ldb
+#endif
 
 all:: $(PROGRAMS) $(DATADEP)
 
diff -ur xc.vanilla/programs/xterm/main.c xc/programs/xterm/main.c
--- xc.vanilla/programs/xterm/main.c	Sun Dec 10 23:23:29 1995
+++ xc/programs/xterm/main.c	Thu May 23 19:00:47 1996
@@ -354,6 +354,40 @@
 #endif
 #endif
 
+#ifdef linux /* Lets undefine all the SunOS specific stuff */
+#undef TIOCHPCL
+#undef TIOCMODG
+#undef TIOCMODS
+#undef TIOCGETP
+#undef TIOCSETP
+#undef TIOCSETN
+#undef TIOCFLUSH
+#undef TIOCSETC
+#undef TIOCGETC
+#undef TIOCTCNTL
+#undef TIOCSIGNAL
+#undef TIOCSETX
+#undef TIOCGETX
+#undef TIOCSSIZE
+#undef TIOCGSIZE
+#undef TIOCUCNTL
+#undef TIOCREMOTE
+#undef TIOCSTART
+#undef TIOCSTOP
+#undef TIOCGLTC
+#undef TIOCSLTC
+#undef TIOCCDTR
+#undef TIOCSDTR
+#undef TIOCCBRK
+#undef TIOCSBRK
+#undef TIOCLGET
+#undef TIOCLSET
+#undef TIOCLBIC
+#undef TIOCLBIS
+#undef TIOCISPACE
+#undef TIOCISIZE
+#endif
+
 #ifndef X_NOT_STDC_ENV
 #include <stdlib.h>
 #else
@@ -405,7 +439,7 @@
 static struct ltchars d_ltc;
 #endif	/* TIOCSLTC */
 
-#ifdef __sgi
+#if defined(__sgi) || (defined(linux) && defined(sparc))
 #undef TIOCLSET /* XXX why is this undef-ed again? */
 #endif
 
@@ -437,6 +471,9 @@
 /* allow use of system default characters if defined and reasonable */
 #ifndef CEOF
 #define CEOF ('D'&037)
+#endif
+#ifndef CDSUSP
+#define CDSUSP ('Y'&037)
 #endif
 #ifndef CSUSP
 #define CSUSP ('Z'&037)
