debian/0000755000000000000000000000000012036611343007165 5ustar debian/menu0000644000000000000000000000015511106342141010047 0ustar ?package(xonix):command="/usr/games/xonix" needs="X11" \ section="Games/Action" title="Xonix" debian/debian-vars.mk0000644000000000000000000000437611312433330011715 0ustar # debian-vars.mk -- Common variables # # Copyright # # Copyright (C) 2005-2009 Jari Aalto # # License # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Description # # This is GNU makefile part, that defines common variables and # macros to be used from debian/rules. To install, add this: # # PACKAGE = foo # include debian/debian-vars.mk ifneq (,) This makefile requires GNU Make. endif PACKAGE ?= foo PIXPACKAGE ?= $(PACKAGE) TOPDIR := $(shell pwd) PKGDIR = $(CURDIR)/debian/$(PACKAGE) SHAREROOTDIR = $(PKGDIR)/usr/share SHAREDIR = $(SHAREROOTDIR)/$(PACKAGE) DOCROOTDIR = $(SHAREROOTDIR)/doc PKGDOCDIR = $(DOCROOTDIR)/$(PACKAGE) SITELISPDIR = $(SHAREROOTDIR)/emacs/site-lisp PKGLISPDIR = $(SITELISPDIR)/$(PACKAGE) DESKTOPDIR = $(SHAREROOTDIR)/applications XSESSIONDIR = $(SHAREROOTDIR)/xsessions LOCALEDIR = $(SHAREROOTDIR)/locale INFODIR = $(SHAREROOTDIR)/info PIXDIR = $(SHAREROOTDIR)/pixmaps PKGPIXDIR = $(SHAREROOTDIR)/pixmaps/$(PIXPACKAGE) MANROOTDIR = $(SHAREROOTDIR)/man MAN1DIR = $(MANROOTDIR)/man1 MAN5DIR = $(MANROOTDIR)/man5 MAN8DIR = $(MANROOTDIR)/man8 LIBROOTDIR = $(PKGDIR)/usr/lib LIBDIR = $(LIBROOTDIR)/$(PACKAGE) LIBPERLDIR = $(LIBROOTDIR)/perl BINDIR = $(PKGDIR)/usr/bin SBINDIR = $(PKGDIR)/usr/sbin GAMEBINDIR = $(PKGDIR)/usr/games INSTALL ?= /usr/bin/install INSTALL_DIR = $(INSTALL) -m 755 -d INSTALL_DATA = $(INSTALL) -p -m 644 # The difference is that "BIN" may contain binary strip option INSTALL_SCRIPT = $(INSTALL) -p -m 755 INSTALL_BIN = $(INSTALL) -p -m 755 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_BIN += -s endif # End of Makefile part debian/postinst0000755000000000000000000000067411553754750011022 0ustar #!/bin/sh set -e OLD=/var/lib/games/xonix/scores OLD2=/var/lib/games/xonix.scores OLD3=/var/games/xonix.scores SCORES=/var/cache/xonix/xonix.scores if [ ! -e $SCORES ]; then if [ -e $OLD ]; then mv $OLD $SCORES rmdir /var/lib/games/xonix elif [ -e $OLD2 ]; then mv $OLD2 $SCORES elif [ -e $OLD3 ]; then mv $OLD3 $SCORES else touch $SCORES fi chown root:games $SCORES chmod 0664 $SCORES fi #DEBHELPER# debian/patches/0000755000000000000000000000000012031511406010606 5ustar debian/patches/15-xonix.c-compiling-fixes.patch0000644000000000000000000000371411330115464016545 0ustar From de4ebba0ba745fadbc0699c027e29e07ef7c4de1 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 16:37:24 +0200 Subject: [PATCH] xonix.c: Unused vars and other compiling fixes Signed-off-by: Jari Aalto --- xonix.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xonix.c b/xonix.c index 87983ab..1f73a80 100644 --- a/xonix.c +++ b/xonix.c @@ -83,6 +83,10 @@ int gLoops; /* Schleifenzaehler im Animate */ /* Forward-Declarations. */ /* ------------------------------------------------------------------------ */ +extern int DrawCompleteInside(void); /* x11.c */ +extern int DisplayHighScore(void); /* x11.c */ +extern void ScorePoints (int points); /* x11.c */ + void Do_New (void); void NewFlyer (void); void NewRunner (void); @@ -739,8 +743,8 @@ Boolean SeedFillUp (int xStart, int yStart, Boolean wayToFill) segStack *fillStack; mySegment sg; Boolean runFlag; - int l, x1, x2, dy; - unsigned char ov, av, nv, wv; + int l; + unsigned char ov, av=0, nv, wv; int i, j, m, n; if ((fillStack = InitSegmentStack ()) == NIL_POINTER) @@ -911,7 +915,6 @@ skip: for (xStart += RATIO; xStart <= sg.xr && unsigned char NewRunnerPosition (void) { - int i, j; Boolean bounced; unsigned char bouncePartner; @@ -1041,7 +1044,6 @@ void FillNewArea (void) int x1, y1, x2, y2; int percent, oldFillCount; Boolean wayToFill; - double bonusFactor; GWorldEntry (); @@ -1094,7 +1096,7 @@ void FillNewArea (void) Boolean NewEaterPosition (void) { - int i, j; + int i; int nextX, nextY; Boolean hbFlag, vbFlag, returnFlag; unsigned char bouncePartner; @@ -1310,7 +1312,7 @@ Boolean VerticalBounceCheck (int x, int y, int size, Boolean NewFlyerPosition (void) { - int i, j; + int i; unsigned char bouncePartner; Boolean returnFlag, vbFlag, hbFlag; -- 1.6.5 debian/patches/10-makefile.patch0000644000000000000000000000143411330115464013631 0ustar From abbeec9ec5f7d525ff14ad34c17c378cc7d9f279 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Tue, 11 Nov 2008 19:43:47 +0200 Subject: [PATCH] Imakefile: Fix LOCAL_LIBRARIES Signed-off-by: Jari Aalto --- Imakefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Imakefile b/Imakefile index 1821410..2621dd4 100644 --- a/Imakefile +++ b/Imakefile @@ -26,7 +26,7 @@ UnsharedLibReferences(XPM,Xpm,$(XPMSRC)) CUTE = -DSEND_MAIL /* cute feature :-) */ DEPLIBS = XawClientDepLibs XpmDepLib -LOCAL_LIBRARIES = XawClientLibs XpmLib MathLibrary +LOCAL_LIBRARIES = XawClientLibs XpmLib EXTRA_DEFINES = -DUSE_X11 -DXONIXDIR=\"$(XONIXDIR)\" $(CUTE) /* CDEBUGFLAGS = DebuggableCDebugFlags */ -- 1.6.5 debian/patches/30-manpage.patch0000644000000000000000000000256111553754750013506 0ustar From 3a20967ed2e8d92fd6002456a15057232f194d5e Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Wed, 27 Jan 2010 22:01:01 +0200 Subject: [PATCH] xonix.man: Fix path and section Signed-off-by: Jari Aalto --- xonix.man | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xonix.man b/xonix.man index fe390be..e8e4b22 100644 --- a/xonix.man +++ b/xonix.man @@ -26,7 +26,7 @@ .\" .\" xonix.man,v 1.7 1995/08/28 10:58:03 j Exp .\" -.TH XONIX 6 +.TH XONIX 6x .SH NAME xonix \- a game .SH SYNOPSIS @@ -71,11 +71,10 @@ The default keys to immediately quit the game are `Q' and `Escape'. Hitting `P' or iconizing the window with the window manager will pause the game; de-iconizing will continue it. -On Posix-compliant systems, there is also a high-score file, -\fB$PROJECTROOT/\fP\fIlib/X11/xonix/scores\fP. It records the top ten -xonix players for that machine. As a special compile-time option, -a mail is sent to the previous xonix score leader when he's lost -his first rank. +There is also a high-score file, \fI/var/cache/xonix/xonix.scores\fP. It +records the top ten xonix players for that machine. As a special +compile-time option, a mail is sent to the previous xonix score leader +when he's lost his first rank. .SH WIDGETS \fIXonix\fP uses the X Toolkit and the Athena Widget Set. -- 1.6.5 debian/patches/23-colon.xbm.patch0000644000000000000000000000144711553754750014001 0ustar From c96af69fc27a1d10da1dcad3a5de997929458474 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 17:19:20 +0200 Subject: [PATCH] colon.xbm: remove unsigned to fix compiling Signed-off-by: Jari Aalto --- colon.xbm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/colon.xbm b/colon.xbm index f083419..4b4395d 100644 --- a/colon.xbm +++ b/colon.xbm @@ -1,6 +1,6 @@ #define colon_width 10 #define colon_height 36 -static unsigned char colon_bits[] = { +static char colon_bits[] = { 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xc7, 0x03, 0x83, 0x03, -- 1.6.5 debian/patches/50-x11.c-free.patch0000644000000000000000000000200312031511406013615 0ustar From: Jari Aalto Subject: Check pointer before calling free() --- x11.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/x11.c +++ b/x11.c @@ -963,7 +963,8 @@ } else fprintf(stderr, "xonix: cannot open high score file\n"); - free(fullname); + if (fullname) + free(fullname); gameover_pending = 0; return; } @@ -973,7 +974,8 @@ if(numentries >= MAXSCORES && gHighScore <= score_rec[0].score) { /* sorry, not among top ten */ - free(fullname); + if (fullname) + free(fullname); if(flock(fileno(high),LOCK_UN) != 0) fprintf(stderr, "xonix: cannot unlock high score file\n"); fclose(high); @@ -1058,7 +1060,8 @@ memset(score_rec[i].full, 0, 65); strncpy(score_rec[i].full, fullname, 64); score_rec[i].tstamp = time(NULL); - free(fullname); + if (fullname) + free(fullname); if((high = freopen(PATH_HIGHSCORE, "w",high)) == NULL) { fprintf(stderr, "xonix: cannot reopen high score file\n"); debian/patches/22-xonix_mask.xbm.patch0000644000000000000000000000153111553754750015040 0ustar From af70242c117ad9be1fd777bd93a1db250a592215 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 17:18:53 +0200 Subject: [PATCH] xonix_mask.xbm: remove unsigned to fix compiling Signed-off-by: Jari Aalto --- xonix_mask.xbm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xonix_mask.xbm b/xonix_mask.xbm index e5b495b..2669f7c 100644 --- a/xonix_mask.xbm +++ b/xonix_mask.xbm @@ -1,6 +1,6 @@ #define xonix_mask_width 25 #define xonix_mask_height 25 -static unsigned char xonix_mask_bits[] = { +static char xonix_mask_bits[] = { 0x0e, 0x00, 0xe0, 0x00, 0x7f, 0x00, 0xfc, 0x01, 0xff, 0x00, 0xfe, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0xc7, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xf8, 0xff, 0x3f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, -- 1.6.5 debian/patches/10-makefile=11-x11.c-CAN-2004-0157-and-other=12-compile-fixes.patch0000644000000000000000000000755111553754750023201 0ustar From d05709429e42a5cc505b55f9728178ddaf86aa45 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 17:16:18 +0200 Subject: [PATCH] x11.c: compiling fixes Signed-off-by: Jari Aalto --- x11.c | 33 ++++++++++++++++++--------------- 1 files changed, 18 insertions(+), 15 deletions(-) diff --git a/x11.c b/x11.c index eb197c5..51f151b 100644 --- a/x11.c +++ b/x11.c @@ -165,7 +165,7 @@ static int screenno; static int depth; static Screen *screen; static Colormap cmap; -static int winx, winy; +/* static int winx, winy; */ static AppResources resources; static int exiting = 0; @@ -174,6 +174,9 @@ Display *dpy; Window canv; Dimension sizex, sizey; +/* Forward declarations */ +extern void Do_New (void); /* xonix.c */ + static GC default_gc, empty_gc; static Pixmap runner_pm, flyer_pm, eater_pm, filled_pm, empty_pm, way_pm; static Dims empty_dims, filled_dims, way_dims; @@ -370,7 +373,7 @@ void x11_init(int argc, char **argv) { XGCValues v; - XColor c, c1; + XColor c1; Cursor cursor; Pixmap cursor_pm, cursor_mask_pm, colon; XColor cursor_fg, cursor_bg; @@ -528,10 +531,10 @@ x11_init(int argc, char **argv) XtGetValues(toplevel, wargs, i); i = 0; - XtSetArg(wargs[i], XtNminWidth, (XtPointer)(unsigned)width); i++; - XtSetArg(wargs[i], XtNmaxWidth, (XtPointer)(unsigned)width); i++; - XtSetArg(wargs[i], XtNminHeight, (XtPointer)(unsigned)height); i++; - XtSetArg(wargs[i], XtNmaxHeight, (XtPointer)(unsigned)height); i++; + XtSetArg(wargs[i], XtNminWidth, (XtArgVal)width); i++; + XtSetArg(wargs[i], XtNmaxWidth, (XtArgVal)width); i++; + XtSetArg(wargs[i], XtNminHeight, (XtArgVal)height); i++; + XtSetArg(wargs[i], XtNmaxHeight, (XtArgVal)height); i++; XtSetValues(toplevel, wargs, i); ttab = XtParseTranslationTable(trans_table); @@ -559,7 +562,7 @@ x11_init(int argc, char **argv) for(i = 0; i < 10; i++) { digit_pms[i] = XCreateBitmapFromData(dpy, XtWindow(statusarea), - digit_bits[i], + (char *)digit_bits[i], /* assume all digits are same size */ d0_width, d0_height); } @@ -590,7 +593,7 @@ x11_init(int argc, char **argv) v.tile = empty_pm; empty_gc = XCreateGC(dpy, canv, GCTile|GCFillStyle, &v); - gMyStatusArea = (char *)malloc(H_STEPS * V_STEPS); + gMyStatusArea = (Ptr)malloc(H_STEPS * V_STEPS); if(gMyStatusArea == 0) XtAppError(app, "No space for status area"); @@ -848,8 +851,8 @@ DoAbout(void) XtGetValues(toplevel, wargs, i); i = 0; - XtSetArg(wargs[i], XtNx, (XtPointer)(x + 10)); i++; - XtSetArg(wargs[i], XtNy, (XtPointer)(y + 10)); i++; + XtSetArg(wargs[i], XtNx, (XtArgVal)(x + 10)); i++; + XtSetArg(wargs[i], XtNy, (XtArgVal)(y + 10)); i++; XtSetValues(about, wargs, i); gameover_pending = 1; @@ -1004,7 +1007,7 @@ DisplayHighScore(void) /* format a text - fork and exec the processes so we can drop privileges */ switch( fork() ) { case -1: /* Error */ - perror(fork); + perror("fork failed"); exit(1); break; case 0: /* Child */ @@ -1119,8 +1122,8 @@ DisplayHighScore(void) XtGetValues(toplevel, wargs, i); i = 0; - XtSetArg(wargs[i], XtNx, (XtPointer)(x + 10)); i++; - XtSetArg(wargs[i], XtNy, (XtPointer)(y + 100)); i++; + XtSetArg(wargs[i], XtNx, (XtArgVal)(x + 10)); i++; + XtSetArg(wargs[i], XtNy, (XtArgVal)(y + 100)); i++; XtSetValues(score_shell, wargs, i); gameover_pending = 1; @@ -1182,8 +1185,8 @@ ExitXonix(int status) XtGetValues(toplevel, wargs, i); i = 0; - XtSetArg(wargs[i], XtNx, (XtPointer)(x + 10)); i++; - XtSetArg(wargs[i], XtNy, (XtPointer)(y + 10)); i++; + XtSetArg(wargs[i], XtNx, (XtArgVal)(x + 10)); i++; + XtSetArg(wargs[i], XtNy, (XtArgVal)(y + 10)); i++; XtSetValues(gameover_shell, wargs, i); if(!gameover_pending++) -- 1.6.5 debian/patches/10-makefile=11-x11.c-CAN-2004-0157-and-other=13-double-free.patch0000644000000000000000000000137711553755210022617 0ustar From b02d1841b859ce4a8c193cb8be1a88bc61ed2612 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 21 Apr 2011 10:18:48 +0300 Subject: [PATCH] Remove extra free() call Organization: Private Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Signed-off-by: Jari Aalto --- x11.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/x11.c b/x11.c index 03d56fc..514b43e 100644 --- a/x11.c +++ b/x11.c @@ -1062,7 +1062,7 @@ DisplayHighScore(void) if((high = freopen(PATH_HIGHSCORE, "w",high)) == NULL) { fprintf(stderr, "xonix: cannot reopen high score file\n"); - free(fullname); + /* free(fullname); */ gameover_pending = 0; return; } -- 1.7.4.1 debian/patches/21-xonix.xbm.patch0000644000000000000000000000144711553754750014032 0ustar From 743d08657e8a45aba3ba9d987ee80dfcdb528ac7 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 17:18:29 +0200 Subject: [PATCH] xonix.xbm: remove unsigned to fix compiling Signed-off-by: Jari Aalto --- xonix.xbm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/xonix.xbm b/xonix.xbm index f5a4189..afecb36 100644 --- a/xonix.xbm +++ b/xonix.xbm @@ -1,6 +1,6 @@ #define xonix_width 25 #define xonix_height 25 -static unsigned char xonix_bits[] = { +static char xonix_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x3e, 0x00, 0xf8, 0x00, 0x66, 0x00, 0xcc, 0x00, 0x8a, 0x00, 0xa2, 0x00, 0x10, 0x83, 0x11, 0x00, 0x20, 0x7c, 0x08, 0x00, 0x20, 0x00, 0x08, 0x00, 0x40, 0xc6, 0x04, 0x00, -- 1.6.5 debian/patches/10-makefile=11-x11.c-CAN-2004-0157-and-other.patch0000644000000000000000000001361211553754750020172 0ustar From 01d38098b85628e90c9a326583ab0facf8b7c339 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Wed, 27 Jan 2010 21:24:07 +0200 Subject: [PATCH] x11.c: CAN-2004-0157 and other changes Signed-off-by: Jari Aalto --- x11.c | 106 +++++++++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 67 insertions(+), 39 deletions(-) diff --git a/x11.c b/x11.c index a1fdcfe..1d6589d 100644 --- a/x11.c +++ b/x11.c @@ -52,8 +52,7 @@ #ifdef __unix #define MAXSCORES 10 /* number of entries in high score table */ -#define PATH_HIGHSCORE XONIXDIR "/scores" -#define PATH_TEMPSCORE XONIXDIR "/score_tmp" +#define PATH_HIGHSCORE "/var/cache/xonix/xonix.scores" #if defined(__unix) && !defined PATH_RMAIL #define PATH_RMAIL "rmail" /* rely on the $PATH */ @@ -61,6 +60,7 @@ #include #include +#include #include #include #include @@ -898,7 +898,6 @@ DisplayHighScore(void) char *fullname = 0, *cp; struct score_rec score_rec[MAXSCORES]; int i, numentries = 0; - char tempname[sizeof(PATH_TEMPSCORE) + 15]; char hugestring[MAXSCORES * 100]; Widget box1, box2, msg, headl, done, area; @@ -926,53 +925,62 @@ DisplayHighScore(void) } else fullname = strdup(pw->pw_gecos); - if((cp = strchr(fullname, ','))) *cp = 0; /* remove trailing garbage */ + cp = strchr(fullname, ','); + if (cp == fullname) { + free(fullname); + fullname = strdup("(No name)"); + } + else if (cp != NULL) + *cp = 0; /* remove trailing garbage */ } else fullname = strdup("(No name)"); /* the strdup() allows to free() it */ - + /* try opening high score file, and read it */ - if((high = fopen(PATH_HIGHSCORE, "r"))) { - for(i = 0; i < 10; i++) { + if((high=fopen(PATH_HIGHSCORE, "r")) && (flock(fileno(high),LOCK_EX)==0)){ + for(i = 0; i < MAXSCORES; i++) { char line[100]; if(fgets(line, 100, high) == NULL) break; - - if(sscanf(line, " %u %u%*[\t]%10[^\t]%*[\t]%64[^\t] %ld", + + if(sscanf(line, "%u%*[\t]%u%*[\t]%10[^\t]%*[\t]%64[^\t]%*[\t]%ld", &score_rec[i].score, &score_rec[i].level, score_rec[i].login, score_rec[i].full, &score_rec[i].tstamp) - != 5) break; /* mangled entry */ + <3 ) break; /* mangled entry */ } numentries = i; - fclose(high); } - if(numentries) - qsort(score_rec, numentries, sizeof(struct score_rec), compare); - - /* make sure the new list will be world-readable */ - (void)umask(umask(0) & ~0644); - sprintf(tempname, "%s.%d", PATH_TEMPSCORE, (int)getpid()); - if((high = fopen(tempname, "w")) == NULL) { - fprintf(stderr, "xonix: cannot rewrite high score file\n"); + else + { + if (high != NULL) { + fprintf(stderr, "xonix: cannot lock high score file\n"); + fclose(high); + } + else + fprintf(stderr, "xonix: cannot open high score file\n"); free(fullname); gameover_pending = 0; return; } + + if(numentries) + qsort(score_rec, numentries, sizeof(struct score_rec), compare); - if(numentries >= MAXSCORES && gHighScore < score_rec[0].score) { + if(numentries >= MAXSCORES && gHighScore <= score_rec[0].score) { /* sorry, not among top ten */ - fclose(high); - (void)unlink(tempname); free(fullname); + if(flock(fileno(high),LOCK_UN) != 0) + fprintf(stderr, "xonix: cannot unlock high score file\n"); + fclose(high); gameover_pending = 0; return; } for(i = 0; i < numentries; i++) { /* look where to put entry */ - if(score_rec[i].score > gHighScore) break; + if(score_rec[i].score >= gHighScore) break; } #ifdef SEND_MAIL @@ -993,19 +1001,32 @@ DisplayHighScore(void) tm = localtime(&sp->tstamp); strftime(tbuf, 20, "%d-%b-%y", tm); - if((mail = popen(cmd, "w")) != NULL) { - fprintf(mail, - "To: %s (%s)\n" - "Subject: Lost xonix championship\n\n" - "Your previously held first rank in the local xonix score\n" - "table (%u points, level %u, dated %s) has been\n" - "vanished today by me with %u points.\n\n" - "\t\tpitying you\t%s (%s)\n", - sp->login, sp->full, - sp->score, sp->level, tbuf, - gHighScore, - pw->pw_name, fullname); - (void)pclose(mail); + /* format a text - fork and exec the processes so we can drop privileges */ + switch( fork() ) { + case -1: /* Error */ + perror(fork); + exit(1); + break; + case 0: /* Child */ + setgid(pw->pw_gid); + setuid(pw->pw_uid); + if((mail = popen(cmd, "w")) != NULL) { + fprintf(mail, + "To: %s (%s)\n" + "Subject: Lost xonix championship\n\n" + "Your previously held first rank in the local xonix score\n" + "table (%u points, level %u, dated %s) has been\n" + "vanished today by me with %u points.\n\n" + "\t\tpitying you\t%s (%s)\n", + sp->login, sp->full, + sp->score, sp->level, tbuf, + gHighScore, + pw->pw_name, fullname); + (void)pclose(mail); + break; + default: /* parent */ + break; + } } } @@ -1036,16 +1057,23 @@ DisplayHighScore(void) score_rec[i].tstamp = time(NULL); free(fullname); + if((high = freopen(PATH_HIGHSCORE, "w",high)) == NULL) { + fprintf(stderr, "xonix: cannot reopen high score file\n"); + free(fullname); + gameover_pending = 0; + return; + } + for(i = 0; i < numentries; i++) (void)fprintf(high, "%u\t%u\t%s\t%s\t%ld\n", score_rec[i].score, score_rec[i].level, score_rec[i].login, score_rec[i].full, score_rec[i].tstamp); + + if(flock(fileno(high),LOCK_UN) != 0) + fprintf(stderr, "xonix: cannot unlock high score file\n"); fclose(high); - if(rename(tempname, PATH_HIGHSCORE)) - fprintf(stderr, "xonix: cannot install new highscore file\n"); - /* create hugestring for highscore label */ hugestring[0] = 0; for(i = 0; i < numentries; i++) { -- 1.6.5 debian/patches/40-xonix.ad.patch0000644000000000000000000000340111553754750013621 0ustar From e9cb4c619382d2cb92029a3eb971f55b7a2086b3 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Thu, 17 Dec 2009 17:36:59 +0200 Subject: [PATCH] Xonix.ad: Change to neutral messages Signed-off-by: Jari Aalto --- Xonix.ad | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Xonix.ad b/Xonix.ad index 673bb71..12a1448 100644 --- a/Xonix.ad +++ b/Xonix.ad @@ -50,7 +50,7 @@ Xonix.timeStep: 50 *score_shell*Box.borderWidth: 0 *score_shell*score_msg.label: Best Xonixers: *score_shell*score_headl.label: Score Level Date User ID Full name -*score_shell*score_done.label: Great! +*score_shell*score_done.label: Ok *score_shell*score_done.background: white ! @@ -83,24 +83,24 @@ Xonix.timeStep: 50 ! ! the game over dialog ! -*gameover_shell.title: Pity! +*gameover_shell.title: Game over *gameover_box.background: khaki *gameover_box.orientation: vertical *gameover_buttonbox.orientation: horizontal *gameover_buttonbox.background: khaki *gameover_buttonbox.borderWidth: 0 -*gameover_msg.label: Game over, dude! +*gameover_msg.label: Game over *gameover_msg.font: -*-new century schoolbook-bold-i-*-*-*-180-*-*-*-*-*-* *gameover_msg.borderWidth: 0 *gameover_msg.foreground: sienna *gameover_msg.background: khaki -*gameover_iknow.label: I know :-( +*gameover_iknow.label: Exit *gameover_iknow.foreground: light yellow *gameover_iknow.background: dark orchid *gameover_iknow.accelerators: #augment \ Q: set() notify() unset() \n\ Escape: set() notify() unset() -*gameover_goon.label: Once more! :) +*gameover_goon.label: Play again *gameover_goon.foreground: light yellow *gameover_goon.background: dark orchid *gameover_goon.accelerators: #augment \ -- 1.6.5 debian/patches/series0000644000000000000000000000056412031511040012022 0ustar 10-makefile.patch 10-makefile=11-x11.c-CAN-2004-0157-and-other.patch 10-makefile=11-x11.c-CAN-2004-0157-and-other=12-compile-fixes.patch 10-makefile=11-x11.c-CAN-2004-0157-and-other=13-double-free.patch 15-xonix.c-compiling-fixes.patch 20-flyer.xpm.patch 21-xonix.xbm.patch 22-xonix_mask.xbm.patch 23-colon.xbm.patch 30-manpage.patch 40-xonix.ad.patch 50-x11.c-free.patch debian/patches/20-flyer.xpm.patch0000644000000000000000000000110611330115464013775 0ustar From 9a817dc2ecb2a0550e0150c15f3f9e62237145ec Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Tue, 11 Nov 2008 19:31:11 +0200 Subject: [PATCH] flyer.xpm: Fix color Signed-off-by: Jari Aalto --- flyer.xpm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/flyer.xpm b/flyer.xpm index 52bfcb2..f7ff99e 100644 --- a/flyer.xpm +++ b/flyer.xpm @@ -2,7 +2,7 @@ static char * flyer_xpm[] = { "8 8 3 1", " c forest green", -". g4 yellow c tomato", +". c yellow", "X c black", " .. ", " .XX. ", -- 1.6.5 debian/compat0000644000000000000000000000000212031512664010364 0ustar 9 debian/control0000644000000000000000000000124412031513105010561 0ustar Source: xonix Section: games Priority: optional Maintainer: Jari Aalto Build-Depends: debhelper (>= 9), xutils-dev, libxaw7-dev, libxpm-dev, libxt-dev, libselinux-dev [linux-any] Standards-Version: 3.9.4 Vcs-Browser: http://git.debian.org/?p=collab-maint/xonix.git Vcs-Git: git://git.debian.org/git/collab-maint/xonix.git Package: xonix Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: game to carve up the screen whilst dodging monsters A clone of the Xonix game for DOS. Start with a rectangle, and munch corners off until you get below the winning area: then proceed to the next level. But beware of the roaming aliens! debian/xonix.manpages0000644000000000000000000000001211312433330012032 0ustar xonix.man debian/changelog0000644000000000000000000002376112031513016011041 0ustar xonix (1.4-30) unstable; urgency=low * debian/control - (Standards-Version): Update to 3.9.4. * debian/patches - (50): New. Check calling free() to avoid crash on double freeing memory (Closes: #688580). -- Jari Aalto Sat, 29 Sep 2012 09:30:12 +0300 xonix (1.4-29) unstable; urgency=low * debian/compat - Update to 9 * debian/control - (Build-Depends): Update to debhelper 9. * debian/copyright - Update to format 1.0. * debian/rules - Use hardened CFLAGS; enable all hardening. http://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags -- Jari Aalto Sat, 24 Mar 2012 03:20:28 -0400 xonix (1.4-28) unstable; urgency=low * debian/control - (Build-Depends) Replace [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386] with [linux-any] wild card to cover any future architecture. Patch thanks to Robert Millan (Closes: #634326). Remove unused libxp-dev (Closes: #623658). * debian/rules - (CC): New. Define for imake. - Simplify everything already handled by dh(1). -- Jari Aalto Tue, 20 Sep 2011 12:12:06 +0300 xonix (1.4-27) unstable; urgency=low * debian/changelog - Correct line placement in 1.4-26. * debian/compat - Update to 8. * debian/control - (Build-Depends): update debhelper 8. - (Standards-Version): Update to 3.9.2. - (Conflicts): Remove. There is not package suidmanager any longer in archives. * debian/copyright - Update to DEP5. * debian/patches - (13): New. Remove double free() call (Closes: #623547). -- Jari Aalto Thu, 21 Apr 2011 10:24:54 +0300 xonix (1.4-26) unstable; urgency=low * debian/control - (Build-Depends): update debhelper to 7.1 due to override in debian/rules. - (Standards-Version): Update to 3.8.4. * debian/debian-vars.mk - Remove. Obsolete by dh(1) changes in debian/rules. * debian/patches - (10-makefile=11): Change score file from /var/games to FHS compliant /var/cache/xonix directory. * debian/postinst - Relocate scores to /var/cache/xonix/xonix.scores. * debian/postrm - Handle new directories. * debian/rules - Remove rules that can be done with dh(1). * debian/xonix.dirs - Add var/cache/xonix. This creates game score directory during install (Closes: #566577). * debian/xonix.install - Add *.ad file install. -- Jari Aalto Sat, 13 Feb 2010 15:18:55 +0200 xonix (1.4-25) unstable; urgency=low * Move to format: 3.0 (quilt). * debian/clean - Move content from debian/rules for dh(1). * debian/control - (Priority): Change from extra to optional (FTP masters; override file fix) - (Build-Depends): Remove dpatch. - (Depends): add ${misc:Depends} for debhelper. - (Standards-Version): Update to 3.8.3. * debian/copyright - Layout upgrade. Add FSF preamble. * debian/debian-vars.mk - New file. * debian/patches - Convert to quilt. - (10=11, 10=11=12, 21, 22, 23): Add new patches to tackle all compiling warning. - (40) Change widget texts to neutral tone. * debian/rules - (MANSECT): Move from 1x to standard 1. - Remove rules obsoleted by dh(1). * debian/xonix.{dirs,install,manpages} - Move content from debian/rules for dh(1). -- Jari Aalto Thu, 17 Dec 2009 17:48:05 +0200 xonix (1.4-24) unstable; urgency=low * New maintainer (Closes: #486775). * debian/changelog - Remove EOL whitespaces. * debian/control - (Build-Depend): Add dpatch. - (Standards-Version): Update to 3.8.0. - (Description): Justify text. * debian/copyright - Update to latest dh-make template. * debian/{prerm,postinst} - Add "set -e" (lintian fix). * debian/patches/ - Convert single *diff.gz into individual patches. - Patch manual page to use 6x (Closes: #440819). - (40-xonix.ad.dpatch): New. Say simply 'Game over'. * debian/watch - New file. -- Jari Aalto Tue, 11 Nov 2008 20:50:02 +0200 xonix (1.4-23) unstable; urgency=low * QA upload. + Set maintainer to QA group. * Replace build-dependency on xutils with xutils-dev. * Bump debhelper compat level from unspecified to 7. * Also exclude libselinux-dev from build deps on kfreebsd-amd64 (closes: #451115) * Fix chown call in postinst. * Fix path to scores file in man page. -- Frank Lichtenheld Thu, 24 Jul 2008 02:57:31 +0200 xonix (1.4-22) unstable; urgency=low * use debian maintainer numbering, not debian NMU numbering (Doh!) -- Adrian Bridgett Sun, 9 Jul 2006 10:05:26 +0100 xonix (1.4-21.2) unstable; urgency=low * ack of NMU - thanks Baruch * libselinux build dependency only required for Linux (closes: #336947) * reverted "no-turnaround" change as it breaks on captured ground. (closes: #252821) -- Adrian Bridgett Sun, 9 Jul 2006 09:33:33 +0100 xonix (1.4-21.1) unstable; urgency=low * NMU * Fix build issues of gcc 4.0 (closes: #259939) * Other build issues: - New build dependency on libxp-dev - New build dependency on libselinux-dev -- Baruch Even Tue, 9 Aug 2005 12:43:33 +0100 xonix (1.4-21) unstable; urgency=high * incorporate security fix from security team (closes: #243948) * Drop privileges before invoking external mailer command when highscores are achieved. (CAN-2004-0157) * ignore U-turns rather than killing the player (closes: #244103) * hopefully update build dependencies -- Adrian Bridgett Mon, 3 May 2004 14:42:44 +0100 xonix (1.4-20) unstable; urgency=low * rebuild to pickup libxaw7-dev (closes: #169987) * use dpkg-statoverride not suidmanager -- Adrian Bridgett Sun, 5 Jan 2003 13:37:24 +0000 xonix (1.4-19) unstable; urgency=low * patch from James Morrison so that xonix can compile on Hurd (closes: #107315) * stop xonix losing scores - thanks to Norbert Warmuth (closes: #39600) -- Adrian Bridgett Tue, 7 Aug 2001 22:58:16 +0100 xonix (1.4-18) unstable; urgency=low * add libxaw-dev to build-depends (closes: #102801) * move high scores to /var/games (better FHS compliance) -- Adrian Bridgett Mon, 2 Jul 2001 22:46:18 +0100 xonix (1.4-17) unstable; urgency=low * app-defaults files are conffiles -- Adrian Bridgett Sun, 4 Mar 2001 18:47:08 +0000 xonix (1.4-16) unstable; urgency=low * added xutils to build-depends (closes: #86973) * use new location of app-defaults (closes: #86323) -- Adrian Bridgett Sat, 3 Mar 2001 15:42:39 +0000 xonix (1.4-15) unstable; urgency=low * add Build-Depends (closes: #84670) -- Adrian Bridgett Sun, 4 Feb 2001 18:32:18 +0000 xonix (1.4-14) unstable; urgency=low * FHS (/usr/share/*) * recompile to fix dependencies (closes: #67961) -- Adrian Bridgett Mon, 31 Jul 2000 21:50:33 +0100 xonix (1.4-13) unstable; urgency=low * removed icon="none" from menu entry * fixed one line description -- Adrian Bridgett Sat, 26 Dec 1998 16:39:40 +0000 xonix (1.4-12) unstable; urgency=low * fixed score file handling (no longer a conffile) * moved manpage to /usr/man/man6 -- Adrian Bridgett Tue, 17 Mar 1998 22:22:11 +0000 xonix (1.4-11) unstable; urgency=low * compress manpage -- Adrian Bridgett Thu, 12 Feb 1998 21:10:00 +0000 xonix (1.4-10) unstable; urgency=low * allow GECOS (name) fields of ",,," (finally fixes 16321!) -- Adrian Bridgett Sat, 31 Jan 1998 13:09:04 +0000 xonix (1.4-9) unstable; urgency=low * another attempt to stop losing high-score (16321) -- Adrian Bridgett Sun, 25 Jan 1998 16:07:45 +0000 xonix (1.4-8) unstable; urgency=low * lock high score table and don't open it twice (fixes 16321 hopefully) -- Adrian Bridgett Tue, 20 Jan 1998 22:39:23 +0000 xonix (1.4-7) unstable; urgency=low * -h * fixed dependencies [#12645, #12898, #13067] * updated to standards 2.3.0.0 * fixed scores permissions [#5879] * new maintaner -- Adrian Bridgett Wed, 22 Oct 1997 19:16:04 +0000 xonix (1.4-6.1) unstable; urgency=low * non-maintainer release. * libc6 compile. -- Martin Mitchell Wed, 22 Oct 1997 20:42:43 +1000 xonix (1.4-6) unstable; urgency=low * updated to Standards-Version 2.1.0.0. -- Sven Rudolph Thu, 24 Oct 1996 14:24:18 +0200 Wed Aug 21 16:46:35 1996 Sven Rudolph * debian.rules: set xonix and /var dir setgrp games (Bug#4219) * debian.control: changed Priority: extra to optional Wed Jul 24 22:25:19 1996 Sven Rudolph * 1.4-4 released * debian.control: corrected extended description (Bug#3666) * debian.rules: corrected multi-architecture support Mon Jun 3 12:29:46 1996 Sven Rudolph * debian.control: changed Priority: Xtr to extra Sun Jun 2 19:56:15 1996 Sven Rudolph * 1.4-3 released * debian.control: added Architecture:, Section: and Priority: * fixed permissions in /var (Bug#3184) * fixed color in flyer.xpm (Bug#3175) * debian.rules: handle Architecture: field Thu Jan 25 22:19:43 1996 Sven Rudolph * added extended description (Bug#1966, Bug#1377) * recompiled for ELF * debian.control: adapted for ELF Thu Sep 14 19:09:20 1995 Sven Rudolph * updated to version 1.4 Mon Sep 11 23:22:17 1995 Sven Rudolph * changed file locations according to FSSTND * added Debian GNU/Linux package maintenance system files debian/watch0000644000000000000000000000012511312431043010205 0ustar version=3 ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/ .*xonix-([\d.]+).tar.gz debian/rules0000755000000000000000000000120712031517062010243 0ustar #!/usr/bin/make -f CC = gcc export DEB_BUILD_OPTIONS = noopt export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic -D__unix export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed # cat the makefile to verify what flags are being used override_dh_auto_build: echo "#RUN imake" xmkmf echo '##BEGIN Makefile' cat Makefile echo '##END Makefile' $(MAKE) CC="$(CC)" \ CCLINK="$(CC)" \ CDEBUGFLAGS="$(CFLAGS) $(CPPFLAGS) $(LDFLAGS)" \ XONIXDIR=/var/cache/xonix override_dh_install: dh_install # Remove unused directories rm -rf debian/xonix/usr/lib debian/xonix/usr/bin %: dh $@ # End of file debian/xonix.install0000644000000000000000000000006511553754750011740 0ustar xonix usr/games Xonix.ad etc/X11/app-defaults/Xonix debian/copyright0000644000000000000000000000554612031512735011132 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 Upstream-Name: xonix Upstream-Contact: Joerg Wunsch , Source: ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/joerg/ X-Comment: Dead upstream. The email contact addresses are probably no longer valid. Files: * Copyright: 1995 Alfredo Herrera Hernandez 1995 Torsten Schoenitz 1995 Joerg Wunsch License: BSD-2-clause Files: debian/* Copyright: 2008-2012 Jari Aalto 2008 Frank Lichtenheld 2005 Baruch Even 1997, 1998, 2000, 2001, 2003, 2004, 2006 Adrian Bridgett 1997 Martin Mitchell 1995-1996 Sven Rudolph License: GPL-2+ License: BSD-2-clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. . THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . . On Debian systems, the complete text of the GNU General Public License can be found in "/usr/share/common-licenses/GPL-2". debian/source/0000755000000000000000000000000011312433330010457 5ustar debian/source/format0000644000000000000000000000001411312433330011665 0ustar 3.0 (quilt) debian/xonix.dirs0000644000000000000000000000006511553754750011233 0ustar var/cache/xonix usr/games etc/X11/app-defaults/Xonix debian/postrm0000755000000000000000000000054711553754750010462 0ustar #!/bin/sh set -e if [ "$1" = "purge" ]; then # Legacy code: old versions [ ! -f /var/lib/games/xonix.scores ] || rm -f /var/lib/games/xonix.scores [ ! -d /var/lib/games/xonix ] || rm -rf /var/lib/games/xonix [ ! -d /var/games ] || rmdir /var/games || : if [ -d /var/cache/xonix ]; then rm -rf /var/cache/xonix fi fi #DEBHELPER#