From: thorpej Date: Sat, 29 Mar 1997 20:42:16 +0000 (+0000) Subject: Make these compile on the PowerPC (an unsigned char system). X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/commitdiff_plain/77949edf212dfa805753ec2d69e3e91181793816?ds=inline Make these compile on the PowerPC (an unsigned char system). --- diff --git a/hack/config.h b/hack/config.h index f7bb5c5c..e18bcbaf 100644 --- a/hack/config.h +++ b/hack/config.h @@ -1,7 +1,7 @@ /* * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. * - * $NetBSD: config.h,v 1.3 1995/03/23 08:29:15 cgd Exp $ + * $NetBSD: config.h,v 1.4 1997/03/29 20:42:16 thorpej Exp $ */ #include "pathnames.h" @@ -107,7 +107,11 @@ * will do when you have signed characters; otherwise use * typedef short int schar; */ -typedef char schar; +#ifdef __CHAR_UNSIGNED__ +typedef short int schar; +#else +typedef char schar; +#endif /* * small unsigned integers (8 bits suffice - but 7 bits do not) diff --git a/larn/create.c b/larn/create.c index 32426589..c8b04a70 100644 --- a/larn/create.c +++ b/larn/create.c @@ -1,11 +1,12 @@ #ifndef lint -static char rcsid[] = "$NetBSD: create.c,v 1.3 1995/03/23 08:33:14 cgd Exp $"; +static char rcsid[] = "$NetBSD: create.c,v 1.4 1997/03/29 20:42:17 thorpej Exp $"; #endif /* not lint */ /* create.c Larn is copyrighted 1986 by Noah Morgan. */ #include "header.h" extern char spelknow[],larnlevels[]; -extern char beenhere[],wizard,level; +extern char beenhere[],wizard; +extern short level; extern short oldx,oldy; /* makeplayer() diff --git a/larn/data.c b/larn/data.c index e0e7d43f..811e9a05 100644 --- a/larn/data.c +++ b/larn/data.c @@ -1,4 +1,4 @@ -/* $NetBSD: data.c,v 1.5 1995/03/23 08:33:17 cgd Exp $ */ +/* $NetBSD: data.c,v 1.6 1997/03/29 20:42:18 thorpej Exp $ */ /*- * Copyright (c) 1988 The Regents of the University of California. @@ -37,12 +37,12 @@ #if 0 static char sccsid[] = "@(#)data.c 5.3 (Berkeley) 5/13/91"; #else -static char rcsid[] = "$NetBSD: data.c,v 1.5 1995/03/23 08:33:17 cgd Exp $"; +static char rcsid[] = "$NetBSD: data.c,v 1.6 1997/03/29 20:42:18 thorpej Exp $"; #endif #endif /* not lint */ /* data.c Larn is copyrighted 1986 by Noah Morgan. */ -#define NODEFS +/* #define NODEFS */ #include "header.h" /* @@ -142,7 +142,7 @@ char sex=1; /* default is a man 0=woman */ char boldon=1; /* 1=bold objects 0=inverse objects */ char ckpflag=0; /* 1 if want checkpointing of game, 0 otherwise */ char cheat=0; /* 1 if the player has fudged save file */ -char level=0; /* cavelevel player is on = c[CAVELEVEL] */ +short level=0; /* cavelevel player is on = c[CAVELEVEL] */ char wizard=0; /* the wizard mode flag */ short lastnum=0; /* the number of the monster last hitting player */ short hitflag=0; /* flag for if player has been hit when running */ diff --git a/larn/global.c b/larn/global.c index 8e7049ea..80736170 100644 --- a/larn/global.c +++ b/larn/global.c @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "$NetBSD: global.c,v 1.4 1995/04/24 12:23:52 cgd Exp $"; +static char rcsid[] = "$NetBSD: global.c,v 1.5 1997/03/29 20:42:19 thorpej Exp $"; #endif /* not lint */ /* global.c Larn is copyrighted 1986 by Noah Morgan. @@ -26,8 +26,8 @@ static char rcsid[] = "$NetBSD: global.c,v 1.4 1995/04/24 12:23:52 cgd Exp $"; #include extern int score[],srcount,dropflag; extern int random;/* the random number seed */ -extern short playerx,playery,lastnum; -extern char cheat,level,monstnamelist[]; +extern short playerx,playery,lastnum,level; +extern char cheat,monstnamelist[]; extern char lastmonst[],*what[],*who[]; extern char winner[]; extern char logname[],monstlevel[]; diff --git a/larn/header.h b/larn/header.h index f6162229..2389d587 100644 --- a/larn/header.h +++ b/larn/header.h @@ -1,4 +1,4 @@ -/* $NetBSD: header.h,v 1.8 1996/05/22 00:36:04 mrg Exp $ */ +/* $NetBSD: header.h,v 1.9 1997/03/29 20:42:20 thorpej Exp $ */ /* header.h Larn is copyrighted 1986 by Noah Morgan. */ @@ -71,7 +71,7 @@ struct sphere struct sphere *p; /* pointer to next structure */ char x,y,lev; /* location of the sphere */ char dir; /* direction sphere is going in */ - char lifetime; /* duration of the sphere */ + short lifetime; /* duration of the sphere */ }; /* defines for the character attribute array c[] */ @@ -334,7 +334,7 @@ extern char aborted[],alpha[],beenhere[],boldon,cheat,ckpfile[],ckpflag; extern char *class[],course[],diagfile[],helpfile[]; extern char *inbuffer,is_alpha[],is_digit[]; extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[]; -extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend; +extern char *levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend; extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[]; extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome; extern char nplt[],nsw[],*objectname[],objnamelist[],optsfile[]; @@ -346,7 +346,7 @@ extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM]; extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard; extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY]; extern short iarg[MAXX][MAXY],ivenarg[],lasthx,lasthy,lastnum,lastpx,lastpy; -extern short nobeep,oldx,oldy,playerx,playery; +extern short nobeep,oldx,oldy,playerx,playery,level; extern int dayplay,enable_scroll,srcount,yrepcount,userid,wisid,lfd,fd; extern uid_t uid, euid; extern long initialtime,outstanding_taxes,skill[],gtime,c[],cbak[]; diff --git a/mille/move.c b/mille/move.c index 422e8db7..a63c717a 100644 --- a/mille/move.c +++ b/mille/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.4 1995/03/24 05:01:57 cgd Exp $ */ +/* $NetBSD: move.c,v 1.5 1997/03/29 20:42:21 thorpej Exp $ */ /* * Copyright (c) 1983, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: move.c,v 1.4 1995/03/24 05:01:57 cgd Exp $"; +static char rcsid[] = "$NetBSD: move.c,v 1.5 1997/03/29 20:42:21 thorpej Exp $"; #endif #endif /* not lint */ @@ -342,7 +342,7 @@ protected: if (pp == &Player[PLAYER]) account(card); pp->hand[Card_no] = C_INIT; - Next = (Next == -1 ? FALSE : TRUE); + Next = (Next == (bool)-1 ? FALSE : TRUE); return TRUE; } diff --git a/monop/getinp.c b/monop/getinp.c index b9e5fcc0..5de77f8d 100644 --- a/monop/getinp.c +++ b/monop/getinp.c @@ -1,4 +1,4 @@ -/* $NetBSD: getinp.c,v 1.4 1995/04/24 12:24:20 cgd Exp $ */ +/* $NetBSD: getinp.c,v 1.5 1997/03/29 20:42:22 thorpej Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: getinp.c,v 1.4 1995/04/24 12:24:20 cgd Exp $"; +static char rcsid[] = "$NetBSD: getinp.c,v 1.5 1997/03/29 20:42:22 thorpej Exp $"; #endif #endif /* not lint */ @@ -56,17 +56,21 @@ char *prompt, *list[]; { reg int i, n_match, match; char *sp; + int c; int plen; static int comp(); for (;;) { inter: printf(prompt); - for (sp = buf; (*sp=getchar()) != '\n'; ) - if (*sp == -1) /* check for interupted system call */ + for (sp = buf; (c=getchar()) != '\n'; ) { + *sp = c; + if (c == -1) /* check for interupted system call */ goto inter; else if (sp != buf || *sp != ' ') sp++; + } + *sp = c; if (buf[0] == '?' && buf[1] == '\n') { printf("Valid inputs are: "); for (i = 0, match = 18; list[i]; i++) { diff --git a/monop/initdeck.c b/monop/initdeck.c index c2ff8310..7d79c31c 100644 --- a/monop/initdeck.c +++ b/monop/initdeck.c @@ -1,4 +1,4 @@ -/* $NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $ */ +/* $NetBSD: initdeck.c,v 1.4 1997/03/29 20:42:23 thorpej Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $"; +static char rcsid[] = "$NetBSD: initdeck.c,v 1.4 1997/03/29 20:42:23 thorpej Exp $"; #endif #endif /* not lint */ @@ -130,7 +130,7 @@ count() { reg bool newline; reg DECK *in_deck; - reg char c; + reg int c; newline = TRUE; in_deck = &CC_D; @@ -152,7 +152,7 @@ putem() { reg bool newline; reg DECK *in_deck; - reg char c; + reg int c; reg int num; in_deck = &CC_D; diff --git a/monop/misc.c b/monop/misc.c index 1a71653b..00d301e2 100644 --- a/monop/misc.c +++ b/monop/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.4 1995/03/23 08:34:47 cgd Exp $ */ +/* $NetBSD: misc.c,v 1.5 1997/03/29 20:42:24 thorpej Exp $ */ /* * Copyright (c) 1980, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: misc.c,v 1.4 1995/03/23 08:34:47 cgd Exp $"; +static char rcsid[] = "$NetBSD: misc.c,v 1.5 1997/03/29 20:42:24 thorpej Exp $"; #endif #endif /* not lint */ @@ -92,15 +92,17 @@ reg char *prompt; { reg int num; reg char *sp; + int c; char buf[257]; for (;;) { inter: printf(prompt); num = 0; - for (sp = buf; (*sp=getchar()) != '\n'; sp++) - if (*sp == -1) /* check for interrupted system call */ + for (sp = buf; (c=getchar()) != '\n'; *sp++ = c) + if (c == -1) /* check for interrupted system call */ goto inter; + *sp = c; if (sp == buf) continue; for (sp = buf; isspace(*sp); sp++) diff --git a/monop/monop.h b/monop/monop.h index 2bc82dab..1c7b161d 100644 --- a/monop/monop.h +++ b/monop/monop.h @@ -1,4 +1,4 @@ -/* $NetBSD: monop.h,v 1.4 1995/04/24 12:24:23 cgd Exp $ */ +/* $NetBSD: monop.h,v 1.5 1997/03/29 20:42:25 thorpej Exp $ */ /* * Copyright (c) 1980, 1993 @@ -40,7 +40,11 @@ # include # define reg register +#ifdef __CHAR_UNSIGNED__ +# define shrt short +#else # define shrt char +#endif # define bool char # define unsgn unsigned diff --git a/trek/trek.h b/trek/trek.h index 780795c1..8581dfb3 100644 --- a/trek/trek.h +++ b/trek/trek.h @@ -1,4 +1,4 @@ -/* $NetBSD: trek.h,v 1.3 1995/04/22 10:59:36 cgd Exp $ */ +/* $NetBSD: trek.h,v 1.4 1997/03/29 20:42:26 thorpej Exp $ */ /* * Copyright (c) 1980, 1993 @@ -76,7 +76,7 @@ struct quad /* definition for each quadrant */ char klings; /* number of Klingons in this quadrant */ char holes; /* number of black holes in this quadrant */ int scanned; /* star chart entry (see below) */ - char stars; /* number of stars in this quadrant */ + short stars; /* number of stars in this quadrant */ char qsystemname; /* starsystem name (see below) */ }; @@ -339,7 +339,7 @@ struct struct { struct kling klingon[MAXKLQUAD]; /* sorted Klingon list */ - char nkling; /* number of Klingons in this sector */ + short nkling; /* number of Klingons in this sector */ /* < 0 means automatic override mode */ char fast; /* set if speed > 300 baud */ struct xy starbase; /* starbase in current quadrant */