--- xmille-2.0.orig/save.c
+++ xmille-2.0/save.c
@@ -1,43 +1,46 @@
 #include	"mille.h"
 #include	<sys/types.h>
 #include	<sys/stat.h>
-#include	<sys/time.h>
+#include	<time.h>
+#include        <errno.h>
+#include        <string.h>
+#include        <stdlib.h>
 # ifdef	attron
 #	include	<term.h>
 #	define	_tty	cur_term->Nttyb
-# endif	attron
+# endif	
 
 /*
  * @(#)save.c	1.4 (Berkeley) 7/3/83
  */
 
 typedef	struct stat	Stat;
-typedef	struct tm	Time;
 
 char	*ctime();
 
 int	read(), write();
+char*   GetpromptedInput( char* );
 
 /*
  *	This routine saves the current game for use at a later date
  */
 extern int	errno;
-extern char	*sys_errlist[];
+/* extern char	*sys_errlist[]; */
 
 save() {
 
 	reg char	*sp;
 	reg int		outf;
-	reg Time	*tp;
+	reg time_t	*tp;
 	char		buf[80];
-	Time		tme;
+	time_t		tme;
 	Stat		junk;
 
 	tp = &tme;
 	if (Fromfile && getyn("Same file? "))
-		strcpy(buf, Fromfile);
+	        strncpy(buf, Fromfile,sizeof(buf));
 	else {
-		strcpy (buf, GetpromptedInput ("file: "));
+	        strncpy (buf, GetpromptedInput ("file: "), sizeof(buf));
 		sp = buf + strlen (buf);
 	}
 
@@ -50,12 +53,13 @@
 		return FALSE;
 
 	if ((outf = creat(buf, 0644)) < 0) {
-		error(sys_errlist[errno]);
+		/* error(sys_errlist[errno]); */
+		strerror(errno);
 		return FALSE;
 	}
 	Error (buf);
 	time(tp);			/* get current time		*/
-	strcpy(buf, ctime(tp));
+	strncpy(buf, ctime(tp), sizeof(buf));
 	for (sp = buf; *sp != '\n'; sp++)
 		continue;
 	*sp = '\0';
@@ -87,7 +91,7 @@
 	}
 	varpush(inf, read);
 	close(inf);
-	strcpy(buf, ctime(&sbuf.st_mtime));
+	strncpy(buf, ctime(&sbuf.st_mtime),sizeof(buf));
 	for (sp = buf; *sp != '\n'; sp++)
 		continue;
 	*sp = '\0';
--- xmille-2.0.orig/varpush.c
+++ xmille-2.0/varpush.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+#include <string.h>
 # include	"mille.h"
 
 /*
@@ -6,6 +8,13 @@
 
 int	read(), write();
 
+static void remove_terminating_newline( char* buf )
+{
+    int len = strlen(buf);
+    if ( buf[len-1] == '\n' )
+	buf[len-1] = 0;
+}
+
 /*
  *	push variables around via the routine func() on the file
  * channel file.  func() is either read or write.
@@ -36,7 +45,8 @@
 			char	buf[80];
 over:
 			printf("Debug file:");
-			gets(buf);
+			fgets(buf,80,stdin);
+			remove_terminating_newline(buf);
 			if ((outf = fopen(buf, "w")) == NULL) {
 				perror(buf);
 				goto over;
--- xmille-2.0.orig/ui.c
+++ xmille-2.0/ui.c
@@ -7,6 +7,8 @@
 # include	"mille.h"
 # include	"ui.h"
 # include	<X11/Xutil.h>
+# include       <string.h>
+# include       <stdlib.h>
 
 #ifdef CTRL
 # undef CTRL
@@ -84,7 +86,9 @@
 		return(orig);
 	if (XTextWidth (font, orig, len) < max)
 		return orig;
-	strcpy (buf, orig);
+	if (len > sizeof(buf))
+	    len = sizeof(buf);
+	strncpy (buf, orig, len);
 	do {
 		buf[--len] = '\0';
 	} while (len > 0 && XTextWidth (font, buf, len) >= max);
@@ -399,6 +403,10 @@
 	Colormap	def_cm;
 
 	dpy = XOpenDisplay ((char *) 0);
+	if (!dpy) {
+		printf("Error: Can't open X Display\n");
+		exit(1);
+	}
 	screen = DefaultScreen(dpy);
 	def_cm = DefaultColormap(dpy, screen);
 	
--- xmille-2.0.orig/roll.c
+++ xmille-2.0/roll.c
@@ -7,7 +7,7 @@
 
 # define	reg	register
 
-# if (! defined ultrix && ! defined mips && ! defined vax)
+# if (! defined ultrix && ! defined mips && ! defined vax && ! defined linux && !defined __GNU__ )
 # define	MAXRAND	32767L
 
 roll(ndie, nsides)
--- xmille-2.0.orig/CHANGES
+++ xmille-2.0/CHANGES
@@ -42,3 +42,9 @@
 	Added comments to Imakefile about fonts.
 	Packaged for net submittal.
 	Updated version number (easier for bug reports).
+
+
+2001-03-29  Steve M. Robbins  <steve@nyongwa.montreal.qc.ca>
+
+	* save.c: Include <time.h> to get struct tm, not <sys/time.h>.
+
--- xmille-2.0.orig/move.c
+++ xmille-2.0/move.c
@@ -13,7 +13,10 @@
 		"M_DISCARD", "M_DRAW", "M_PLAY", "M_ORDER"
 	};
 
-char	*playcard (), *sprint ();
+char	*playcard (), 
+        *sprintDecimal( char* format, int arg ),
+        *sprintString( char* format, char* arg );
+
 
 domove()
 {
@@ -185,7 +188,7 @@
 			return ("limit of 50");
 	  case C_50:
 		if (pp->mileage + Value[card] > End)
-			return sprint ("puts you over %d", End);
+			return sprintDecimal ("puts you over %d", End);
 	  case C_25:
 		if (!pp->can_go)
 			return ("cannot move now");
@@ -202,7 +205,7 @@
 
 	  case C_GAS:	case C_SPARE:	case C_REPAIRS:
 		if (pp->battle != opposite(card))
-			return sprint ("can't play \"%s\"", C_name[card]);
+			return sprintString ("can't play \"%s\"", C_name[card]);
 #ifdef ANIMATE
 		animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_BATTLE, card);
 #endif
@@ -214,7 +217,7 @@
 	  case C_GO:
 		if (pp->battle != C_INIT && pp->battle != C_STOP
 		    && !isrepair(pp->battle))
-			return sprint ("cannot play \"Go\" on a \"%s\"",
+			return sprintString ("cannot play \"Go\" on a \"%s\"",
 			    C_name[pp->battle]);
 #ifdef ANIMATE
 		animate_move (Play, ANIMATE_HAND, Card_no, ANIMATE_BATTLE, card);
@@ -321,12 +324,19 @@
 	return 0;
 }
 
-char *
-sprint (string, arg)
+char* sprintDecimal( char* format, int arg )
+{
+	static char	buf[512];
+
+	sprintf (buf, format, arg);
+	return buf;
+}
+
+char* sprintString( char* format, char* arg )
 {
 	static char	buf[512];
 
-	sprintf (buf, string, arg);
+	sprintf (buf, format, arg);
 	return buf;
 }
 
--- xmille-2.0.orig/misc.c
+++ xmille-2.0/misc.c
@@ -2,7 +2,7 @@
 # ifdef	attron
 #	include	<term.h>
 #	define	_tty	cur_term->Nttyb
-# endif	attron
+# endif	
 
 /*
  * @(#)misc.c	1.3 (Berkeley) 7/2/83
--- xmille-2.0.orig/extern.c
+++ xmille-2.0/extern.c
@@ -45,7 +45,7 @@
 		1,	/* C_DRIVE_SAFE */
 		1,	/* C_RIGHT_WAY */
 		0	/* C_INIT */
-	};
+	},
 	Numneed[NUM_CARDS] = {	/* number of cards needed per hand	*/
 		0,	/* C_25 */
 		0,	/* C_50 */
--- xmille-2.0.orig/animate.c
+++ xmille-2.0/animate.c
@@ -9,6 +9,8 @@
 
 extern int	iscolor;
 
+static draw_square();
+
 animate_move (player, orig_type, orig_arg, dest_type, dest_arg)
 {
 #if 0
--- xmille-2.0.orig/mille.c
+++ xmille-2.0/mille.c
@@ -1,14 +1,15 @@
 # include	"mille.h"
 # include	<signal.h>
+# include       <stdlib.h>
 # ifdef attron
 #	include	<term.h>
-# endif	attron
+# endif	
 
 /*
  * @(#)mille.c	1.3 (Berkeley) 5/10/83
  */
 
-int	rub();
+void rub( int );
 
 char	_sobuf[BUFSIZ];
 
@@ -99,9 +100,9 @@
  *	Routine to trap rubouts, and make sure they really want to
  * quit.
  */
-rub() {
+void rub( int signum ) {
 
-	signal(SIGINT, 1);
+	signal(SIGINT, SIG_IGN);
 	if (getyn("Really? "))
 		die();
 	signal(SIGINT, rub);
@@ -112,7 +113,7 @@
  */
 die() {
 
-	signal(SIGINT, 1);
+	signal(SIGINT, SIG_IGN);
 	if (outf)
 		fflush(outf);
 	finish_ui ();
--- xmille-2.0.orig/Imakefile
+++ xmille-2.0/Imakefile
@@ -5,7 +5,7 @@
 /**/# Dana Chee
 /**/#
 #define IHaveSubdirs
-#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS) DEFINES=$(DEFINES)'
+#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS) $(DEFINES)'
 
 HEADERS = ui.h
 SRCS=	comp.c end.c extern.c init.c mille.c misc.c move.c print.c \
@@ -17,6 +17,7 @@
 LOCAL_LIBRARIES =	control/libcontrol.a cards/libcardlib.a $(XLIB) 
 SYS_LIBRARIES = -lm
 SUBDIRS = control cards
+BINDIR = /usr/games
 
 /**/# 
 /**/# This looks better with the timrom12 and timrom12b fonts supplied,
--- xmille-2.0.orig/drawcard.c
+++ xmille-2.0/drawcard.c
@@ -8,6 +8,8 @@
 # include	"ui.h"
 # include	"card.h"
 # include	"background.h"
+# include       <stdlib.h>
+
 
 struct card_init {
 	char	*bits;
@@ -64,6 +66,9 @@
 struct card backside;
 struct card eraseCard;
 
+static drawIm();
+static redisplaybelow();
+
 
 bw_init_cards()
 {
@@ -262,7 +267,6 @@
 struct card	*c;
 {
 	struct displayed	*d, *p;
-	char			*malloc ();
 
 	p = 0;
 	for (d = onscreen; d; d = d->next) {
--- xmille-2.0.orig/control/affirm.c
+++ xmille-2.0/control/affirm.c
@@ -9,6 +9,7 @@
 # include	"co_class.h"
 # include	<sys/time.h>
 # include	<assert.h>
+# include       <string.h>
 
 /*
  *	affirm window on screen
@@ -34,6 +35,9 @@
 extern	GC	co_fore_gc;
 static int	OKstate, CANCELstate;
 
+static int redisplayLabel();
+
+
 int
 co_affirm(title, parent)
 char	*title;
--- xmille-2.0.orig/control/prompted.c
+++ xmille-2.0/control/prompted.c
@@ -9,6 +9,7 @@
 # include	"co_class.h"
 # include	<sys/time.h>
 # include	<assert.h>
+# include       <string.h>
 
 /*
  *	prompted window on screen
@@ -38,6 +39,17 @@
 
 static int	prompted_done;
 
+static int co_promptedEvent();
+static int co_OKstate();
+static int redisplayLabel();
+static int textbox_event();
+static int handle_char();
+static int compute_width();
+static int draw_char();
+static int draw_string();
+static int redisplayText();
+
+
 char *
 co_prompted(title, parent)
 char *title;
@@ -157,7 +169,7 @@
 		prompted_done = 1;
 		break;
 	case '\b':
-	case '\0177':
+	case 127:
 		if (retpointer > returnbuffer) {
 			c = *--retpointer;
 			*retpointer = '\0';
@@ -190,9 +202,10 @@
 draw_char (pos, ch, on)
 {
 	GC	my;
+	char    buf = ch;
 
 	my = on ? co_fore_gc : co_back_gc;
-	XDrawImageString (dpy, textbox, my, pos, TEXTBOX_VP, &ch, 1);
+	XDrawImageString (dpy, textbox, my, pos, TEXTBOX_VP, &buf, 1);
 }
 
 static
--- xmille-2.0.orig/control/dispatch.c
+++ xmille-2.0/control/dispatch.c
@@ -5,6 +5,7 @@
  */
 
 # include	<X11/Xlib.h>
+# include       <stdlib.h>
 
 struct eventGroup {
 	struct eventGroup	*prev;
@@ -54,9 +55,12 @@
 };
 
 
-struct eventGroup	*eventStack, *allocGroup();
+struct eventGroup	*eventStack;
 extern	Display		*dpy;
 
+static struct eventGroup* allocGroup();
+
+
 bindEvent (window, eventMask, func)
 Window		window;
 unsigned long	eventMask;
@@ -135,8 +139,6 @@
 static struct eventGroup *
 allocGroup ()
 {
-	char	*malloc ();
-
 	return (struct eventGroup *) malloc (sizeof (struct eventGroup));
 }
 
--- xmille-2.0.orig/control/button.c
+++ xmille-2.0/control/button.c
@@ -5,6 +5,8 @@
 # include	<X11/Xlib.h>
 # include	<X11/Xutil.h>
 # include	"control.h"
+# include       <string.h>
+# include       <stdlib.h>
 
 extern	Display	*dpy;
 
@@ -31,6 +33,12 @@
 static XContext	perwindowContext;
 static int		nextButton;
 
+static int buttonOn();
+static int buttonOff();
+static int buttonText();
+
+
+
 Button
 CcreateButton (text, width, gc, font, backcolor, borderwidth)
 char		*text;
@@ -40,7 +48,6 @@
 long		backcolor;
 int		borderwidth;
 {
-	char		*malloc ();
 	struct button	*b;
 	int		round, off;
 	int		hround;
