Description: Conversion from legacy to quilt format
 This patch has been created by dpkg-source during the package build. It
 contains all changes from 1.07 to 1.07-17. Please use the changelog to
 learn more details.
 .
 xpat2 (1.07-17) unstable; urgency=low
 .
   * added GID handling to switch_uid (Closes: #560087)
   * debhelper version to 7, standards version 3.8.4
Author: Arne Wichmann <aw@linux.de>
Bug-Debian: http://bugs.debian.org/560087

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- xpat2-1.07.orig/Makefile
+++ xpat2-1.07/Makefile
@@ -12,7 +12,7 @@
 #	no longer valid.
 
 all:
-	(cd src && xmkmf && $(MAKE) && strip xpat2)
+	(cd src && xmkmf && $(MAKE) )
 
 manual:
 	(cd doc && $(MAKE) xpat2.ps)
@@ -40,7 +40,7 @@ distrib:
 
 bindistrib:
 	(cd /; tar cvfz $(HOME)/xpat2-1.07-bin.tar.gz var/games/xpat* \
-	 usr/games/bin/xpat2 usr/man/man6/xpat2.6x usr/doc/xpat2.dvi \
+	 usr/games/bin/xpat2 usr/man/man6/xpat2.6 usr/doc/xpat2.dvi \
 	 usr/doc/xpat2.lsm usr/games/lib/xpat)
 
 allinterfaces:
--- xpat2-1.07.orig/lib/french/messages
+++ xpat2-1.07/lib/french/messages
@@ -89,7 +89,7 @@ aide.Michaels
 aide.Canfield
 aide.Cotillion
 aidBakersDozen
-../help.Oonsoo
+aide.Oonsoo
 ../help.BlueMoon
 Merci de patienter un moment, je charge les cartes...
 Bienvenue avec xpat2 version %s!
--- /dev/null
+++ xpat2-1.07/lib/french/aide.Oonsoo
@@ -0,0 +1,18 @@
+              Les rgles d'Oonsoo
+              ===================
+
+Le principe d'Oonsoo ressemble beaucoup  celui de
+Spider. Toutefois, il peut drouter un peu au dbut:
+dans Oonsoo, il faut empiler des cartes de mme rang.
+On joue  Oonsoo avec 48 cartes qui forment 12 tas de
+4 cartes chacun. On ne peut dplacer les trefles que
+dans les cases libres. L'ordre dcroisssant des
+couleurs est: Trfles, Piques, Coeur et Carreaux. On
+ne peut dplacer les cartes d'une couleur infrieure
+que sur les cartes d'une couleur suprieure: ainsi, on
+ne peut mettre le six de coeur que sur le six de
+trfle et le six de pique et sur aucune autre carte.
+
+Si Oonsoo vous interesse, essayez aussi le programme
+Oonsoo de Bradford W. Mott (bwmott@eos.ncsu.edu) dont
+les cartes possdent un dessin original.
--- xpat2-1.07.orig/src/xpat.h
+++ xpat2-1.07/src/xpat.h
@@ -51,6 +51,8 @@
 #define EXIT_FAILURE (-1)
 #endif
 
+#define MAXXPMDIRLEN	100	/* pathname length including trailing zero */
+
 #ifndef max
 #define max(a, b)     ((a) > (b) ? (a) : (b))
 #define min(a, b)     ((a) < (b) ? (a) : (b))
--- xpat2-1.07.orig/src/X-widget.c
+++ xpat2-1.07/src/X-widget.c
@@ -248,6 +248,11 @@ static void Initialize(Widget request, W
 	exit(EXIT_FAILURE);
     }
 
+    if (p->xpmdir && strlen(p->xpmdir) >= MAXXPMDIRLEN) {
+        fprintf(stderr, "directory too long\n");
+        exit(1);
+    }
+
     read_message_file(p->messagefile ? p->messagefile : "messages");
     read_keyboard_file(p->keyboardfile ? p->keyboardfile : "keys");
 
--- xpat2-1.07.orig/src/Xaw-main.c
+++ xpat2-1.07/src/Xaw-main.c
@@ -323,6 +323,7 @@ int main(int argc, char *argv[]) {
     Widget buttonpanel;
     Widget gamebutton, gamemenu, rulesbutton, rulesmenu;
     int i;
+    Arg args[1];
     struct button {
 	const char *name; void (*func)(void);
     } *bp;
@@ -403,6 +404,9 @@ int main(int argc, char *argv[]) {
     /* OK. Now do the pop-up shells */
     popup = XtCreatePopupShell("prompt", transientShellWidgetClass, toplevel, NULL, 0);
     dialog = XtCreateManagedWidget("dialog", dialogWidgetClass, popup, NULL, 0);
+    /* cludge to be improved when I know more Xaw -- AW */
+    XtSetArg(args[0], XtNlabel, (strlen(TXT_NEW_CONFIRM)>strlen(TXT_QUIT_CONFIRM))?TXT_NEW_CONFIRM:TXT_QUIT_CONFIRM);
+    XtSetValues(dialog, args, 1);
     XawDialogAddButton(dialog, "ok",     Ok,     (XtPointer)dialog);
     XawDialogAddButton(dialog, "cancel", Cancel, (XtPointer)dialog);
 
--- xpat2-1.07.orig/src/X-gfx1.c
+++ xpat2-1.07/src/X-gfx1.c
@@ -442,7 +442,7 @@ void init_cards(const char *cardset, int
         /* build internal cardset */
 	CARD_WIDTH = -1;
 	if (xpm) {
-	    char s[200];
+	    char s[MAXXPMDIRLEN + 15];
 	    FILE *fp;
 	    sprintf(s, "%s/Cards.conf", xpmdir);
 	    if ((fp = fopen(s, "r"))) {
@@ -956,7 +956,8 @@ void PaintCard(int x, int y, int c, int
 		    cardpicts[57] = 0;	/* Joker is loaded on request */
 		    for (i = 0; i <= 56; ++i) {
 			if (xpmdir && (i < 52 || i >= 56)) {
-			    char s[200];
+			    char s[MAXXPMDIRLEN + strlen(US_rank_name[RANK(i)]) +
+                                   strlen(US_suit_name[SUIT(i)]) + 20];
 			    if (i == CARDBACK) {
 				strcpy(s, xpmdir);
 			        strcat(s, "/Cardback.xpm");
@@ -988,7 +989,7 @@ void PaintCard(int x, int y, int c, int
 		    if (!cardpicts[c]) {
 			/* must load or draw joker */
 			if (xpmdir) {
-			    char s[200];
+			    char s[MAXXPMDIRLEN + 15];
 			    sprintf(s, "%s/Joker.xpm", xpmdir);
 			    (void)read_pixmap(s, &cardpicts[c]);
 			}
--- xpat2-1.07.orig/src/loadsave.c
+++ xpat2-1.07/src/loadsave.c
@@ -42,13 +42,18 @@ void switch_uid(int to_real) {
 #ifdef _POSIX_SAVED_IDS
     static int uid_state = -1; /* -1 = unknown, 1 = real, 0 = effective */
     static uid_t real_uid, effective_uid;
+    static gid_t real_gid, effective_gid;
     if (uid_state < 0) {
 	real_uid = getuid();
+	real_gid = getgid();
 	effective_uid = geteuid();
+	effective_gid = getegid();
 	uid_state = 0;
     }
-    if (to_real != uid_state && real_uid != effective_uid) {
+    if (to_real != uid_state && (real_uid != effective_uid || real_gid !=
+	    effective_gid)) {
 	setuid(to_real ? real_uid : effective_uid);
+	setgid(to_real ? real_gid : effective_gid);
 	uid_state = to_real;
     }
 #endif
--- xpat2-1.07.orig/src/Imakefile
+++ xpat2-1.07/src/Imakefile
@@ -40,7 +40,9 @@ DEPLIBS		= $(DEPXLIB)
 
 #ifdef useXaw
 KIT_OPTION	= -DuseXaw
-KIT_LIBS	= XawClientLibs # $(XMULIB) $(XTOOLLIB)
+# KIT_LIBS	= XawClientLibs # $(XMULIB) $(XTOOLLIB)
+# no ICE/SM/Xext -- AW
+KIT_LIBS	= $(XAWLIB) $(XMULIBONLY) $(XTOOLONLYLIB) $(XPMLIB) $(EXTRAXAWCLIENTLIBS) $(XONLYLIB)
 #ifdef USE_ONLINEHELP
 HELPOBJ		= Xaw-help.o
 #else
@@ -220,8 +222,8 @@ install::	$(MYPROGS)
 	    chmod 755 $(XPATLIBDIR)/$$f; \
 	done
 	mkdirhier $(XPATMANDIR)
-	cp xpat2.man $(XPATMANDIR)/xpat2.6x
-	chmod 644 $(XPATMANDIR)/xpat2.6x
+	cp xpat2.man $(XPATMANDIR)/xpat2.6
+	chmod 644 $(XPATMANDIR)/xpat2.6
 
 ComplexProgramTarget($(MYPROG))
 InstallAppDefaults(XPat)
@@ -251,8 +253,8 @@ install.local:	$(MYPROGS)
 	done
 	cp xpat2 $(LXPATBINDIR)
 	chmod 755 $(LXPATBINDIR)/xpat2
-	cp xpat2.man $(LXPATMANDIR)/xpat2.6x
-	chmod 644 $(LXPATMANDIR)/xpat2.6x
+	cp xpat2.man $(LXPATMANDIR)/xpat2.6
+	chmod 644 $(LXPATMANDIR)/xpat2.6
 
 
 XCOMM Dependecies for the Qt interface:
--- xpat2-1.07.orig/src/xpat2.man
+++ xpat2-1.07/src/xpat2.man
@@ -136,7 +136,7 @@ all card images together. An additional
 nice cardbacks.
 
 If the directory name \fIxpmdir\fP does not start with a dot or a slash,
-it is interpreted as a subdirectory of \fB/usr/games/lib/xpat\fP.
+it is interpreted as a subdirectory of \fB/usr/share/games/xpat\fP.
 .TP 4
 .B \-xpmcls \fIxpmcls\fP
 (Resource: \fBTableau.xpmcls\fP)
@@ -193,22 +193,20 @@ The bdf-file is distributed with \fBxpat
 a format supported by your X-server (pcf, snf, ...)
 
 .SH FILES
-(Directories may differ on your system, especially the library subdirectory
- may be \fB/usr/games/lib/xpat\fP instead of \fB/usr/lib/games/xpat\fP.)
 
  \fB/usr/games/xpat2\fP
- \fB/var/lib/games/xpat2/xpat.log\fP
- \fB/usr/doc/copyright/xpat2\fP
- \fB/usr/lib/games/xpat/small.cards\fP
- \fB/usr/lib/games/xpat/french.cards\fP
- \fB/usr/lib/games/xpat/audio/success.au\fP
- \fB/usr/lib/games/xpat/audio/giveup.au\fP
- \fB/usr/lib/games/xpat/audio/goodbye.au\fP
- \fB/usr/lib/games/xpat/audio/cannotsave.au\fP
- \fB/usr/lib/games/xpat/help.*\fP
- \fB/usr/lib/games/xpat/hlp*\fP
+ \fB/var/games/xpat2/xpat.log\fP
+ \fB/usr/share/doc/xpat2\fP
+ \fB/usr/share/games/xpat/small.cards\fP
+ \fB/usr/share/games/xpat/french.cards\fP
+ \fB/usr/share/games/xpat/audio/success.au\fP
+ \fB/usr/share/games/xpat/audio/giveup.au\fP
+ \fB/usr/share/games/xpat/audio/goodbye.au\fP
+ \fB/usr/share/games/xpat/audio/cannotsave.au\fP
+ \fB/usr/share/games/xpat/help.*\fP
+ \fB/usr/share/games/xpat/hlp*\fP
 
-and a number of subdirs of \fB/usr/lib/games/xpat\fP, containing sets of colour
+and a number of subdirs of \fB/usr/share/games/xpat\fP, containing sets of colour
 cards.
 
 .SH DIAGNOSTICS
@@ -238,7 +236,7 @@ hit <ctrl-L> to get the window redrawn c
 Please mail bug reports to \fBMichael.Bischoff@gmx.net\fP.
 Fixes are especially welcome.
 .SH SEE ALSO
-\fBxpat(6x)\fP, \fBspider(1)\fP, \fBxsol(1)\fP
+\fBxpat(6)\fP, \fBspider(1)\fP, \fBxsol(1)\fP
 
 .SH AUTHORS
 Heiko Eissfeldt and Michael Bischoff
--- xpat2-1.07.orig/src/Xpat.tmpl
+++ xpat2-1.07/src/Xpat.tmpl
@@ -40,9 +40,9 @@ XCOMM ##################################
 
 XCOMM 1. Specify User Interface (_exactly_ one of the interfaces below)
 #undef useXlib		/* similar to xpat version 1.x, not all features */
-#undef useXaw		/* the classic Athena based interface for xpat2 */
+#define useXaw		/* the classic Athena based interface for xpat2 */
 #undef useXview		/* Xview / OpenLook interface */
-#define useXQt		/* Qt widgets, playable, but NOT YET FINISHED */
+#undef useXQt		/* Qt widgets, playable, but NOT YET FINISHED */
 			/* advice on Qt improvements from experienced
 			   programmers welcome at Michael.Bischoff@gmx.net */
 #undef useXm1		/* Motif based interface (first variant) */
--- xpat2-1.07.orig/src/layout.c
+++ xpat2-1.07/src/layout.c
@@ -332,17 +332,9 @@ static int gen_high_layout(void) {
 	}
     } else {
 	/* enough space for the slots! */
-	int currentx = geo.dx;
-/*	printf("generating high layout for %d,%d\n", geo.w, geo.h); */
-	if (rem_x >= (rules.numslots + 1) * (geo.cw + geo.dx) &&
-	    !(rules.variant & NODEAL)) {
-	    /* there is space for the deck, and we can use one! */
-	    geo.pg[game.numpiles-1].x = geo.dx;
-	    geo.pg[game.numpiles-1].y = geo.dy + geo.ch + geo.dy;
-	    currentx += geo.cw + geo.dx;
-	    new_layout_type = GEN_BIG_LAYOUT_WITH_DECK;
-	    geo.preferred_width += geo.dx + geo.cw;
-	}
+	int currentx = geo.dx + rules.numdecks * (geo.cw + geo.dx);
+	new_layout_type = GEN_BIG_LAYOUT_WITH_DECK;
+	geo.preferred_width += rules.numdecks * (geo.dx + geo.cw);
 	for (i = 0; i < rules.numslots; ++i) {
 	    /* create slot of full window height */
 	    p->x = currentx;
@@ -351,6 +343,14 @@ static int gen_high_layout(void) {
 	    currentx += geo.cw + geo.dx;
 	    ++p;
 	}
+	/* finally, position the decks */
+	for (i = 0; i < rules.numdecks; ++i) {
+	    p[0].x = i * (geo.dx + geo.cw);
+	    p[1].x = p[0].x;
+	    p[0].y = geo.dy + 2 * (geo.ch + geo.dy);
+	    p[1].y = geo.dy + geo.ch + geo.dy;
+	    p += 2;
+	}
 	/* redo pos. of stacks */
 	p = geo.pg;
 	for (i = 0; i < rules.numstacks; ++i) {
--- xpat2-1.07.orig/src/Imakefile.old
+++ xpat2-1.07/src/Imakefile.old
@@ -217,8 +217,8 @@ install:: $(MYPROGS)
 	    chmod 755 $(XPATLIBDIR)/$$f; \
 	done
 	mkdirhier $(XPATMANDIR)
-	cp xpat2.man $(XPATMANDIR)/xpat2.6x
-	chmod 644 $(XPATMANDIR)/xpat2.6x
+	cp xpat2.man $(XPATMANDIR)/xpat2.6
+	chmod 644 $(XPATMANDIR)/xpat2.6
 
 ComplexProgramTarget($(MYPROG))
 InstallAppDefaults(XPat)
@@ -247,8 +247,8 @@ install.local: $(MYPROGS)
 	done
 	cp xpat2 $(LXPATBINDIR)
 	chmod 755 $(LXPATBINDIR)/xpat2
-	cp xpat2.man $(LXPATMANDIR)/xpat2.6x
-	chmod 644 $(LXPATMANDIR)/xpat2.6x
+	cp xpat2.man $(LXPATMANDIR)/xpat2.6
+	chmod 644 $(LXPATMANDIR)/xpat2.6
 
 # dependecies for the Qt interface:
 
--- xpat2-1.07.orig/src/Imakefile.none.old
+++ xpat2-1.07/src/Imakefile.none.old
@@ -216,8 +216,8 @@ install:: $(MYPROGS)
 	    chmod 755 $(XPATLIBDIR)/$$f; \
 	done
 	mkdirhier $(XPATMANDIR)
-	cp xpat2.man $(XPATMANDIR)/xpat2.6x
-	chmod 644 $(XPATMANDIR)/xpat2.6x
+	cp xpat2.man $(XPATMANDIR)/xpat2.6
+	chmod 644 $(XPATMANDIR)/xpat2.6
 
 ComplexProgramTarget($(MYPROG))
 InstallAppDefaults(XPat)
@@ -246,8 +246,8 @@ install.local: $(MYPROGS)
 	done
 	cp xpat2 $(LXPATBINDIR)
 	chmod 755 $(LXPATBINDIR)/xpat2
-	cp xpat2.man $(LXPATMANDIR)/xpat2.6x
-	chmod 644 $(LXPATMANDIR)/xpat2.6x
+	cp xpat2.man $(LXPATMANDIR)/xpat2.6
+	chmod 644 $(LXPATMANDIR)/xpat2.6
 
 # dependecies for the Qt interface:
 
