From 73479d22b8a676e004b4d2f0c81d9fbe51cff730 Mon Sep 17 00:00:00 2001 From: jsm Date: Tue, 28 Dec 1999 18:05:24 +0000 Subject: [PATCH] Use separate definitions and extern declarations of variables rather than linker commons. --- games/sail/extern.h | 52 ++++++++++++++++++++++---------------------- games/sail/globals.c | 25 +++++++++++++++++++-- games/sail/pl_7.c | 20 +++++++++++++++-- games/sail/player.h | 30 ++++++++++++------------- 4 files changed, 82 insertions(+), 45 deletions(-) diff --git a/games/sail/extern.h b/games/sail/extern.h index 794851c70195..0dc7b61b14ce 100644 --- a/games/sail/extern.h +++ b/games/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.12 1999/09/30 18:01:33 jsm Exp $ */ +/* $NetBSD: extern.h,v 1.13 1999/12/28 18:05:24 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,20 +43,20 @@ #include "machdep.h" /* program mode */ -int mode; -jmp_buf restart; +extern int mode; +extern jmp_buf restart; #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 char debug; /* -D */ +extern char randomize; /* -x, give first available ship */ +extern char longfmt; /* -l, print score in long format */ +extern char nobells; /* -b, don't ring bell before Signal */ /* other initial modes */ -char issetuid; /* running setuid */ +extern char issetuid; /* running setuid */ #define die() ((rand() >> 3) % 6 + 1) #define sqr(a) ((a) * (a)) @@ -232,7 +232,7 @@ struct scenario { struct ship ship[NSHIP]; /* 16 */ }; extern struct scenario scene[]; -int nscene; +extern int nscene; struct shipspecs { char bs; @@ -257,8 +257,8 @@ struct shipspecs { }; 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,19 +266,19 @@ struct ship *ls; /* &cc->ship[cc->vessels] */ struct windeffects { char A, B, C, D; }; -const struct windeffects WET[7][6]; +extern const struct windeffects WET[7][6]; struct Tables { char H, G, C, R; }; -const struct Tables RigTable[11][6]; -const struct Tables HullTable[11][6]; +extern const struct Tables RigTable[11][6]; +extern const struct Tables HullTable[11][6]; -const char AMMO[9][4]; -const char HDT[9][10]; -const char HDTrake[9][10]; -const char QUAL[9][5]; -const 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]; extern const char *const countryname[]; extern const char *const classname[]; @@ -290,13 +290,13 @@ extern const char rangeofshot[]; 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 char hasdriver; /* assorted.c */ void table __P((int, int, int, struct ship *, struct ship *, int)); diff --git a/games/sail/globals.c b/games/sail/globals.c index 4e84fdce1b05..5dd061d8c3d3 100644 --- a/games/sail/globals.c +++ b/games/sail/globals.c @@ -1,4 +1,4 @@ -/* $NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $ */ +/* $NetBSD: globals.c,v 1.8 1999/12/28 18:05:24 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $"); +__RCSID("$NetBSD: globals.c,v 1.8 1999/12/28 18:05:24 jsm Exp $"); #endif #endif /* not lint */ @@ -544,3 +544,24 @@ const char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' }; const char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; const char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; + +int mode; +jmp_buf restart; + +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 */ + +char issetuid; + +struct scenario *cc; /* the current scenario */ +struct ship *ls; /* &cc->ship[cc->vessels] */ + +int winddir; +int windspeed; +int turn; +int game; +int alive; +int people; +char hasdriver; diff --git a/games/sail/pl_7.c b/games/sail/pl_7.c index ad60b95b1787..ad665bd25036 100644 --- a/games/sail/pl_7.c +++ b/games/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.12 1999/09/08 21:45:30 jsm Exp $ */ +/* $NetBSD: pl_7.c,v 1.13 1999/12/28 18:05:25 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_7.c,v 1.12 1999/09/08 21:45:30 jsm Exp $"); +__RCSID("$NetBSD: pl_7.c,v 1.13 1999/12/28 18:05:25 jsm Exp $"); #endif #endif /* not lint */ @@ -61,6 +61,22 @@ static const char *sc_prompt; static const char *sc_buf; static int sc_line; +WINDOW *view_w; +WINDOW *slot_w; +WINDOW *scroll_w; +WINDOW *stat_w; +WINDOW *turn_w; + +char done_curses; +char loaded, fired, changed, repaired; +char dont_adjust; +int viewrow, viewcol; +char movebuf[sizeof SHIP(0)->file->movebuf]; +int player; +struct ship *ms; /* memorial structure, &cc->ship[player] */ +struct File *mf; /* ms->file */ +struct shipspecs *mc; /* ms->specs */ + void initscreen() { diff --git a/games/sail/player.h b/games/sail/player.h index 050c797179f1..968af6b45687 100644 --- a/games/sail/player.h +++ b/games/sail/player.h @@ -1,4 +1,4 @@ -/* $NetBSD: player.h,v 1.7 1999/04/18 03:30:12 simonb Exp $ */ +/* $NetBSD: player.h,v 1.8 1999/12/28 18:05:25 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -98,22 +98,22 @@ #define SCREENTEST() (initscr() != NULL && STAT_R < COLS && SCROLL_Y > 0) #endif -WINDOW *view_w; -WINDOW *slot_w; -WINDOW *scroll_w; -WINDOW *stat_w; -WINDOW *turn_w; +extern WINDOW *view_w; +extern WINDOW *slot_w; +extern WINDOW *scroll_w; +extern WINDOW *stat_w; +extern WINDOW *turn_w; -char done_curses; -char loaded, fired, changed, repaired; -char dont_adjust; -int viewrow, viewcol; -char movebuf[sizeof SHIP(0)->file->movebuf]; +extern char done_curses; +extern char loaded, fired, changed, repaired; +extern char dont_adjust; +extern int viewrow, viewcol; +extern char movebuf[sizeof SHIP(0)->file->movebuf]; extern char version[]; -int player; -struct ship *ms; /* memorial structure, &cc->ship[player] */ -struct File *mf; /* ms->file */ -struct shipspecs *mc; /* ms->specs */ +extern int player; +extern struct ship *ms; /* memorial structure, &cc->ship[player] */ +extern struct File *mf; /* ms->file */ +extern struct shipspecs *mc; /* ms->specs */ /* condition codes for leave() */ #define LEAVE_QUIT 0