diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2007-11-30 12:35:36 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2007-11-30 12:35:36 +0000 |
commit | e94c68469dba96626f898c8ebf2959ee937ef477 (patch) | |
tree | 9f110f1494d8d5af1c0de5f413558ddbfac6a2e9 /games/deal | |
parent | - Fix build with gcc 4.2 (diff) |
- Fix build with gcc 4.2
= Pass maintainership to submitter
PR: 118340
Submitted by: Pietro Cerutti <gahr@gahr.ch>
Approved by: portmgr (pav)
Diffstat (limited to 'games/deal')
-rw-r--r-- | games/deal/Makefile | 14 | ||||
-rw-r--r-- | games/deal/files/patch-deal.c | 81 |
2 files changed, 81 insertions, 14 deletions
diff --git a/games/deal/Makefile b/games/deal/Makefile index 6a266a1b3e6f..000391c66e3e 100644 --- a/games/deal/Makefile +++ b/games/deal/Makefile @@ -10,16 +10,16 @@ PORTVERSION= 2.4 CATEGORIES= games MASTER_SITES= http://catb.org/~esr/deal/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= gahr@gahr.ch COMMENT= A calculator for card-draw probabilities -ALL_TARGET= deal - MAN1= deal.1 PLIST_FILES= bin/deal -pre-build: - ${REINPLACE_CMD} -e "s@-g@${CFLAGS}@g" ${WRKSRC}/Makefile +CFLAGS+= -lm + +do-build: + cd ${WRKSRC} && ${CC} ${CFLAGS} -o deal deal.c do-install: ${INSTALL_PROGRAM} ${WRKSRC}/deal ${PREFIX}/bin @@ -27,10 +27,6 @@ do-install: .include <bsd.port.pre.mk> -.if ${OSVERSION} >= 700029 -BROKEN= Does not compile -.endif - .if ${ARCH} == "ia64" BROKEN= Does not compile on ia64 .endif diff --git a/games/deal/files/patch-deal.c b/games/deal/files/patch-deal.c index 1f2d87063354..1fd7a650a74f 100644 --- a/games/deal/files/patch-deal.c +++ b/games/deal/files/patch-deal.c @@ -1,14 +1,17 @@ ---- deal.c.orig Fri Sep 27 00:31:22 1996 -+++ deal.c Fri Dec 15 01:00:03 2006 -@@ -35,6 +35,7 @@ +--- deal.c.orig 1996-09-27 00:31:22.000000000 +0200 ++++ deal.c 2007-11-30 00:00:29.000000000 +0100 +@@ -35,8 +35,10 @@ * rounds to zero. */ #include <stdio.h> +#include <stdlib.h> #include <math.h> #include <signal.h> ++#include <unistd.h> -@@ -49,6 +50,7 @@ + #define BASE_DEFAULT 7 /* # cards in initial deal */ + #define TURNS_DEFAULT 20 /* show this many turns if total is greater */ +@@ -49,6 +51,7 @@ static int verbose = FALSE; static double log_a_choose_b(int a, int b); @@ -16,7 +19,14 @@ static void hypercatch(int sig) { -@@ -80,7 +82,6 @@ +@@ -74,13 +77,12 @@ + exit(0); + } + +-main(argc, argv) ++int main(argc, argv) + int argc; + char **argv; { extern char *optarg; /* set by getopt */ extern int optind; /* set by getopt */ @@ -24,3 +34,64 @@ int status, special, total, columns, i, j; int base = BASE_DEFAULT; +@@ -97,11 +99,11 @@ + switch (status) + { + case 'b': +- base = atoi(optarg); ++ base = (int)strtol(optarg, (char **)NULL, 10); + break; + + case 'c': +- columns = atoi(optarg); ++ columns = (int)strtol(optarg, (char **)NULL, 10); + break; + + case 'G': +@@ -142,7 +144,7 @@ + } + + if (gammatest) { +- double p = lgamma(atoi(argv[optind])); ++ double p = lgamma(strtod(argv[optind], (char **)NULL)); + + (void) printf("lgamma(%d) = %f\n", atoi(argv[optind]), p); + exit(0); +@@ -212,7 +214,7 @@ + (void) printf("\n"); + (void) printf("-----+"); + for (j = 0; j < columns; j++) +- (void) printf(wide ? "----" : "---", j); ++ (void) printf(wide ? "----" : "---"); + (void) printf("\n"); + } + +@@ -239,6 +241,8 @@ + + (void) printf("\n"); + } ++ ++ return (0); + } + + /* +@@ -276,7 +280,8 @@ + sa = a; + sb = b; + +- signal(SIGFPE, choosecatch); ++ if(signal(SIGFPE, choosecatch) == SIG_ERR) ++ exit(EXIT_FAILURE); + + if (b >= a) + p = 0; +@@ -287,7 +292,8 @@ + if (verbose) + (void) fprintf(stderr, "log_a_choose_b(%d, %d) = %f\n", a, b, p); + +- signal(SIGFPE, hypercatch); ++ if(signal(SIGFPE, hypercatch) == SIG_ERR) ++ exit(EXIT_FAILURE); + + return(p); + } |