--- xmille-2.0.orig/save.c +++ xmille-2.0/save.c @@ -1,43 +1,46 @@ #include "mille.h" #include #include -#include +#include +#include +#include +#include # ifdef attron # include # 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 +#include # 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 +# include +# include #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 + + * save.c: Include to get struct tm, not . + --- 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 # 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 +# include # ifdef attron # include -# 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 + 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 # include +# include /* * 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 # include +# include /* * 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 +# include 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 # include # include "control.h" +# include +# include 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; --- xmille-2.0.orig/debian/xmille.desktop +++ xmille-2.0/debian/xmille.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=Xmille +GenericName= +Comment= +Icon= +Exec=/usr/games/xmille +Terminal=false +Categories=Application;Game;CardGame; --- xmille-2.0.orig/debian/control +++ xmille-2.0/debian/control @@ -0,0 +1,15 @@ +Source: xmille +Section: games +Priority: optional +Maintainer: Steve M. Robbins +Standards-Version: 3.6.2 +Build-Depends: debhelper (>= 7), xutils-dev, libx11-dev, libxext-dev + +Package: xmille +Architecture: any +Depends: ${shlibs:Depends} +Description: The classic game of Mille Bournes + A card game against the computer in which each player tries to reach 1000 + miles. Each player tries to avoid accidents, flat tires, running out of + gas, and break downs while trying to cause these same maladies in the + opponent. --- xmille-2.0.orig/debian/compat +++ xmille-2.0/debian/compat @@ -0,0 +1 @@ +7 --- xmille-2.0.orig/debian/rules +++ xmille-2.0/debian/rules @@ -0,0 +1,66 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# This file is public domain software, originally written by Joey Hess. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +build: build-stamp +build-stamp: + dh_testdir + + xmkmf + $(MAKE) Makefiles + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + -$(MAKE) clean + rm -f Makefile control/Makefile cards/Makefile + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/ + $(MAKE) DESTDIR=`pwd`/debian/xmille install +# mkdir -p debian/xmille/usr/share/man/man6 +# install --mode=644 xmille.man debian/xmille/usr/share/man/man6/xmille.6 + dh_installman xmille.man + dh_install debian/*.desktop usr/share/applications + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs README + dh_installmenu + dh_installman + dh_installinfo + dh_installchangelogs CHANGES + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- xmille-2.0.orig/debian/menu +++ xmille-2.0/debian/menu @@ -0,0 +1,2 @@ +?package(xmille):command="/usr/games/xmille" needs="X11" \ + section="Games/Card" title="Xmille" --- xmille-2.0.orig/debian/changelog +++ xmille-2.0/debian/changelog @@ -0,0 +1,109 @@ +xmille (2.0-13) unstable; urgency=low + + * debian/compat: Bump from 5 to 7. + + * debian/control: Switch build-dep from xutils to xutils-dev. + Closes: #485717. Dependency on debhelper moves to version >= 7. + Add build-dep on libxext-dev. + + * debian/rules: Install desktop file supplied by Daniel Dickinson. + Closes: #478973. + + -- Steve M. Robbins Wed, 11 Jun 2008 20:35:39 -0500 + +xmille (2.0-12) unstable; urgency=low + + * debian/control: Build-depend on libx11-dev rather than xlibs-dev; + closes: #346996. Update to standards 3.6.2, debhelper v5. + + * debian/rules: Remove DH_COMPAT setting. Create manpage in section 6. + + * debian/compat: New file. + + * various: Fix build warnings by including , , and + removing bogus declarations of malloc(). + + -- Steve M. Robbins Tue, 10 Jan 2006 00:35:09 -0500 + +xmille (2.0-11) unstable; urgency=low + + * control/button.c: Remove malloc() declaration (thanks, Andreas + Jochens). Closes: #297872. + + -- Steve M. Robbins Sun, 13 Mar 2005 23:02:13 -0500 + +xmille (2.0-10) unstable; urgency=low + + * Replace all occurances of strcpy() by strncpy(). Closes: #244516. + * Remove all warning messages by: declaring all static methods before + use, declaring Numneed as type int[] in extern.c, removing extraneous + characters after "#endif", changing signature of rub() to match a + signal handler, etc. + + * debian/control: set standards-version to 3.6.1 (no changes). Add + version to debhelper build-depends. + + -- Steve M. Robbins Sun, 18 Apr 2004 18:47:54 -0400 + +xmille (2.0-9) unstable; urgency=low + + * roll.c: + * save.c: Fixes to allow build on GNU HURD courtesy of James A Morrison. + (Closes: 107183). + + -- Steve M. Robbins Tue, 31 Jul 2001 02:18:28 -0400 + +xmille (2.0-8) unstable; urgency=low + + * Add xlibs-dev to build-depends (Closes: #92960). + + -- Steve M. Robbins Fri, 6 Apr 2001 21:48:26 -0400 + +xmille (2.0-7) unstable; urgency=low + + * New Maintainer (Closes #91805). + * Repackaged using debhelper + - man page in /usr/share/man (Closes #91095). + - docs moved to /usr/share/doc/xmille (Closes #91707). + + -- Steve M. Robbins Thu, 29 Mar 2001 00:03:38 -0500 + +xmille (2.0-6) unstable; urgency=low + + * rules file runs xmkmf (fixes bug #24202) + + -- James A. Treacy Thu, 6 Aug 1998 13:23:46 -0400 + +xmille (2.0-5) unstable; urgency=low + + * rebuilt with newer debmake to fix bad md5sums file. + + -- James A. Treacy Wed, 11 Feb 1998 12:46:31 -0500 + +xmille (2.0-4) unstable; urgency=low + + * added menu entry (fixes #16204) + + -- James A. Treacy Fri, 2 Jan 1998 03:58:55 -0500 + +xmille (2.0-3) unstable; urgency=low + + * New maintainer + * New upstream release (fixes #10659) + * Changed to use strerror() to compile using libc6 (fixes #10796) + + -- James A. Treacy Sat, 18 Oct 1997 14:12:53 -0400 + +xmille (2.0-2) unstable; urgency=low + + * Created a check in ui.c to see that X display is opened to prevent coredump. + + -- Sue Campbell Wed, 30 Apr 1997 00:52:33 -0400 + +xmille (2.0-1) unstable; urgency=low + + * Initial Release + + -- Sue Campbell Mon, 13 Jan 1997 11:58:24 -0500 + + --- xmille-2.0.orig/debian/copyright +++ xmille-2.0/debian/copyright @@ -0,0 +1,8 @@ +This package was debianized by James (Jay) A. Treacy treacy@debian.org on +Mon, 29 Sep 1997 14:12:53 -0400. + +It was downloaded from ftp://ftp.x.org/R5contrib/xmille.tar.Z + +Copyright: + +Public Domain