From cf2fcc31c8c67cb049565480424711afcd78989f Mon Sep 17 00:00:00 2001 From: rahnds Date: Tue, 1 Apr 1997 16:00:52 +0000 Subject: [PATCH] Changes from NetBSD to compile games without warnings due to short being unsigned on some archs, PowerPC, ROMP. --- games/hack/config.h | 4 ++++ games/larn/create.c | 3 ++- games/larn/data.c | 2 +- games/larn/global.c | 4 ++-- games/larn/header.h | 6 +++--- games/mille/move.c | 2 +- games/monop/getinp.c | 8 ++++++-- games/monop/misc.c | 6 ++++-- games/monop/monop.h | 4 ++++ games/trek/trek.h | 4 ++-- 10 files changed, 29 insertions(+), 14 deletions(-) diff --git a/games/hack/config.h b/games/hack/config.h index 0e2d7006fca..47decc61d2c 100644 --- a/games/hack/config.h +++ b/games/hack/config.h @@ -105,7 +105,11 @@ * will do when you have signed characters; otherwise use * typedef short int 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/games/larn/create.c b/games/larn/create.c index 32426589c1f..80b336f2e12 100644 --- a/games/larn/create.c +++ b/games/larn/create.c @@ -5,7 +5,8 @@ static char rcsid[] = "$NetBSD: create.c,v 1.3 1995/03/23 08:33:14 cgd Exp $"; /* 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/games/larn/data.c b/games/larn/data.c index e0e7d43fa43..0bc9fe97513 100644 --- a/games/larn/data.c +++ b/games/larn/data.c @@ -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/games/larn/global.c b/games/larn/global.c index 8e7049eab05..09981c18d3e 100644 --- a/games/larn/global.c +++ b/games/larn/global.c @@ -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/games/larn/header.h b/games/larn/header.h index ee182683158..01db710b07b 100644 --- a/games/larn/header.h +++ b/games/larn/header.h @@ -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[1024]; @@ -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/games/mille/move.c b/games/mille/move.c index c7c1a007a83..d05befb82b8 100644 --- a/games/mille/move.c +++ b/games/mille/move.c @@ -339,7 +339,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/games/monop/getinp.c b/games/monop/getinp.c index b9e5fcc0084..709767ded70 100644 --- a/games/monop/getinp.c +++ b/games/monop/getinp.c @@ -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/games/monop/misc.c b/games/monop/misc.c index 1a71653bdd4..b2e89a4c31f 100644 --- a/games/monop/misc.c +++ b/games/monop/misc.c @@ -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/games/monop/monop.h b/games/monop/monop.h index 0984c2ee94b..fd9981ac8ce 100644 --- a/games/monop/monop.h +++ b/games/monop/monop.h @@ -40,7 +40,11 @@ # include # define reg register +#ifdef __CHAR_UNSIGNED__ +# define shrt short +#else # define shrt char +#endif # define bool int8_t # define unsgn unsigned diff --git a/games/trek/trek.h b/games/trek/trek.h index 780795c14a1..94dcac1bec9 100644 --- a/games/trek/trek.h +++ b/games/trek/trek.h @@ -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 */ -- 2.20.1