SOURCES: netris-debian.patch (NEW) - bunch patches from debian

undefine undefine at pld-linux.org
Thu Dec 29 02:08:20 CET 2005


Author: undefine                     Date: Thu Dec 29 01:08:20 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- bunch patches from debian

---- Files affected:
SOURCES:
   netris-debian.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/netris-debian.patch
diff -u /dev/null SOURCES/netris-debian.patch:1.1
--- /dev/null	Thu Dec 29 02:08:20 2005
+++ SOURCES/netris-debian.patch	Thu Dec 29 02:08:15 2005
@@ -0,0 +1,953 @@
+--- netris-0.52.orig/robot.c
++++ netris-0.52/robot.c
+@@ -35,7 +35,7 @@
+ 		{ NULL, 0, FT_read, -1, RobotGenFunc, EM_robot };
+ 
+ static int robotProcess;
+-static FILE *toRobot;
++static FILE *toRobot = NULL;
+ static int toRobotFd, fromRobotFd;
+ 
+ static char robotBuf[128];
+@@ -112,10 +112,13 @@
+ ExtFunc void CloseRobot(void)
+ {
+ 	RemoveEventGen(&robotGen);
+-	if (robotProcess > 0)
+-		RobotCmd(1, "Exit\n");
+-	fclose(toRobot);
+-	close(fromRobotFd);
++	if(toRobot) {
++		if (robotProcess > 0)
++			RobotCmd(1, "Exit\n");
++		fclose(toRobot);
++		close(fromRobotFd);
++		toRobot = NULL;
++	}
+ }
+ 
+ static MyEventType RobotGenFunc(EventGenRec *gen, MyEvent *event)
+--- netris-0.52.orig/curses.c
++++ netris-0.52/curses.c
+@@ -57,6 +58,7 @@
+ static int boardYPos[MAX_SCREENS], boardXPos[MAX_SCREENS];
+ static int statusYPos, statusXPos;
+ static int haveColor;
++static int screens_dirty = 0;
+ 
+ static char *term_vi;	/* String to make cursor invisible */
+ static char *term_ve;	/* String to make cursor visible */
+@@ -98,6 +100,7 @@
+ #endif
+ 
+ 	AtExit(CleanupScreens);
++	screens_dirty = 1;
+ 	RestoreSignals(NULL, &oldMask);
+ 
+ 	cbreak();
+@@ -116,9 +119,12 @@
+ 
+ ExtFunc void CleanupScreens(void)
+ {
+-	RemoveEventGen(&keyGen);
+-	endwin();
+-	OutputTermStr(term_ve, 1);
++	if (screens_dirty) {
++		RemoveEventGen(&keyGen);
++		endwin();
++		OutputTermStr(term_ve, 1);
++		screens_dirty = 0;
++	}
+ }
+ 
+ ExtFunc void GetTermcapInfo(void)
+@@ -201,6 +207,8 @@
+ 	for (y = boardVisible[scr] - 1; y >= 0; --y) {
+ 		move(boardYPos[scr] - y, boardXPos[scr] - 1);
+ 		addch('|');
++		for (x = boardWidth[scr] - 1; x >= 0; --x)
++			addstr("  ");
+ 		move(boardYPos[scr] - y, boardXPos[scr] + 2 * boardWidth[scr]);
+ 		addch('|');
+ 	}
+@@ -256,6 +264,23 @@
+ 
+ ExtFunc void ShowDisplayInfo(void)
+ {
++	move(statusYPos - 3, statusXPos);
++	printw("Won:  %3d", won);
++	move(statusYPos - 2, statusXPos);
++	printw("Lost: %3d", lost);
++
++	move(statusYPos - 1, statusXPos);
++	switch(gameState) {
++	case STATE_WAIT_CONNECTION:
++		addstr("Waiting for opponent...      ");
++		break;
++	case STATE_WAIT_KEYPRESS:
++		addstr("Press the key for a new game.");
++		break;
++	default:
++		addstr("                             ");
++	}
++
+ 	move(statusYPos - 9, statusXPos);
+ 	printw("Seed: %d", initSeed);
+ 	clrtoeol();
+--- netris-0.52.orig/game.c
++++ netris-0.52/game.c
+@@ -28,11 +28,11 @@
+ #include <netinet/in.h>
+ 
+ enum { KT_left, KT_rotate, KT_right, KT_drop, KT_down,
+-	KT_toggleSpy, KT_pause, KT_faster, KT_redraw, KT_numKeys };
++	KT_toggleSpy, KT_pause, KT_faster, KT_redraw, KT_new, KT_numKeys };
+ 
+ static char *keyNames[KT_numKeys+1] = {
+ 	"Left", "Rotate", "Right", "Drop", "Down", "ToggleSpy", "Pause",
+-	"Faster", "Redraw", NULL };
++	"Faster", "Redraw", "New", NULL };
+ 
+ static char *gameNames[GT_len] = { "OnePlayer", "ClassicTwo" };
+ 
+@@ -40,6 +40,10 @@
+ static int dropModeEnable = 0;
+ static char *robotProg;
+ 
++static int wonLast = 0;
++int lost = 0, won = 0;
++enum States gameState = STATE_STARTING;
++
+ ExtFunc void MapKeys(char *newKeys)
+ {
+ 	int i, k, ch;
+@@ -323,6 +327,7 @@
+ 					break;
+ 				case E_lostRobot:
+ 				case E_lostConn:
++					wonLast = 1;
+ 					goto gameOver;
+ 				default:
+ 					break;
+@@ -350,14 +355,17 @@
+ 			SendPacket(NP_giveJunk, sizeof(data), data);
+ 		}
+ 	}
++	wonLast = 0;
++
+ gameOver:
+ 	SetITimer(0, 0);
+ }
+ 
+ ExtFunc int main(int argc, char **argv)
+ {
+-	int initConn = 0, waitConn = 0, ch;
++	int initConn = 0, waitConn = 0, ch, done = 0;
+ 	char *hostStr = NULL, *portStr = NULL;
++	MyEvent event;
+ 
+ 	standoutEnable = colorEnable = 1;
+ 	stepDownInterval = DEFAULT_INTERVAL;
+@@ -422,112 +430,139 @@
+ 	if (fairRobot && !robotEnable)
+ 		fatal("You can't use the -F option without the -r option");
+ 	InitUtil();
+-	if (robotEnable)
+-		InitRobot(robotProg);
+-	InitNet();
+-	InitScreens();
+-	if (initConn || waitConn) {
+-		MyEvent event;
+-
+-		game = GT_classicTwo;
+-		if (initConn)
+-			InitiateConnection(hostStr, portStr);
+-		else if (waitConn)
+-			WaitForConnection(portStr);
+-		{
+-			netint4 data[2];
+-			int major;
+-
+-			data[0] = hton4(MAJOR_VERSION);
+-			data[1] = hton4(PROTOCOL_VERSION);
+-			SendPacket(NP_version, sizeof(data), data);
+-			if (WaitMyEvent(&event, EM_net) != E_net)
+-				fatal("Network negotiation failed");
+-			memcpy(data, event.u.net.data, sizeof(data));
+-			major = ntoh4(data[0]);
+-			protocolVersion = ntoh4(data[1]);
+-			if (event.u.net.type != NP_version || major < MAJOR_VERSION)
+-				fatal("Your opponent is using an old, incompatible version\n"
+-					"of Netris.  They should get the latest version.");
+-			if (major > MAJOR_VERSION)
+-				fatal("Your opponent is using an newer, incompatible version\n"
+-					"of Netris.  Get the latest version.");
+-			if (protocolVersion > PROTOCOL_VERSION)
+-				protocolVersion = PROTOCOL_VERSION;
+-		}
+-		if (protocolVersion < 3 && stepDownInterval != DEFAULT_INTERVAL)
+-			fatal("Your opponent's version of Netris predates the -i option.\n"
+-					"For fairness, you shouldn't use the -i option either.");
+-		{
+-			netint4 data[3];
+-			int len;
+-			int seed;
+-
+-			if (protocolVersion >= 3)
+-				len = sizeof(data);
+-			else
+-				len = sizeof(netint4[2]);
+-			if ((myFlags & SCF_setSeed))
+-				seed = initSeed;
+-			else
+-				seed = time(0);
+-			if (waitConn)
+-				SRandom(seed);
+-			data[0] = hton4(myFlags);
+-			data[1] = hton4(seed);
+-			data[2] = hton4(stepDownInterval);
+-			SendPacket(NP_startConn, len, data);
+-			if (WaitMyEvent(&event, EM_net) != E_net ||
+-					event.u.net.type != NP_startConn)
+-				fatal("Network negotiation failed");
+-			memcpy(data, event.u.net.data, len);
+-			opponentFlags = ntoh4(data[0]);
+-			seed = ntoh4(data[1]);
+-			if (initConn) {
+-				if ((opponentFlags & SCF_setSeed) != (myFlags & SCF_setSeed))
+-					fatal("If one player sets the random number seed, "
+-							"both must.");
+-				if ((myFlags & SCF_setSeed) && seed != initSeed)
+-					fatal("Both players have set the random number seed, "
+-							"and they are unequal.");
+-				if (protocolVersion >= 3 && stepDownInterval != ntoh4(data[2]))
+-					fatal("Your opponent is using a different step-down "
+-						"interval (-i).\nYou must both use the same one.");
+-				SRandom(seed);
++	InitScreens();	
++	while(!done) {
++		if (robotEnable)
++			InitRobot(robotProg);
++		InitNet();
++		if (!initSeed)
++			SRandom(time(0));
++		if (initConn || waitConn) {
++			game = GT_classicTwo;
++			if(gameState != STATE_STARTING) {
++				gameState = STATE_WAIT_CONNECTION;
++				ShowDisplayInfo();
++				RefreshScreen();
++			}
++			if (initConn)
++				InitiateConnection(hostStr, portStr);
++			else if (waitConn)
++				WaitForConnection(portStr);
++			gameState = STATE_PLAYING;
++			ShowDisplayInfo();
++			RefreshScreen();
++			{
++				netint4 data[2];
++				int major;
++				
++				data[0] = hton4(MAJOR_VERSION);
++				data[1] = hton4(PROTOCOL_VERSION);
++				SendPacket(NP_version, sizeof(data), data);
++				if (WaitMyEvent(&event, EM_net) != E_net)
++					fatal("Network negotiation failed");
++				memcpy(data, event.u.net.data, sizeof(data));
++				major = ntoh4(data[0]);
++				protocolVersion = ntoh4(data[1]);
++				if (event.u.net.type != NP_version || major < MAJOR_VERSION)
++					fatal("Your opponent is using an old, incompatible version\n"
++					      "of Netris.  They should get the latest version.");
++				if (major > MAJOR_VERSION)
++					fatal("Your opponent is using an newer, incompatible version\n"
++					      "of Netris.  Get the latest version.");
++				if (protocolVersion > PROTOCOL_VERSION)
++					protocolVersion = PROTOCOL_VERSION;
+ 			}
++			if (protocolVersion < 3 && stepDownInterval != DEFAULT_INTERVAL)
++				fatal("Your opponent's version of Netris predates the -i option.\n"
++				      "For fairness, you shouldn't use the -i option either.");
++			{
++				netint4 data[3];
++				int len;
++				int seed;
++				
++				if (protocolVersion >= 3)
++					len = sizeof(data);
++				else
++					len = sizeof(netint4[2]);
++				if ((myFlags & SCF_setSeed))
++					seed = initSeed;
++				else
++					seed = time(0);
++				if (waitConn)
++					SRandom(seed);
++				data[0] = hton4(myFlags);
++				data[1] = hton4(seed);
++				data[2] = hton4(stepDownInterval);
++				SendPacket(NP_startConn, len, data);
++				if (WaitMyEvent(&event, EM_net) != E_net ||
++				    event.u.net.type != NP_startConn)
++					fatal("Network negotiation failed");
++				memcpy(data, event.u.net.data, len);
++				opponentFlags = ntoh4(data[0]);
++				seed = ntoh4(data[1]);
++				if (initConn) {
++					if ((opponentFlags & SCF_setSeed) != (myFlags & SCF_setSeed))
++						fatal("If one player sets the random number seed, "
++						      "both must.");
++					if ((myFlags & SCF_setSeed) && seed != initSeed)
++						fatal("Both players have set the random number seed, "
++						      "and they are unequal.");
++					if (protocolVersion >= 3 && stepDownInterval != ntoh4(data[2]))
++						fatal("Your opponent is using a different step-down "
++						      "interval (-i).\nYou must both use the same one.");
++					SRandom(seed);
++				}
++			}
++			{
++				char *userName;
++				int len, i;
++
++				userName = getenv("LOGNAME");
++				if (!userName || !userName[0])
++					userName = getenv("USER");
++				if (!userName || !userName[0])
++					strcpy(userName, "???");
++				len = strlen(userName)+1;
++				if (len > sizeof(opponentName))
++					len = sizeof(opponentName);
++				SendPacket(NP_userName, len, userName);
++				if (WaitMyEvent(&event, EM_net) != E_net ||
++				    event.u.net.type != NP_userName)
++					fatal("Network negotiation failed");
++				strncpy(opponentName, event.u.net.data,
++					sizeof(opponentName)-1);
++				opponentName[sizeof(opponentName)-1] = 0;
++				for (i = 0; opponentName[i]; ++i)
++					if (!isprint(opponentName[i]))
++						opponentName[i] = '?';
++				for (i = 0; opponentHost[i]; ++i)
++					if (!isprint(opponentHost[i]))
++						opponentHost[i] = '?';
++			}
++			OneGame(0, 1);
+ 		}
+-		{
+-			char *userName;
+-			int len, i;
+-
+-			userName = getenv("LOGNAME");
+-			if (!userName || !userName[0])
+-				userName = getenv("USER");
+-			if (!userName || !userName[0])
+-				strcpy(userName, "???");
+-			len = strlen(userName)+1;
+-			if (len > sizeof(opponentName))
+-				len = sizeof(opponentName);
+-			SendPacket(NP_userName, len, userName);
+-			if (WaitMyEvent(&event, EM_net) != E_net ||
+-					event.u.net.type != NP_userName)
+-				fatal("Network negotiation failed");
+-			strncpy(opponentName, event.u.net.data,
+-				sizeof(opponentName)-1);
+-			opponentName[sizeof(opponentName)-1] = 0;
+-			for (i = 0; opponentName[i]; ++i)
+-				if (!isprint(opponentName[i]))
+-					opponentName[i] = '?';
+-			for (i = 0; opponentHost[i]; ++i)
+-				if (!isprint(opponentHost[i]))
+-					opponentHost[i] = '?';
++		else {
++			game = GT_onePlayer;
++			OneGame(0, -1);
++		}
++		if (wonLast) {
++			won++;
++		} else {
++			lost++;
++			WaitMyEvent(&event, EM_net);
++		}
++		CloseNet();
++		if (robotEnable) {
++			CloseRobot();
++		} else {
++			gameState = STATE_WAIT_KEYPRESS;
++			ShowDisplayInfo();
++			RefreshScreen();
++			while(getchar() != keyTable[KT_new])
++				;
+ 		}
+-		OneGame(0, 1);
+-	}
+-	else {
+-		game = GT_onePlayer;
+-		OneGame(0, -1);
+ 	}
++
+ 	return 0;
+ }
+ 
+--- netris-0.52.orig/inet.c
++++ netris-0.52/inet.c
+@@ -42,6 +42,8 @@
+ 
+ ExtFunc void InitNet(void)
+ {
++	lostConn = 0;
++	gotEndConn = 0;
+ 	AtExit(CloseNet);
+ }
+ 
+--- netris-0.52.orig/netris.h
++++ netris-0.52/netris.h
+@@ -65,7 +65,7 @@
+ 
+ #define DEFAULT_PORT 9284	/* Very arbitrary */
+ 
+-#define DEFAULT_KEYS "jkl mspf^l"
++#define DEFAULT_KEYS "jkl mspf^ln"
+ 
+ /* Protocol versions */
+ #define MAJOR_VERSION		1	
+@@ -152,6 +152,13 @@
+ typedef int (*ShapeDrawFunc)(int scr, int y, int x,
+ 					BlockType type, void *data);
+ 
++enum States {
++	STATE_STARTING,
++	STATE_PLAYING,
++	STATE_WAIT_CONNECTION,
++	STATE_WAIT_KEYPRESS
++};
++
+ EXT GameType game;
+ EXT int boardHeight[MAX_SCREENS];
+ EXT int boardVisible[MAX_SCREENS], boardWidth[MAX_SCREENS];
+@@ -167,6 +174,9 @@
+ 
+ EXT int myFlags, opponentFlags;
+ 
++EXT int won, lost;
++EXT enum States gameState;
++
+ EXT char scratch[1024];
+ 
+ extern ShapeOption stdOptions[];
+--- netris-0.52.orig/util.c
++++ netris-0.52/util.c
+@@ -74,7 +74,7 @@
+ 	  "  -p <port>	Set port number (default is %d)\n"
+ 	  "  -k <keys>	Remap keys.  The argument is a prefix of the string\n"
+ 	  "		  containing the keys in order: left, rotate, right, drop,\n"
+-	  "		  down-faster, toggle-spying, pause, faster, redraw.\n"
++	  "		  down-faster, toggle-spying, pause, faster, redraw, new.\n"
+ 	  "		  \"^\" prefixes controls.  (default is \"%s\")\n"
+ 	  "  -i <sec>	Set the step-down interval, in seconds\n"
+ 	  "  -r <robot>	Execute <robot> (a command) as a robot controlling\n"
+@@ -267,6 +267,7 @@
+ 
+ ExtFunc volatile void fatal(char *msg)
+ {
++	CleanupScreens ();
+ 	fprintf(stderr, "%s\n", msg);
+ 	exit(1);
+ }
+--- netris-0.52.orig/board.c
++++ netris-0.52/board.c
+@@ -36,6 +36,19 @@
+ 
+ ExtFunc void InitBoard(int scr)
+ {
++	int s,w,h;
++
++	for(s = 0 ; s < MAX_SCREENS ; s++)
++		for(h = 0 ; h < MAX_BOARD_HEIGHT ; h++)
++			for(w = 0 ; w < MAX_BOARD_WIDTH ; w++) {
++				board[s][h][w] = 0;
++				oldBoard[s][h][w] = 0;
++				changed[s][h] = 0;
++				falling[s][w] = 0;
++				oldFalling[s][w] = 0;
++			}
++				
++
+ 	boardHeight[scr] = MAX_BOARD_HEIGHT;
+ 	boardVisible[scr] = 20;
+ 	boardWidth[scr] = 10;
+--- netris-0.52.orig/debian/watch
++++ netris-0.52/debian/watch
+@@ -0,0 +1,3 @@
++version=2
++# Site/Directory/Pattern                                   Version  Script
++ftp://ftp.netris.org/pub/netris/netris-([\d\.]+)\.tar\.gz  debian  uupdate
+--- netris-0.52.orig/debian/changelog
++++ netris-0.52/debian/changelog
+@@ -0,0 +1,123 @@
++netris (0.52-5) unstable; urgency=low
++
++  * Erm, add small fix for 64bit machines from #325926 which was meant to be
++    in the former upload already....  (closes: #325926)
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 05 Sep 2005 15:08:18 +0200
++
++netris (0.52-4) unstable; urgency=low
++
++  * Bumped standards version, no changes needed.
++  * Moved menu file from /usr/lib/menu to /usr/share/menu.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 05 Sep 2005 14:22:50 +0200
++
++netris (0.52-3) unstable; urgency=low
++
++  * Quote all entries in the menu file.
++  * Fix -s setting, patch from Piotr Krukowiecki, thanks (closes: #300125)
++  * Fixed short description to not include an upercased article at the start.
++  * Slightly reformated copyright file a bit.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Fri, 18 Mar 2005 18:04:22 +0100
++
++netris (0.52-2) unstable; urgency=low
++
++  * Applied patch from Per von Zweigbergk for staircase effect (closes: #83039)
++  * Bumped to policy 3.6.1: No changes needed.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Thu, 25 Nov 2004 14:24:01 +0100
++
++netris (0.52-1) unstable; urgency=high
++
++  * New upstream release which fixes buffer overflow vulnerability
++    CAN-2003-0685 (closes: #205113) -- no other changes.
++  * Updated to policy 3.6.0: No changes needed.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 18 Aug 2003 21:25:09 +0200
++
++netris (0.5-7) unstable; urgency=low
++
++  * Added 'n'ew game key to -k handling option (updated manual page wrt/
++    this).  Don't know though how to make the correct key show up in the
++    message so simply changed it.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Fri, 18 Oct 2002 19:35:13 +0200
++
++netris (0.5-6) unstable; urgency=low
++
++  * Applied multi game patch with scoring from Tomas Berndtsson, received via
++    private mail.
++  * Removed /usr/doc -> /usr/share/doc handling.
++  * Removed some superfluous commas from the long description.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Thu, 26 Sep 2002 22:47:20 +0200
++
++netris (0.5-5) unstable; urgency=low
++
++  * Updated watchfile to uscan version=2.
++  * Updated to policy 3.5.7: Added support for DEB_BUILD_OPTIONS too.
++  * Remove Makefile, .depend and config.h in clean target, too.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 09 Sep 2002 18:19:59 +0200
++
++netris (0.5-4) unstable; urgency=medium
++
++  * wrote man page for netris-sample-robot, finally (closes: #19373)
++  * un-debhelper-ized the package.
++  * urgency=medium for having the libncurses4 removed from woody (previous
++    upload forgot to set urgency)
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 18 Feb 2002 12:59:56 +0100
++
++netris (0.5-3) unstable; urgency=low
++
++  * New Maintainer.
++  * Rebuild against libncurses5 (closes: #93943)
++  * Added manual page (thanks to Edward Betts for writing it) -- this doesn't
++    close 19373 though, netris-sample-robot still has no manual page.
++  * Removed emacs-junk from the end of this file.
++  * Updated to standards version 3.5.6:
++    * Fixed the pointer to the GPL in the copyright file.
++    * Added Build-Depends: debhelper, libncurses5-dev to control file.
++    * Binaries are stripped (closes: #127381)
++  * Added watch file.
++
++ -- Gerfried Fuchs <alfie at debian.org>  Mon, 11 Feb 2002 18:43:49 +0100
++
++netris (0.5-2) unstable; urgency=low
++
++  * Change maintainer address
++  * FHS compliant
++  * Standards: 3.0.1
++
++ -- Gergely Madarasz <gorgo at sztaki.hu>  Tue,  7 Sep 1999 21:17:37 +0200
++
++netris (0.5-1) unstable; urgency=low
++
++  * Compile with libncurses4
++  * Update menu file and standards version
++  * New upstream version
++
++ -- Gergely Madarasz <gorgo at caesar.elte.hu>  Thu,  3 Jun 1999 15:19:38 +0200
++
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list