diff --git a/src/uifc/Common.gmake b/src/uifc/Common.gmake
index d6f8497c33c313834fb063726c6620b1c11ae3ec..7c55b960ad28a1f80a528f3e0b9dd1378e236c30 100644
--- a/src/uifc/Common.gmake
+++ b/src/uifc/Common.gmake
@@ -1,6 +1,7 @@
 # Available Options:
 # NEED_CURSES       = Set flags suitable for building with the curses lib
 # NEED_UIFC			= Set flags for use with UIFC
+# XCURSES			= Use XCurses
 
 # You really should set this first.
 UIFC_SRC	?=	$(XPDEV)../uifc/
@@ -27,15 +28,25 @@ endif
 ifdef USE_UIFC32
  UIFC_CFLAGS +=	-DUSE_UIFC32
  UIFC_OBJS +=	$(LIBODIR)/uifc32.o
+ USE_CIOWRAP	:=	1
+endif
+ifdef USE_CIOWRAP
  UIFC_OBJS +=	$(LIBODIR)/ciowrap.o
  UIFC_NEED_CURSES	:=	1
 endif
 
 # Curses Stuff
-ifeq ($(os),qnx)
- CURSES_LDFLAGS += -lncurses
+ifdef XCURSES
+ CURSES_LDFLAGS += -lXCurses -L/usr/local/lib -lXaw -lXmu -lXt -lX11 -lSM -lICE -lXext -L/usr/X11R6/lib
+ CURSES_CFLAGS	+= -DXCURSES -I/usr/local/include
 else
- CURSES_LDFLAGS += -lcurses
+ ifeq ($(os),qnx)
+  CURSES_LDFLAGS += -lncurses
+  CURSES_CFLAGS	+= -DN_CURSES_LIB
+ else
+  CURSES_LDFLAGS += -lcurses
+  CURSES_CFLAGS	+= -DCURSES_LIB
+ endif
 endif
 
 ifdef NEED_CURSES
diff --git a/src/uifc/ciowrap.c b/src/uifc/ciowrap.c
index 4769eac2728650c0cca3843859f81a993ded9be7..d04c62b110c2b2850e4dc02730856f9955257dbe 100644
--- a/src/uifc/ciowrap.c
+++ b/src/uifc/ciowrap.c
@@ -601,7 +601,13 @@ void initciowrap(long inmode)
 {
 	short	fg, bg, pair=0;
 
+#ifdef XCURSES
+	char	*argv[2]={"Syhcnronet",NULL};
+
+	Xinitscr(1,argv);
+#else
 	initscr();
+#endif
 	start_color();
 	cbreak();
 	noecho();
diff --git a/src/uifc/curs_fix.h b/src/uifc/curs_fix.h
index ac25b9c44128e06566e5cf4ec8d3c830f80138c6..886a25ccf682bf96a391895928eb6827a7928a58 100644
--- a/src/uifc/curs_fix.h
+++ b/src/uifc/curs_fix.h
@@ -1,6 +1,16 @@
 /* $Id$ */
 
-#include <curses.h>
+#ifdef XCURSES
+ #include <xcurses.h>
+#endif
+
+#ifdef N_CURSES_LIB
+ #include <ncurses.h>
+#endif
+
+#ifdef CURSES_LIB
+ #include <curses.h>
+#endif
 
 #ifndef	ACS_SBSD
 #define ACS_SBSD	ACS_SBSS
diff --git a/src/uifc/uifc.c b/src/uifc/uifc.c
index 9b00be56b1a4f217aa018a09178c256220463cec..daece59db00d39d617da4c84ee4449707bbf6de3 100644
--- a/src/uifc/uifc.c
+++ b/src/uifc/uifc.c
@@ -335,7 +335,7 @@ static void truncsp(char *str)
 	uint c;
 
 	c=strlen(str);
-	while(c && (uchar)str[c-1]<=SP) c--;
+	while(c && (uchar)str[c-1]<=' ') c--;
 	str[c]=0;
 }
 
@@ -1200,7 +1200,7 @@ in_win[i++]='
 in_win[i++]=hclr|(bclr<<4);
 
 if(plen) {
-	in_win[i++]=SP;
+	in_win[i++]=' ';
 	in_win[i++]=lclr|(bclr<<4); }
 
 for(c=0;prompt[c];c++) {
@@ -1213,7 +1213,7 @@ if(plen) {
 	c++; }
 
 for(c=0;c<max+2;c++) {
-	in_win[i++]=SP;
+	in_win[i++]=' ';
 	in_win[i++]=lclr|(bclr<<4); }
 
 in_win[i++]='�';
@@ -1392,7 +1392,7 @@ while(1) {
 						gettext(wherex()+1,y,wherex()+(j-i),y,buf);
 						puttext(wherex(),y,wherex()+(j-i)-1,y,buf);
 						gotoxy(wherex()+(j-i),y);
-						putch(SP);
+						putch(' ');
 						gotoxy(wherex()-((j-i)+1),y);
 						for(k=i;k<j;k++)
 							str[k]=str[k+1];
@@ -1412,7 +1412,7 @@ while(1) {
 				gettext(wherex(),y,wherex()+(j-i),y,buf);
 				puttext(wherex()-1,y,wherex()+(j-i)-1,y,buf);
 				gotoxy(wherex()+(j-i),y);
-				putch(SP);
+				putch(' ');
 				gotoxy(wherex()-((j-i)+2),y);
 				i--;
 				j--;
@@ -1438,7 +1438,7 @@ while(1) {
 			continue;
 		if(mode&K_ALPHA && !isalpha(ch))
 			continue;
-		if((ch>=SP || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max)) {
+		if((ch>=' ' || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max)) {
 			if(mode&K_UPPER)
 				ch=toupper(ch);
 			if(ins) {
@@ -1624,7 +1624,7 @@ void upop(char *str)
 		showmouse();
 		return; }
 	gettext(28,12,53,14,sav);
-	memset(buf,SP,25*3*2);
+	memset(buf,' ',25*3*2);
 	for(i=1;i<26*3*2;i+=2)
 		buf[i]=(hclr|(bclr<<4));
 	buf[0]='�';
@@ -1689,7 +1689,7 @@ void help()
 		return; }
 	hidemouse();
 	gettext(1,1,80,25,savscrn);
-	memset(buf,SP,76*21*2);
+	memset(buf,' ',76*21*2);
 	for(i=1;i<76*21*2;i+=2)
 		buf[i]=(hclr|(bclr<<4));
 	buf[0]='�';
diff --git a/src/uifc/uifc.h b/src/uifc/uifc.h
index 27c58f6f3f2b98073882d5826f6e93db624275f9..88d7d43492d1a140ee72223e388722382347fd95 100644
--- a/src/uifc/uifc.h
+++ b/src/uifc/uifc.h
@@ -215,7 +215,6 @@
 #define FF		0x0c				/* Form feed				^L	*/
 #define CR		'\r'				/* Carriage return			^M	*/
 #define ESC 	0x1b				/* Escape					^[	*/
-#define SP      ' '                 /* Space                        */
 #define DEL     0x7f                /* Delete                   ^BS */
 #endif
 
diff --git a/src/uifc/uifcc.c b/src/uifc/uifcc.c
index 03ee0f0fa696f15f6fa3cb0d67f187e825ab5cee..143f116a84e7ac0a0904d73b30d32c4fbaa1dc89 100644
--- a/src/uifc/uifcc.c
+++ b/src/uifc/uifcc.c
@@ -392,7 +392,7 @@ static void truncsp(char *str)
 	uint c;
 
 	c=strlen(str);
-	while(c && (uchar)str[c-1]<=SP) c--;
+	while(c && (uchar)str[c-1]<=' ') c--;
 	if(str[c]!=0)	/* don't write to string constants */
 		str[c]=0;
 }
@@ -1260,7 +1260,7 @@ int uinput(int mode, int left, int top, char *prompt, char *str,
 	in_win[i++]=hclr|(bclr<<4);
 
 	if(plen) {
-		in_win[i++]=SP;
+		in_win[i++]=' ';
 		in_win[i++]=lclr|(bclr<<4); 
 	}
 
@@ -1276,7 +1276,7 @@ int uinput(int mode, int left, int top, char *prompt, char *str,
 	}
 
 	for(c=0;c<max+2;c++) {
-		in_win[i++]=SP;
+		in_win[i++]=' ';
 		in_win[i++]=lclr|(bclr<<4); 
 	}
 
@@ -1467,7 +1467,7 @@ static int ugetstr(char *outstr, int max, long mode)
 							gettext(wherex(),y,wherex()+(j-i),y,buf);
 							puttext(wherex()-1,y,wherex()+(j-i)-1,y,buf);
 							gotoxy(wherex()+(j-i),y);
-							putch(SP);
+							putch(' ');
 							gotoxy(wherex()-((j-i)+2),y);
 							i--;
 							j--;
@@ -1482,7 +1482,7 @@ static int ugetstr(char *outstr, int max, long mode)
 						gettext(wherex()+1,y,wherex()+(j-i),y,buf);
 						puttext(wherex(),y,wherex()+(j-i)-1,y,buf);
 						gotoxy(wherex()+(j-i),y);
-						putch(SP);
+						putch(' ');
 						gotoxy(wherex()-((j-i)+1),y);
 						for(k=i;k<j;k++)
 							str[k]=str[k+1];
@@ -1520,7 +1520,7 @@ static int ugetstr(char *outstr, int max, long mode)
 				continue;
 			if(mode&K_ALPHA && !isalpha(ch))
 				continue;
-			if((ch>=SP || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max) && isprint(ch))
+			if((ch>=' ' || (ch==1 && mode&K_MSG)) && i<max && (!ins || j<max) && isprint(ch))
 			{
 				if(mode&K_UPPER)
 					ch=toupper(ch);
@@ -1729,7 +1729,7 @@ void upop(char *str)
 		return; 
 	}
 	gettext(28,12,53,14,sav);
-	memset(buf,SP,25*3*2);
+	memset(buf,' ',25*3*2);
 	for(i=1;i<26*3*2;i+=2)
 		buf[i]=(hclr|(bclr<<4));
 		buf[0]='�';
@@ -1829,7 +1829,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
 	gettext(1,1,api->scrn_width,api->scrn_len,savscrn);
 
 	if(!is_redraw) {
-		memset(buf,SP,width*height*2);
+		memset(buf,' ',width*height*2);
 		for(i=1;i<width*height*2;i+=2)
 			buf[i]=(hclr|(bclr<<4));
 	    buf[0]='�';
@@ -1916,7 +1916,7 @@ void showbuf(int mode, int left, int top, int width, int height, char *title, ch
 		curs_set(1);
 		return; 
 	}
-	memset(textbuf,SP,(width-2-pad-pad)*lines*2);
+	memset(textbuf,' ',(width-2-pad-pad)*lines*2);
 	for(i=1;i<(width-2-pad-pad)*lines*2;i+=2)
 		buf[i]=(hclr|(bclr<<4));
 	i=0;
diff --git a/src/uifc/uifcx.c b/src/uifc/uifcx.c
index fb89fe3f43837d3b07a6de9d246c2148945de9c8..196299d2eef381570b95235a1db6d0ae9bb0b5be 100644
--- a/src/uifc/uifcx.c
+++ b/src/uifc/uifcx.c
@@ -167,7 +167,7 @@ static void truncsp(char *str)
 	uint c;
 
 	c=strlen(str);
-	while(c && (uchar)str[c-1]<=SP) c--;
+	while(c && (uchar)str[c-1]<=' ') c--;
 	str[c]=0;
 }