-/* $NetBSD: extern.h,v 1.34 2009/03/15 03:33:56 dholland Exp $ */
+/* $NetBSD: extern.h,v 1.35 2009/08/12 09:05:08 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
int rig4;
short pts;
};
-extern struct shipspecs specs[];
extern struct scenario *cc; /* the current scenario */
extern struct ship *ls; /* &cc->ship[cc->vessels] */
__attribute__((__format__(__printf__,1,3)));
void Msg(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
-void prompt(const char *, struct ship *);
int sgetch(const char *, struct ship *, int);
void sgetstr(const char *, char *, int);
void centerview(void);
-/* $NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: globals.c,v 1.15 2009/08/12 09:05:08 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: globals.c,v 1.15 2009/08/12 09:05:08 dholland Exp $");
#endif
#endif /* not lint */
#include <setjmp.h>
#include "extern.h"
+static struct shipspecs specs[];
+
struct scenario scene[] = {
/*
* int winddir;
};
int nscene = sizeof scene / sizeof (struct scenario);
-struct shipspecs specs[] = {
+static struct shipspecs specs[] = {
/* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */
/* class qual crew2 gunL carL rig1 rig3 */
/*00*/{ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7 },
-/* $NetBSD: lo_main.c,v 1.16 2009/03/14 20:14:56 dholland Exp $ */
+/* $NetBSD: lo_main.c,v 1.17 2009/08/12 09:05:08 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)lo_main.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: lo_main.c,v 1.16 2009/03/14 20:14:56 dholland Exp $");
+__RCSID("$NetBSD: lo_main.c,v 1.17 2009/08/12 09:05:08 dholland Exp $");
#endif
#endif /* not lint */
#include "extern.h"
#include "pathnames.h"
-const char *const title[] = {
+static const char *const title[] = {
"Admiral", "Commodore", "Captain", "Captain",
"Captain", "Captain", "Captain", "Commander",
"Commander", "Lieutenant"
-/* $NetBSD: pl_7.c,v 1.37 2009/03/15 22:19:23 dholland Exp $ */
+/* $NetBSD: pl_7.c,v 1.38 2009/08/12 09:05:08 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_7.c,v 1.37 2009/03/15 22:19:23 dholland Exp $");
+__RCSID("$NetBSD: pl_7.c,v 1.38 2009/08/12 09:05:08 dholland Exp $");
#endif
#endif /* not lint */
int done_curses;
int loaded, fired, changed, repaired;
int dont_adjust;
-int viewrow, viewcol;
+static int viewrow, viewcol;
char movebuf[sizeof SHIP(0)->file->movebuf];
int player;
struct ship *ms; /* memorial structure, &cc->ship[player] */
scrollarea_add(buf);
}
-void
+static void
prompt(const char *p, struct ship *ship)
{
static char buf[BUFSIZ];
-/* $NetBSD: player.h,v 1.12 2009/03/14 20:10:43 dholland Exp $ */
+/* $NetBSD: player.h,v 1.13 2009/08/12 09:05:08 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
extern int done_curses;
extern int loaded, fired, changed, repaired;
extern int dont_adjust;
-extern int viewrow, viewcol;
extern char movebuf[sizeof SHIP(0)->file->movebuf];
extern const char version[];
extern int player;
-/* $NetBSD: capture.c,v 1.11 2009/05/24 22:55:03 dholland Exp $ */
+/* $NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)capture.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: capture.c,v 1.11 2009/05/24 22:55:03 dholland Exp $");
+__RCSID("$NetBSD: capture.c,v 1.12 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
#include <stdio.h>
#include "trek.h"
+static struct kling *selectklingon(void);
+
/*
** Ask a Klingon To Surrender
**
** Cruddy, just takes one at random. Should ask the captain.
*/
-struct kling *
+static struct kling *
selectklingon(void)
{
int i;
-/* $NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $ */
+/* $NetBSD: computer.c,v 1.16 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: computer.c,v 1.15 2009/05/24 23:20:22 dholland Exp $");
+__RCSID("$NetBSD: computer.c,v 1.16 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** command processor.
*/
-struct cvntab Cputab[] = {
+static struct cvntab Cputab[] = {
{ "ch", "art", (cmdfun)1, 0 },
{ "t", "rajectory", (cmdfun)2, 0 },
{ "c", "ourse", (cmdfun)3, 0 },
-/* $NetBSD: dumpgame.c,v 1.14 2009/05/24 21:44:56 dholland Exp $ */
+/* $NetBSD: dumpgame.c,v 1.15 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dumpgame.c,v 1.14 2009/05/24 21:44:56 dholland Exp $");
+__RCSID("$NetBSD: dumpgame.c,v 1.15 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
static int readdump(int);
-struct dump Dump_template[] = {
+static struct dump Dump_template[] = {
{ (char *)&Ship, sizeof (Ship) },
{ (char *)&Now, sizeof (Now) },
{ (char *)&Param, sizeof (Param) },
-/* $NetBSD: getpar.c,v 1.17 2009/05/25 00:43:34 dholland Exp $ */
+/* $NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getpar.c,v 1.17 2009/05/25 00:43:34 dholland Exp $");
+__RCSID("$NetBSD: getpar.c,v 1.18 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** get yes/no parameter
**/
-const struct cvntab Yntab[] = {
+static const struct cvntab Yntab[] = {
{ "y", "es", (cmdfun)1, 1 },
{ "n", "o", (cmdfun)0, 0 },
{ NULL, NULL, NULL, 0 }
-/* $NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $ */
+/* $NetBSD: help.c,v 1.13 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: help.c,v 1.12 2009/05/24 22:55:03 dholland Exp $");
+__RCSID("$NetBSD: help.c,v 1.13 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** to drop you. After that, it's your problem.
*/
-const char *const Cntvect[3] = {
+static const char *const Cntvect[3] = {
"first", "second", "third"
};
-/* $NetBSD: lose.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */
+/* $NetBSD: lose.c,v 1.10 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)lose.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: lose.c,v 1.9 2009/05/24 21:44:56 dholland Exp $");
+__RCSID("$NetBSD: lose.c,v 1.10 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
extern jmp_buf env;
-const char *const Losemsg[] = {
+static const char *const Losemsg[] = {
"You ran out of time",
"You ran out of energy",
"You have been destroyed",
-/* $NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $ */
+/* $NetBSD: phaser.c,v 1.15 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)phaser.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: phaser.c,v 1.14 2009/05/24 22:55:03 dholland Exp $");
+__RCSID("$NetBSD: phaser.c,v 1.15 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** Uses trace flag 30
*/
-struct cvntab Matab[] = {
+static struct cvntab Matab[] = {
{ "m", "anual", (cmdfun) 1, 0 },
{ "a", "utomatic", (cmdfun) 0, 0 },
{ NULL, NULL, NULL, 0 }
-/* $NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $ */
+/* $NetBSD: play.c,v 1.12 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: play.c,v 1.11 2009/05/24 21:44:56 dholland Exp $");
+__RCSID("$NetBSD: play.c,v 1.12 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
#include "trek.h"
#include "getpar.h"
+static void myreset(int) __dead;
+
/*
** INSTRUCTION READ AND MAIN PLAY LOOP
**
extern jmp_buf env;
-const struct cvntab Comtab[] = {
+static const struct cvntab Comtab[] = {
{ "abandon", "", abandon, 0 },
{ "ca", "pture", capture, 0 },
{ "cl", "oak", shield, -1 },
};
/*ARGSUSED*/
-void
+static void
myreset(int v __unused)
{
-/* $NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $ */
+/* $NetBSD: shield.c,v 1.13 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: shield.c,v 1.12 2009/05/25 00:43:34 dholland Exp $");
+__RCSID("$NetBSD: shield.c,v 1.13 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** so you get partial hits.
*/
-const struct cvntab Udtab[] = {
+static const struct cvntab Udtab[] = {
{ "u", "p", (cmdfun)1, 0 },
{ "d", "own", (cmdfun)0, 0 },
{ NULL, NULL, NULL, 0 }
-/* $NetBSD: srscan.c,v 1.10 2009/05/25 00:39:45 dholland Exp $ */
+/* $NetBSD: srscan.c,v 1.11 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)srscan.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: srscan.c,v 1.10 2009/05/25 00:39:45 dholland Exp $");
+__RCSID("$NetBSD: srscan.c,v 1.11 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
** The current quadrant is filled in on the computer chart.
*/
-const char *const Color[4] = {
+static const char *const Color[4] = {
"GREEN",
"DOCKED",
"YELLOW",
-/* $NetBSD: trek.h,v 1.17 2009/05/25 00:07:14 dholland Exp $ */
+/* $NetBSD: trek.h,v 1.18 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
/* capture.c */
void capture(int);
-struct kling *selectklingon(void);
/* check_out.c */
int check_out(int);
void phaser(int);
/* play.c */
-void myreset(int) __dead;
void play(void) __dead;
/* ram.c */
-/* $NetBSD: visual.c,v 1.9 2009/05/24 21:44:56 dholland Exp $ */
+/* $NetBSD: visual.c,v 1.10 2009/08/12 08:54:54 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)visual.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: visual.c,v 1.9 2009/05/24 21:44:56 dholland Exp $");
+__RCSID("$NetBSD: visual.c,v 1.10 2009/08/12 08:54:54 dholland Exp $");
#endif
#endif /* not lint */
*/
/* This struct[] has the delta x, delta y for particular directions */
-struct xy Visdelta[11] = {
+static struct xy Visdelta[11] = {
{ -1, -1 },
{ -1, 0 },
{ -1, 1 },
-/* $NetBSD: worm.c,v 1.28 2008/08/08 16:10:47 drochner Exp $ */
+/* $NetBSD: worm.c,v 1.29 2009/08/12 08:56:41 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: worm.c,v 1.28 2008/08/08 16:10:47 drochner Exp $");
+__RCSID("$NetBSD: worm.c,v 1.29 2009/08/12 08:56:41 dholland Exp $");
#endif
#endif /* not lint */
#define RUNLEN 8
#define CNTRL(p) (p-'A'+1)
-WINDOW *tv;
-WINDOW *stw;
struct body {
int x;
int y;
struct body *prev;
struct body *next;
-} *head, *tail, goody;
-int growing = 0;
-int running = 0;
-int slow = 0;
-int score = 0;
-int start_len = LENGTH;
-int visible_len;
-int lastch;
-char outbuf[BUFSIZ];
-
-void crash(void) __dead;
-void display(const struct body *, char);
+};
+
+static WINDOW *tv;
+static WINDOW *stw;
+static struct body *head, *tail, goody;
+static int growing = 0;
+static int running = 0;
+static int slow = 0;
+static int score = 0;
+static int start_len = LENGTH;
+static int visible_len;
+static int lastch;
+static char outbuf[BUFSIZ];
+
int main(int, char **);
-void leave(int) __dead;
-void life(void);
-void newpos(struct body *);
-void process(int);
-void prize(void);
-int rnd(int);
-void setup(void);
-void wake(int);
+static void crash(void) __dead;
+static void display(const struct body *, char);
+static void leave(int) __dead;
+static void life(void);
+static void newpos(struct body *);
+static void process(int);
+static void prize(void);
+static int rnd(int);
+static void setup(void);
+static void wake(int);
int
main(argc, argv)
}
}
-void
+static void
life()
{
struct body *bp, *np;
visible_len = start_len + 1;
}
-void
+static void
display(pos, chr)
const struct body *pos;
char chr;
waddch(tv, chr);
}
-void
+static void
leave(dummy)
int dummy;
{
exit(0);
}
-void
+static void
wake(dummy)
int dummy __unused;
{
process(lastch);
}
-int
+static int
rnd(range)
int range;
{
return abs((rand()>>5)+(rand()>>5)) % range;
}
-void
+static void
newpos(bp)
struct body * bp;
{
} while(winch(tv) != ' ');
}
-void
+static void
prize()
{
int value;
wrefresh(tv);
}
-void
+static void
process(ch)
int ch;
{
alarm(1);
}
-void
+static void
crash()
{
leave(0);
}
-void
+static void
setup()
{
clear();
-/* $NetBSD: worms.c,v 1.19 2008/08/08 16:10:47 drochner Exp $ */
+/* $NetBSD: worms.c,v 1.20 2009/08/12 08:57:30 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
#if 0
static char sccsid[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: worms.c,v 1.19 2008/08/08 16:10:47 drochner Exp $");
+__RCSID("$NetBSD: worms.c,v 1.20 2009/08/12 08:57:30 dholland Exp $");
#endif
#endif /* not lint */
short *xpos, *ypos;
} *worm;
-volatile sig_atomic_t sig_caught = 0;
+static volatile sig_atomic_t sig_caught = 0;
int main(int, char **);
-void nomem(void) __dead;
-void onsig(int);
+static void nomem(void) __dead;
+static void onsig(int);
int
main(argc, argv)
}
}
-void
+static void
onsig(signo)
int signo __unused;
{
sig_caught = 1;
}
-void
+static void
nomem()
{
errx(1, "not enough memory.");
-/* $NetBSD: wump.c,v 1.23 2008/07/20 01:03:22 lukem Exp $ */
+/* $NetBSD: wump.c,v 1.24 2009/08/12 09:00:10 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: wump.c,v 1.23 2008/07/20 01:03:22 lukem Exp $");
+__RCSID("$NetBSD: wump.c,v 1.24 2009/08/12 09:00:10 dholland Exp $");
#endif
#endif /* not lint */
#define plural(n) (n == 1 ? "" : "s")
/* simple cave data structure; +1 so we can index from '1' not '0' */
-struct room_record {
+static struct room_record {
int tunnel[MAX_LINKS_IN_ROOM];
int has_a_pit, has_a_bat;
} cave[MAX_ROOMS_IN_CAVE+1];
* global variables so we can keep track of where the player is, how
* many arrows they still have, where el wumpo is, and so on...
*/
-int player_loc = -1; /* player location */
-int wumpus_loc = -1; /* The Bad Guy location */
-int level = EASY; /* level of play */
-int arrows_left; /* arrows unshot */
+static int player_loc = -1; /* player location */
+static int wumpus_loc = -1; /* The Bad Guy location */
+static int level = EASY; /* level of play */
+static int arrows_left; /* arrows unshot */
#ifdef DEBUG
-int debug = 0;
+static int debug = 0;
#endif
-int pit_num = PIT_COUNT; /* # pits in cave */
-int bat_num = BAT_COUNT; /* # bats */
-int room_num = ROOMS_IN_CAVE; /* # rooms in cave */
-int link_num = LINKS_IN_ROOM; /* links per room */
-int arrow_num = NUMBER_OF_ARROWS; /* arrow inventory */
-
-char answer[20]; /* user input */
-
-int bats_nearby(void);
-void cave_init(void);
-void clear_things_in_cave(void);
-void display_room_stats(void);
-int gcd(int, int);
-int getans(const char *);
-void initialize_things_in_cave(void);
-void instructions(void);
-int int_compare(const void *, const void *);
-void jump(int);
-void kill_wump(void);
+static int pit_num = PIT_COUNT; /* # pits in cave */
+static int bat_num = BAT_COUNT; /* # bats */
+static int room_num = ROOMS_IN_CAVE; /* # rooms in cave */
+static int link_num = LINKS_IN_ROOM; /* links per room */
+static int arrow_num = NUMBER_OF_ARROWS;/* arrow inventory */
+
+static char answer[20]; /* user input */
+
int main(int, char **);
-int move_to(const char *);
-void move_wump(void);
-void no_arrows(void);
-void pit_kill(void);
-int pit_nearby(void);
-void pit_survive(void);
-int shoot(char *);
-void shoot_self(void);
-int take_action(void);
-void usage(void) __dead;
-void wump_kill(void);
-int wump_nearby(void);
+static int bats_nearby(void);
+static void cave_init(void);
+static void clear_things_in_cave(void);
+static void display_room_stats(void);
+static int gcd(int, int);
+static int getans(const char *);
+static void initialize_things_in_cave(void);
+static void instructions(void);
+static int int_compare(const void *, const void *);
+static void jump(int);
+static void kill_wump(void);
+static int move_to(const char *);
+static void move_wump(void);
+static void no_arrows(void);
+static void pit_kill(void);
+static int pit_nearby(void);
+static void pit_survive(void);
+static int shoot(char *);
+static void shoot_self(void);
+static int take_action(void);
+static void usage(void) __dead;
+static void wump_kill(void);
+static int wump_nearby(void);
int
main(argc, argv)
return (0);
}
-void
+static void
display_room_stats()
{
int i;
(void)printf("and %d.\n", cave[player_loc].tunnel[link_num - 1]);
}
-int
+static int
take_action()
{
/*
return(0);
}
-int
+static int
move_to(room_number)
const char *room_number;
{
return(0);
}
-int
+static int
shoot(room_list)
char *room_list;
{
return(0);
}
-int
+static int
gcd(a, b)
int a, b;
{
return (gcd(b, r));
}
-void
+static void
cave_init()
{
int i, j, k, lnk;
#endif
}
-void
+static void
clear_things_in_cave()
{
int i;
cave[i].has_a_bat = cave[i].has_a_pit = 0;
}
-void
+static void
initialize_things_in_cave()
{
int i, loc;
(i > 100 && player_loc != wumpus_loc));
}
-int
+static int
getans(prompt)
const char *prompt;
{
/* NOTREACHED */
}
-int
+static int
bats_nearby()
{
int i;
return(0);
}
-int
+static int
pit_nearby()
{
int i;
return(0);
}
-int
+static int
wump_nearby()
{
int i, j;
return(0);
}
-void
+static void
move_wump()
{
wumpus_loc = cave[wumpus_loc].tunnel[random() % link_num];
}
-int
+static int
int_compare(a, b)
const void *a, *b;
{
return(*(const int *)a < *(const int *)b ? -1 : 1);
}
-void
+static void
instructions()
{
const char *pager;
}
}
-void
+static void
usage()
{
(void)fprintf(stderr,
/* messages */
-void
+static void
wump_kill()
{
(void)printf(
passed out from the stench!\n");
}
-void
+static void
kill_wump()
{
(void)printf(
mightiest adventurer at a single whiff!!\n");
}
-void
+static void
no_arrows()
{
(void)printf(
you, and with a mighty *ROAR* eats you alive!\n");
}
-void
+static void
shoot_self()
{
(void)printf(
(*CHOMP*)\n");
}
-void
+static void
jump(where)
int where;
{
a very curious, warm sensation and find yourself in room %d!!\n", where);
}
-void
+static void
pit_kill()
{
(void)printf(
you can at least find out if Jules Verne was right...\n");
}
-void
+static void
pit_survive()
{
(void)printf(