X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/bd10b531314ec546d25fd238f27d94c74a726567..86af82ece770d2d27871e6083bc8eb4f7d2bbd3f:/sail/extern.h diff --git a/sail/extern.h b/sail/extern.h index d5ae5701..f2288406 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.5 1997/10/13 21:03:49 christos Exp $ */ +/* $NetBSD: extern.h,v 1.27 2004/02/08 00:32:48 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -35,32 +31,27 @@ * @(#)externs.h 8.1 (Berkeley) 5/31/93 */ -#include -#include -#include -#include -#include +#include + #include "machdep.h" /* program mode */ -int mode; -jmp_buf restart; +extern int mode; #define MODE_PLAYER 1 #define MODE_DRIVER 2 #define MODE_LOGGER 3 /* command line flags */ -char debug; /* -D */ -char randomize; /* -x, give first available ship */ -char longfmt; /* -l, print score in long format */ -char nobells; /* -b, don't ring bell before Signal */ +extern int randomize; /* -x, give first available ship */ +extern int longfmt; /* -l, print score in long format */ +extern int nobells; /* -b, don't ring bell before Signal */ /* other initial modes */ -char issetuid; /* running setuid */ +extern gid_t gid; +extern gid_t egid; -#define die() ((rand() >> 3) % 6 + 1) +#define dieroll() ((random()) % 6 + 1) #define sqr(a) ((a) * (a)) -#define abs(a) ((a) > 0 ? (a) : -(a)) #define min(a,b) ((a) < (b) ? (a) : (b)) #define grappled(a) ((a)->file->ngrap) @@ -214,7 +205,7 @@ struct File { }; struct ship { - char *shipname; /* 0 */ + const char *shipname; /* 0 */ struct shipspecs *specs; /* 2 */ unsigned char nationality; /* 4 */ short shiprow; /* 6 */ @@ -228,11 +219,11 @@ struct scenario { char windspeed; /* 2 */ char windchange; /* 4 */ unsigned char vessels; /* 12 */ - char *name; /* 14 */ + const char *name; /* 14 */ struct ship ship[NSHIP]; /* 16 */ }; -struct scenario scene[]; -int nscene; +extern struct scenario scene[]; +extern int nscene; struct shipspecs { char bs; @@ -255,10 +246,10 @@ struct shipspecs { int rig4; short pts; }; -struct shipspecs specs[]; +extern struct shipspecs specs[]; -struct scenario *cc; /* the current scenario */ -struct ship *ls; /* &cc->ship[cc->vessels] */ +extern struct scenario *cc; /* the current scenario */ +extern struct ship *ls; /* &cc->ship[cc->vessels] */ #define SHIP(s) (&cc->ship[s]) #define foreachship(sp) for ((sp) = cc->ship; (sp) < ls; (sp)++) @@ -266,175 +257,157 @@ struct ship *ls; /* &cc->ship[cc->vessels] */ struct windeffects { char A, B, C, D; }; -struct windeffects WET[7][6]; +extern const struct windeffects WET[7][6]; struct Tables { char H, G, C, R; }; -struct Tables RigTable[11][6]; -struct Tables HullTable[11][6]; +extern const struct Tables RigTable[11][6]; +extern const struct Tables HullTable[11][6]; -char AMMO[9][4]; -char HDT[9][10]; -char HDTrake[9][10]; -char QUAL[9][5]; -char MT[9][3]; +extern const char AMMO[9][4]; +extern const char HDT[9][10]; +extern const char HDTrake[9][10]; +extern const char QUAL[9][5]; +extern const char MT[9][3]; -char *countryname[]; -char *classname[]; -char *directionname[]; -char *qualname[]; -char loadname[]; +extern const char *const countryname[]; +extern const char *const classname[]; +extern const char *const directionname[]; +extern const char *const qualname[]; +extern const char loadname[]; -char rangeofshot[]; +extern const char rangeofshot[]; -char dr[], dc[]; +extern const char dr[], dc[]; -int winddir; -int windspeed; -int turn; -int game; -int alive; -int people; -char hasdriver; +extern int winddir; +extern int windspeed; +extern int turn; +extern int game; +extern int alive; +extern int people; +extern int hasdriver; /* assorted.c */ -void table __P((int, int, int, struct ship *, struct ship *, int)); -void Cleansnag __P((struct ship *, struct ship *, int, int)); +void table (struct ship *, struct ship *, int, int, int, int); +void Cleansnag (struct ship *, struct ship *, int, int); /* dr_1.c */ -void unfoul __P((void)); -void boardcomp __P((void)); -int fightitout __P((struct ship *, struct ship *, int)); -void resolve __P((void)); -void compcombat __P((void)); -int next __P((void)); +void unfoul (void); +void boardcomp (void); +void resolve (void); +void compcombat (void); +int next (void); /* dr_2.c */ -void thinkofgrapples __P((void)); -void checkup __P((void)); -void prizecheck __P((void)); -int strend __P((char *)); -void closeon __P((struct ship *, struct ship *, char[], int, int, int)); -int score __P((char[], struct ship *, struct ship *, int)); -void move __P((char *, struct ship *, unsigned char *, short *, short *, char *)); -void try __P((char[], char [], int, int, int, int, int, struct ship *, - struct ship *, int *, int)); -void rmend __P((char *)); +void thinkofgrapples (void); +void checkup (void); +void prizecheck (void); +void closeon (struct ship *, struct ship *, char *, int, int, int); /* dr_3.c */ -void moveall __P((void)); -int stillmoving __P((int)); -int isolated __P((struct ship *)); -int push __P((struct ship *, struct ship *)); -void step __P((int, struct ship *, char *)); -void sendbp __P((struct ship *, struct ship *, int, int)); -int toughmelee __P((struct ship *, struct ship *, int, int)); -void reload __P((void)); -void checksails __P((void)); +void moveall (void); +void sendbp (struct ship *, struct ship *, int, int); +int is_toughmelee (struct ship *, struct ship *, int, int); +void reload (void); +void checksails (void); /* dr_4.c */ -void ungrap __P((struct ship *, struct ship *)); -void grap __P((struct ship *, struct ship *)); +void ungrap (struct ship *, struct ship *); +void grap (struct ship *, struct ship *); /* dr_5.c */ -void subtract __P((struct ship *, int, int [3], struct ship *, int)); -int mensent __P((struct ship *, struct ship *, int[3], struct ship **, int *, - int)); +void subtract (struct ship *, struct ship *, int, int [3], int); +int mensent (struct ship *, struct ship *, int[3], struct ship **, int *, + int); /* dr_main.c */ -int dr_main __P((void)); +int dr_main (void); /* game.c */ -int maxturns __P((struct ship *, char *)); -int maxmove __P((struct ship *, int, int)); +int maxturns (struct ship *, char *); +int maxmove (struct ship *, int, int); /* lo_main.c */ -int lo_main __P((void)); +int lo_main (void); /* misc.c */ -int range __P((struct ship *, struct ship *)); -struct ship *closestenemy __P((struct ship *, int, int)); -int angle __P((int, int)); -int gunsbear __P((struct ship *, struct ship *)); -int portside __P((struct ship *, struct ship *, int)); -int colours __P((struct ship *)); -void logger __P((struct ship *)); +int range (struct ship *, struct ship *); +struct ship *closestenemy (struct ship *, int, int); +int gunsbear (struct ship *, struct ship *); +int portside (struct ship *, struct ship *, int); +int colours (struct ship *); +void logger (struct ship *); /* parties.c */ -int meleeing __P((struct ship *, struct ship *)); -int boarding __P((struct ship *, int)); -void unboard __P((struct ship *, struct ship *, int)); +int meleeing (struct ship *, struct ship *); +int boarding (struct ship *, int); +void unboard (struct ship *, struct ship *, int); /* pl_1.c */ -void leave __P((int)); -void choke __P((int)); -void child __P((int)); +void leave (int) __attribute__((__noreturn__)); +void choke (int) __attribute__((__noreturn__)); +void child (int); /* pl_2.c */ -void play __P((void)); +void play (void) __attribute__((__noreturn__)); /* pl_3.c */ -void acceptcombat __P((void)); -void grapungrap __P((void)); -void unfoulplayer __P((void)); +void acceptcombat (void); +void grapungrap (void); +void unfoulplayer (void); /* pl_4.c */ -void changesail __P((void)); -void acceptsignal __P((void)); -void lookout __P((void)); -char *saywhat __P((struct ship *, int)); -void eyeball __P((struct ship *)); +void changesail (void); +void acceptsignal (void); +void lookout (void); +const char *saywhat (struct ship *, int); +void eyeball (struct ship *); /* pl_5.c */ -void acceptmove __P((void)); -void acceptboard __P((void)); -void parties __P((int[3], struct ship *, int, int)); +void acceptmove (void); +void acceptboard (void); /* pl_6.c */ -void repair __P((void)); -int turned __P((void)); -void loadplayer __P((void)); +void repair (void); +void loadplayer (void); /* pl_7.c */ -void initscreen __P((void)); -void cleanupscreen __P((void)); -void newturn __P((int)); -void Signal __P((const char *, struct ship *, ...)) +void initscreen (void); +void cleanupscreen (void); +void newturn (int); +void Signal (const char *, struct ship *, ...) __attribute__((__format__(__printf__,1,3))); -void Msg __P((const char *, ...)) +void Msg (const char *, ...) __attribute__((__format__(__printf__,1,2))); -void Scroll __P((void)); -void prompt __P((char *, struct ship *)); -void endprompt __P((int)); -int sgetch __P((char *, struct ship *, int)); -void sgetstr __P((char *, char *, int)); -void draw_screen __P((void)); -void draw_view __P((void)); -void draw_turn __P((void)); -void draw_stat __P((void)); -void draw_slot __P((void)); -void draw_board __P((void)); -void centerview __P((void)); -void upview __P((void)); -void downview __P((void)); -void leftview __P((void)); -void rightview __P((void)); -void adjustview __P((void)); +void prompt (const char *, struct ship *); +int sgetch (const char *, struct ship *, int); +void sgetstr (const char *, char *, int); +void draw_screen (void); +void draw_view (void); +void draw_turn (void); +void draw_stat (void); +void draw_slot (void); +void draw_board (void); +void centerview (void); +void upview (void); +void downview (void); +void leftview (void); +void rightview (void); /* pl_main.c */ -int pl_main __P((void)); -void initialize __P((void)); +int pl_main (void); /* sync.c */ -void fmtship __P((char *, size_t, const char *, struct ship *)); -void makesignal __P((struct ship *, const char *, struct ship *, ...)) +void fmtship (char *, size_t, const char *, struct ship *); +void makesignal (struct ship *, const char *, struct ship *, ...) __attribute__((__format__(__printf__,2,4))); -void makemsg __P((struct ship *, const char *, ...)) +void makemsg (struct ship *, const char *, ...) __attribute__((__format__(__printf__,2,3))); -int sync_exists __P((int)); -int sync_open __P((void)); -void sync_close __P((int)); -void Write __P((int, struct ship *, int, long, long, long, long)); -int Sync __P((void)); -int sync_update __P((int, struct ship *, long, long, long, long)); +int sync_exists (int); +int sync_open (void); +void sync_close (int); +void Write (int, struct ship *, long, long, long, long); +void Writestr (int, struct ship *, const char *); +int Sync (void);