From david@catwhisker.org  Wed Sep 19 20:33:48 2012
Return-Path: <david@catwhisker.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7A05106566C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Sep 2012 20:33:48 +0000 (UTC)
	(envelope-from david@catwhisker.org)
Received: from albert.catwhisker.org (m209-73.dsl.rawbw.com [198.144.209.73])
	by mx1.freebsd.org (Postfix) with ESMTP id C36BB8FC17
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Sep 2012 20:33:48 +0000 (UTC)
Received: from albert.catwhisker.org (localhost [127.0.0.1])
	by albert.catwhisker.org (8.14.5/8.14.5) with ESMTP id q8JKXm4b009954
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Sep 2012 13:33:48 -0700 (PDT)
	(envelope-from david@albert.catwhisker.org)
Received: (from david@localhost)
	by albert.catwhisker.org (8.14.5/8.14.5/Submit) id q8JKXm35009953;
	Wed, 19 Sep 2012 13:33:48 -0700 (PDT)
	(envelope-from david)
Message-Id: <201209192033.q8JKXm35009953@albert.catwhisker.org>
Date: Wed, 19 Sep 2012 13:33:48 -0700 (PDT)
From: David Wolfskill <david@catwhisker.org>
Reply-To: David Wolfskill <david@catwhisker.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: patch: allow xmille to select starting player randomly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         171792
>Category:       ports
>Synopsis:       patch: allow games/xmille to select starting player randomly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 19 20:40:04 UTC 2012
>Closed-Date:    Mon May 27 17:57:32 UTC 2013
>Last-Modified:  Mon May 27 18:00:00 UTC 2013
>Originator:     David Wolfskill
>Release:        FreeBSD 9.1-PRERELEASE i386
>Organization:
Wolfskill & Dowling Residence
>Environment:
System: FreeBSD albert.catwhisker.org 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #349 240271M: Sun Sep 9 05:26:25 PDT 2012 root@freebeast.catwhisker.org:/usr/obj/usr/src/sys/ALBERT i386

>Description:
	As written, the human player always starts a game of xmille.

	The attached patch causes xmille to select the human player
	or itself to start, more-or-less randomly.
>How-To-Repeat:
	Play a few games of xmille, and note that you always start --
	never the computer.  Or examine the code, in mille.c:53 - 54:

	        Play = PLAYER;
		init_ui ();
>Fix:
	Since the port already has a files/patch-mille.c, we could patch
	that patchfile, thus:

--- files/patch-mille.c.orig	2012-07-22 04:58:35.000000000 -0700
+++ files/patch-mille.c	2012-09-19 13:12:55.000000000 -0700
@@ -21,6 +21,33 @@
  
  main(ac, av)
  reg int		ac;
+@@ -49,8 +50,6 @@
+ 		/* NOTREACHED */
+ 	}
+ 	setbuf(stdout, _sobuf);
+-	Play = PLAYER;
+-	init_ui ();
+ # ifndef PROF
+ #ifdef sun
+ 	srandom(getpid());
+@@ -60,6 +59,8 @@
+ # else
+ 	srand(0);
+ # endif
++	Play = random()&01 ? COMP : PLAYER;
++	init_ui ();
+ 	signal(SIGINT, rub);
+ 	for (;;) {
+ 		if (!restore || (Player[PLAYER].total >= 5000
+@@ -73,7 +74,7 @@
+ 		}
+ 		do {
+ 			if (!restore)
+-				Handstart = Play = other(Handstart);
++				Handstart = other(Handstart);
+ 			if (!restore || On_exit) {
+ 				shuffle();
+ 				init();
 @@ -123,9 +124,9 @@
   *	Routine to trap rubouts, and make sure they really want to
   * quit.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Sun May 26 14:21:19 UTC 2013 
Responsible-Changed-Why:  
I will have a look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171792 
State-Changed-From-To: open->closed 
State-Changed-By: antoine 
State-Changed-When: Mon May 27 17:57:08 UTC 2013 
State-Changed-Why:  
Patch committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171792 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/171792: commit references a PR
Date: Mon, 27 May 2013 17:49:58 +0000 (UTC)

 Author: antoine
 Date: Mon May 27 17:49:44 2013
 New Revision: 319277
 URL: http://svnweb.freebsd.org/changeset/ports/319277
 
 Log:
   - Randomize starting player [1]
   - Trim Makefile header
   - Unbreak with clang using -Wno-error=return-type  (this is early K&R code)
   - Respect PREFIX
   
   PR:		ports/171792 [1]
   Submitted by:	David Wolfskill [1]
   Approved by:	eadler (mentor)
 
 Modified:
   head/games/xmille/Makefile
   head/games/xmille/files/patch-mille.c
 
 Modified: head/games/xmille/Makefile
 ==============================================================================
 --- head/games/xmille/Makefile	Mon May 27 17:18:29 2013	(r319276)
 +++ head/games/xmille/Makefile	Mon May 27 17:49:44 2013	(r319277)
 @@ -1,15 +1,11 @@
 -# New ports collection makefile for:    xmille
 -# Date created:         30 Dec 1994
 -# Whom:                 swallace
 -#
 +# Created by: swallace
  # $FreeBSD$
 -#
  
  PORTNAME=	xmille
  PORTVERSION=	2.0
 -PORTREVISION=	3
 +PORTREVISION=	4
  CATEGORIES=	games
 -MASTER_SITES=	${MASTER_SITE_XCONTRIB}
 +MASTER_SITES=	XCONTRIB
  MASTER_SITE_SUBDIR=	games
  DISTNAME=	${PORTNAME}
  
 @@ -21,10 +17,16 @@ WRKSRC=		${WRKDIR}/Mille
  USE_IMAKE=	yes
  USE_XORG=	x11 xext
  MAN1=		xmille.1
 +MANCOMPRESSED=	no
  PLIST_FILES=	bin/xmille
  MAKE_JOBS_UNSAFE=	yes
 +CFLAGS+=	-Wno-error=return-type
  
  post-extract:
  	@${FIND} ${WRKSRC} -name '*.[ao]' -delete
  
 +do-install:
 +	${INSTALL_PROGRAM} ${WRKSRC}/xmille ${PREFIX}/bin
 +	${INSTALL_MAN} ${WRKSRC}/xmille.man ${MANPREFIX}/man/man1/xmille.1
 +
  .include <bsd.port.mk>
 
 Modified: head/games/xmille/files/patch-mille.c
 ==============================================================================
 --- head/games/xmille/files/patch-mille.c	Mon May 27 17:18:29 2013	(r319276)
 +++ head/games/xmille/files/patch-mille.c	Mon May 27 17:49:44 2013	(r319277)
 @@ -1,5 +1,5 @@
 ---- mille.c.orig	Thu Mar 28 14:29:31 1996
 -+++ mille.c	Fri Jun 15 02:27:49 2007
 +--- ./mille.c.orig	1996-03-28 06:29:31.000000000 +0100
 ++++ ./mille.c	2013-05-26 18:05:50.000000000 +0200
  @@ -1,16 +1,17 @@
   # include	"mille.h"
   # include	<signal.h>
 @@ -21,6 +21,33 @@
   
   main(ac, av)
   reg int		ac;
 +@@ -49,8 +50,6 @@
 + 		/* NOTREACHED */
 + 	}
 + 	setbuf(stdout, _sobuf);
 +-	Play = PLAYER;
 +-	init_ui ();
 + # ifndef PROF
 + #ifdef sun
 + 	srandom(getpid());
 +@@ -60,6 +59,8 @@
 + # else
 + 	srand(0);
 + # endif
 ++	Play = random()&01 ? COMP : PLAYER;
 ++	init_ui();
 + 	signal(SIGINT, rub);
 + 	for (;;) {
 + 		if (!restore || (Player[PLAYER].total >= 5000
 +@@ -73,7 +74,7 @@
 + 		}
 + 		do {
 + 			if (!restore)
 +-				Handstart = Play = other(Handstart);
 ++				Handstart = other(Handstart);
 + 			if (!restore || On_exit) {
 + 				shuffle();
 + 				init();
  @@ -123,9 +124,9 @@
    *	Routine to trap rubouts, and make sure they really want to
    * quit.
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
