summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-08-24 21:55:01 +0000
committerderaadt <deraadt@openbsd.org>1997-08-24 21:55:01 +0000
commit49d23a04d4fdfd5d10f7510ee0b6319dad705acf (patch)
tree62472285afe2c37745b920d5e5d677bfe2f11fee
parentprototype _err* and _warn* (diff)
downloadwireguard-openbsd-49d23a04d4fdfd5d10f7510ee0b6319dad705acf.tar.xz
wireguard-openbsd-49d23a04d4fdfd5d10f7510ee0b6319dad705acf.zip
various linux-based patches; from linux people; sent by jsm@octomino.demon.co.uk
-rw-r--r--games/battlestar/battlestar.c9
-rw-r--r--games/battlestar/com1.c41
-rw-r--r--games/battlestar/com2.c24
-rw-r--r--games/battlestar/com3.c18
-rw-r--r--games/battlestar/com4.c26
-rw-r--r--games/battlestar/com5.c36
-rw-r--r--games/battlestar/com6.c29
-rw-r--r--games/battlestar/com7.c17
-rw-r--r--games/battlestar/cypher.c26
-rw-r--r--games/battlestar/dayfile.c10
-rw-r--r--games/battlestar/dayobjs.c4
-rw-r--r--games/battlestar/extern.h (renamed from games/battlestar/externs.h)98
-rw-r--r--games/battlestar/fly.c30
-rw-r--r--games/battlestar/getcom.c5
-rw-r--r--games/battlestar/globals.c4
-rw-r--r--games/battlestar/init.c18
-rw-r--r--games/battlestar/misc.c6
-rw-r--r--games/battlestar/nightfile.c10
-rw-r--r--games/battlestar/nightobjs.c4
-rw-r--r--games/battlestar/parse.c12
-rw-r--r--games/battlestar/room.c8
-rw-r--r--games/battlestar/save.c20
-rw-r--r--games/battlestar/words.c4
23 files changed, 300 insertions, 159 deletions
diff --git a/games/battlestar/battlestar.c b/games/battlestar/battlestar.c
index 0d4b3314b1c..c371997092b 100644
--- a/games/battlestar/battlestar.c
+++ b/games/battlestar/battlestar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: battlestar.c,v 1.4 1997/06/30 19:56:28 kstailey Exp $ */
+/* $OpenBSD: battlestar.c,v 1.5 1997/08/24 21:55:01 deraadt Exp $ */
/* $NetBSD: battlestar.c,v 1.3 1995/03/21 15:06:47 cgd Exp $ */
/*
@@ -55,8 +55,11 @@ static char rcsid[] = "$NetBSD: battlestar.c,v 1.3 1995/03/21 15:06:47 cgd Exp $
* on the Cory PDP-11/70, University of California, Berkeley.
*/
-#include "externs.h"
+#include "extern.h"
+int main __P((int, char **));
+
+int
main(argc,argv)
int argc;
char **argv;
@@ -99,6 +102,6 @@ run:
case 0:
goto start;
default:
- exit();
+ exit(1);
}
}
diff --git a/games/battlestar/com1.c b/games/battlestar/com1.c
index 038a649e499..31e6b6297f2 100644
--- a/games/battlestar/com1.c
+++ b/games/battlestar/com1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com1.c,v 1.2 1997/06/30 19:56:29 kstailey Exp $ */
+/* $OpenBSD: com1.c,v 1.3 1997/08/24 21:55:01 deraadt Exp $ */
/* $NetBSD: com1.c,v 1.3 1995/03/21 15:06:51 cgd Exp $ */
/*
@@ -42,8 +42,12 @@ static char rcsid[] = "$NetBSD: com1.c,v 1.3 1995/03/21 15:06:51 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include <unistd.h>
+#include "extern.h"
+void convert __P((int));
+
+int
move(thataway, token)
int thataway, token;
{
@@ -52,7 +56,7 @@ int thataway, token;
if (thataway) {
position = thataway;
newway(token);
- time++;
+ btime++;
}
else {
puts("You can't go this way.");
@@ -67,11 +71,12 @@ int thataway, token;
return(1);
}
+void
convert(tothis) /* Converts day to night and vice versa. */
int tothis; /* Day objects are permanent. Night objects are added*/
{ /* at dusk, and subtracted at dawn. */
register struct objs *p;
- register i, j;
+ register unsigned int i, j;
if (tothis == TONIGHT) {
for (i = 1; i <= NUMOFROOMS; i++)
@@ -90,29 +95,30 @@ int tothis; /* Day objects are permanent. Night objects are added*/
}
}
+void
news()
{
register int n;
int hurt;
- if (time > 30 && position < 32){
+ if (btime > 30 && position < 32){
puts("An explosion of shuddering magnitude splinters bulkheads and");
puts("ruptures the battlestar's hull. You are sucked out into the");
puts("frozen void of space and killed.");
die();
}
- if (time > 20 && position < 32)
+ if (btime > 20 && position < 32)
puts("Explosions rock the battlestar.");
- if (time > snooze){
+ if (btime > snooze){
puts("You drop from exhaustion...");
zzz();
}
- if (time > snooze - 5)
+ if (btime > snooze - 5)
puts("You're getting tired.");
- if (time > (rythmn + CYCLE)) {
+ if (btime > (rythmn + CYCLE)) {
if (location == nightfile) {
convert(TODAY);
- if (OUTSIDE && time - rythmn - CYCLE < 10) {
+ if (OUTSIDE && btime - rythmn - CYCLE < 10) {
puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
puts("You awake from a misty dream-world into stark reality.");
puts("It is day.");
@@ -120,14 +126,14 @@ news()
} else {
convert(TONIGHT);
clearbit(location[POOLS].objects, BATHGOD);
- if (OUTSIDE && time - rythmn - CYCLE < 10) {
+ if (OUTSIDE && btime - rythmn - CYCLE < 10) {
puts("The dying sun sinks into the ocean, leaving a blood stained sunset.");
puts("The sky slowly fades from orange to violet to black. A few stars");
puts("flicker on, and it is night.");
puts("The world seems completly different at night.");
}
}
- rythmn = time - time % CYCLE;
+ rythmn = btime - btime % CYCLE;
}
if (!wiz && !tempwiz)
if ((testbit(inven,TALISMAN) || testbit(wear,TALISMAN)) && (testbit(inven,MEDALION) || testbit(wear,MEDALION)) && (testbit(inven,AMULET) || testbit(wear,AMULET))){
@@ -164,16 +170,16 @@ news()
}
if (testbit(location[position].objects, GIRL))
meetgirl = 1;
- if (meetgirl && CYCLE * 1.5 - time < 10){
+ if (meetgirl && CYCLE * 1.5 - btime < 10){
setbit(location[GARDEN].objects,GIRLTALK);
setbit(location[GARDEN].objects,LAMPON);
setbit(location[GARDEN].objects,ROPE);
}
- if (position == DOCK && (beenthere[position] || time > CYCLE)){
+ if (position == DOCK && (beenthere[position] || btime > CYCLE)){
clearbit(location[DOCK].objects, GIRL);
clearbit(location[DOCK].objects,MAN);
}
- if (meetgirl && time - CYCLE * 1.5 > 10){
+ if (meetgirl && btime - CYCLE * 1.5 > 10){
clearbit(location[GARDEN].objects,GIRLTALK);
clearbit(location[GARDEN].objects,LAMPON);
clearbit(location[GARDEN].objects,ROPE);
@@ -181,7 +187,7 @@ news()
}
if (testbit(location[position].objects,CYLON)){
puts("Oh my God, you're being shot at by an alien spacecraft!");
- printf("The targeting computer says we have %d seconds to attack!\n",clock);
+ printf("The targeting computer says we have %d seconds to attack!\n",bclock);
fflush(stdout);
sleep(1);
if (!visual()){
@@ -224,6 +230,7 @@ news()
notes[CANTMOVE] = 0;
}
+void
crash()
{
int hurt1,hurt2;
@@ -243,7 +250,7 @@ crash()
}
notes[LAUNCHED] = 0;
setbit(location[position].objects,CRASH);
- time += rnd(CYCLE/4);
+ btime += rnd(CYCLE/4);
puts("The viper explodes into the ground and you lose consciousness...");
zzz();
hurt1 = rnd(NUMOFINJURIES - 2) + 2;
diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c
index 2c99b0e1137..b1a17647e6f 100644
--- a/games/battlestar/com2.c
+++ b/games/battlestar/com2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com2.c,v 1.2 1997/06/30 19:56:29 kstailey Exp $ */
+/* $OpenBSD: com2.c,v 1.3 1997/08/24 21:55:02 deraadt Exp $ */
/* $NetBSD: com2.c,v 1.3 1995/03/21 15:06:55 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: com2.c,v 1.3 1995/03/21 15:06:55 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int
wearit() /* synonyms = {sheathe, sheath} */
{
register int n;
@@ -88,7 +89,7 @@ wearit() /* synonyms = {sheathe, sheath} */
setbit(wear,value);
carrying -= objwt[value];
encumber -= objcumber[value];
- time++;
+ btime++;
printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]);
}
else if (testbit(wear,value))
@@ -105,6 +106,7 @@ wearit() /* synonyms = {sheathe, sheath} */
return(firstnumber);
}
+int
put() /* synonyms = {buckle, strap, tie} */
{
if (wordvalue[wordnumber + 1] == ON){
@@ -120,11 +122,13 @@ put() /* synonyms = {buckle, strap, tie} */
}
+int
draw() /* synonyms = {pull, carry} */
{
return(take(wear));
}
+int
use()
{
while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount);
@@ -136,7 +140,7 @@ use()
location[position].down = 160;
whichway(location[position]);
puts("The waves subside and it is possible to descend to the sea cave now.");
- time++;
+ btime++;
return(-1);
}
}
@@ -146,7 +150,8 @@ use()
position = 224;
else
position = 229;
- time++;
+ btime++;
+ notes[CANTSEE] = 0;
return(0);
}
else if (position == FINAL)
@@ -162,6 +167,7 @@ use()
return(-1);
}
+void
murder()
{
register int n;
@@ -228,11 +234,12 @@ murder()
}
}
+void
ravage()
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){
- time++;
+ btime++;
switch(wordvalue[wordnumber]){
case NORMGOD:
puts("You attack the goddess, and she screams as you beat her. She falls down");
@@ -277,9 +284,10 @@ ravage()
puts("Who?");
}
+int
follow()
{
- if (followfight == time){
+ if (followfight == btime){
puts("The Dark Lord leaps away and runs down secret tunnels and corridoors.");
puts("You chase him through the darkness and splash in pools of water.");
puts("You have cornered him. His laser sword extends as he steps forward.");
@@ -289,7 +297,7 @@ follow()
setbit(location[position].objects,AMULET);
return(0);
}
- else if (followgod == time){
+ else if (followgod == btime){
puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
puts("She sits down on a throne.");
position = 268;
diff --git a/games/battlestar/com3.c b/games/battlestar/com3.c
index d5507e48cfe..a1f81184406 100644
--- a/games/battlestar/com3.c
+++ b/games/battlestar/com3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com3.c,v 1.2 1997/06/30 19:56:30 kstailey Exp $ */
+/* $OpenBSD: com3.c,v 1.3 1997/08/24 21:55:02 deraadt Exp $ */
/* $NetBSD: com3.c,v 1.3 1995/03/21 15:07:00 cgd Exp $ */
/*
@@ -42,13 +42,14 @@ static char rcsid[] = "$NetBSD: com3.c,v 1.3 1995/03/21 15:07:00 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+void
dig()
{
if (testbit(inven,SHOVEL)){
puts("OK");
- time++;
+ btime++;
switch(position){
case 144: /* copse near beach */
if (!notes[DUG]){
@@ -68,6 +69,7 @@ dig()
puts("You don't have a shovel.");
}
+int
jump()
{
register int n;
@@ -107,6 +109,7 @@ jump()
return(0);
}
+void
bury()
{
int value;
@@ -170,6 +173,7 @@ bury()
puts("You aren't holding a shovel.");
}
+void
drink()
{
register int n;
@@ -183,18 +187,20 @@ drink()
CUMBER = MAXCUMBER;
for (n=0; n < NUMOFINJURIES; n++)
injuries[n] = 0;
- time++;
+ btime++;
zzz();
}
else
puts("I'm not thirsty.");
}
+int
shoot()
{
int firstnumber, value;
register int n;
+ firstnumber = wordcount + 2;
if (!testbit(inven,LASER))
puts("You aren't holding a blaster.");
else {
@@ -206,7 +212,7 @@ shoot()
for (n=0; objsht[value][n]; n++);
if (testbit(location[position].objects,value)){
clearbit(location[position].objects,value);
- time++;
+ btime++;
printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s."));
if (value == BOMB)
die();
@@ -221,7 +227,7 @@ shoot()
/* special cases with their own return()'s */
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS){
- time++;
+ btime++;
switch(wordvalue[wordnumber]){
case DOOR:
diff --git a/games/battlestar/com4.c b/games/battlestar/com4.c
index c63d095e7ac..3018582ba15 100644
--- a/games/battlestar/com4.c
+++ b/games/battlestar/com4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com4.c,v 1.2 1997/06/30 19:56:31 kstailey Exp $ */
+/* $OpenBSD: com4.c,v 1.3 1997/08/24 21:55:03 deraadt Exp $ */
/* $NetBSD: com4.c,v 1.3 1995/03/21 15:07:04 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: com4.c,v 1.3 1995/03/21 15:07:04 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int
take(from)
unsigned int from[];
{
@@ -68,7 +69,7 @@ unsigned int from[];
setbit(inven,value);
carrying += objwt[value];
encumber += objcumber[value];
- time++;
+ btime++;
if (testbit(from,value))
printf("Taken.\n");
else
@@ -172,7 +173,7 @@ unsigned int from[];
puts("ties it at the waist. Around her neck hangs a golden amulet.");
puts("She bids you to follow her.");
pleasure++;
- followgod = time;
+ followgod = btime;
clearbit(location[position].objects,BATHGOD);
} else if (!testbit(location[position].objects,BATHGOD))
puts("You're in no position to take her.");
@@ -188,10 +189,11 @@ unsigned int from[];
return(firstnumber);
}
+int
throw(name)
char *name;
{
- int n;
+ unsigned int n;
int deposit = 0;
int first, value;
@@ -268,6 +270,7 @@ throw(name)
return(first);
}
+int
drop(name)
char *name;
{
@@ -292,7 +295,7 @@ char *name;
setbit(location[position].objects,value);
else
tempwiz = 0;
- time++;
+ btime++;
if (*name == 'K')
puts("Drop kicked.");
else
@@ -319,18 +322,21 @@ char *name;
return(-1);
}
+int
takeoff()
{
wordnumber = take(wear);
return(drop("Dropped"));
}
+int
puton()
{
wordnumber = take(location[position].objects);
return(wearit());
}
+int
eat()
{
int firstnumber, value;
@@ -361,16 +367,16 @@ eat()
case MANGO:
printf("%s:\n",objsht[value]);
- if (testbit(inven,value) && time > ate - CYCLE && testbit(inven,KNIFE)){
+ if (testbit(inven,value) && btime > ate - CYCLE && testbit(inven,KNIFE)){
clearbit(inven,value);
carrying -= objwt[value];
encumber -= objcumber[value];
- ate = max(time,ate) + CYCLE/3;
+ ate = max(btime,ate) + CYCLE/3;
snooze += CYCLE/10;
- time++;
+ btime++;
puts("Eaten. You can explore a little longer now.");
}
- else if (time < ate - CYCLE)
+ else if (btime < ate - CYCLE)
puts("You're stuffed.");
else if (!testbit(inven,KNIFE))
puts("You need a knife.");
diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c
index 8dec4506f25..fc9b01bec47 100644
--- a/games/battlestar/com5.c
+++ b/games/battlestar/com5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com5.c,v 1.2 1997/06/30 19:56:31 kstailey Exp $ */
+/* $OpenBSD: com5.c,v 1.3 1997/08/24 21:55:03 deraadt Exp $ */
/* $NetBSD: com5.c,v 1.3 1995/03/21 15:07:07 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: com5.c,v 1.3 1995/03/21 15:07:07 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+void
kiss()
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
@@ -83,6 +84,7 @@ kiss()
else puts("I'd prefer not to.");
}
+void
love()
{
register int n;
@@ -107,7 +109,7 @@ love()
if (!loved)
setbit(location[position].objects,MEDALION);
loved = 1;
- time += 10;
+ btime += 10;
zzz();
}
else {
@@ -119,7 +121,7 @@ love()
power++;
pleasure += 5;
printf("Girl:\n");
- time += 10;
+ btime += 10;
zzz();
}
printf("Loved.\n");
@@ -127,21 +129,22 @@ love()
else puts("I't doesn't seem to work.");
}
+int
zzz()
{
int oldtime;
register int n;
- oldtime = time;
- if ((snooze - time) < (0.75 * CYCLE)){
- time += 0.75 * CYCLE - (snooze - time);
+ oldtime = btime;
+ if ((snooze - btime) < (0.75 * CYCLE)){
+ btime += 0.75 * CYCLE - (snooze - btime);
printf("<zzz>");
- for (n = 0; n < time - oldtime; n++)
+ for (n = 0; n < btime - oldtime; n++)
printf(".");
printf("\n");
- snooze += 3 * (time - oldtime);
+ snooze += 3 * (btime - oldtime);
if (notes[LAUNCHED]){
- fuel -= (time - oldtime);
+ fuel -= (btime - oldtime);
if (location[position].down){
position = location[position].down;
crash();
@@ -182,10 +185,11 @@ zzz()
return(1);
}
+void
chime()
{
- if ((time / CYCLE + 1) % 2 && OUTSIDE)
- switch((time % CYCLE)/(CYCLE / 7)){
+ if ((btime / CYCLE + 1) % 2 && OUTSIDE)
+ switch((btime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunrise.");
break;
@@ -209,7 +213,7 @@ chime()
break;
}
else if (OUTSIDE)
- switch((time % CYCLE)/(CYCLE / 7)){
+ switch((btime % CYCLE)/(CYCLE / 7)){
case 0:
puts("It is just after sunset.");
break;
@@ -236,10 +240,12 @@ chime()
puts("I can't tell the time in here.");
}
+int
give()
{
int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
+ last1 = last2 = wordcount + 2;
firstnumber = wordnumber;
while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
if (wordnumber <= wordcount){
@@ -266,7 +272,7 @@ give()
}
if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){
clearbit(location[position].objects,obj);
- time++;
+ btime++;
ego++;
switch(person){
case NATIVE:
@@ -295,7 +301,7 @@ give()
puts("after having been out drinking with the girls, she kicks the throne particulary");
puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
clearbit(location[position].objects,MEDALION);
- wintime = time;
+ wintime = btime;
}
}
break;
diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c
index c3a1d588e24..49f5d40dff0 100644
--- a/games/battlestar/com6.c
+++ b/games/battlestar/com6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com6.c,v 1.4 1997/06/30 19:56:32 kstailey Exp $ */
+/* $OpenBSD: com6.c,v 1.5 1997/08/24 21:55:04 deraadt Exp $ */
/* $NetBSD: com6.c,v 1.5 1995/04/27 21:30:23 mycroft Exp $ */
/*
@@ -42,9 +42,11 @@ static char rcsid[] = "$NetBSD: com6.c,v 1.5 1995/04/27 21:30:23 mycroft Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include <time.h>
+#include "extern.h"
#include "pathnames.h"
+int
launch()
{
if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){
@@ -52,7 +54,7 @@ launch()
clearbit(location[position].objects,VIPER);
position = location[position].up;
notes[LAUNCHED] = 1;
- time++;
+ btime++;
fuel -= 4;
puts("You climb into the viper and prepare for launch.");
puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
@@ -66,6 +68,7 @@ launch()
return(0);
}
+int
land()
{
if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){
@@ -73,7 +76,7 @@ land()
position = location[position].down;
setbit(location[position].objects,VIPER);
fuel -= 2;
- time++;
+ btime++;
puts("You are down.");
return(1);
}
@@ -82,6 +85,7 @@ land()
return(0);
}
+void
die() /* endgame */
{
printf("bye.\nYour rating was %s.\n", rate());
@@ -89,6 +93,7 @@ die() /* endgame */
exit(0);
}
+void
live()
{
puts("\nYou win!");
@@ -104,18 +109,19 @@ open_score_file()
perror(_PATH_SCORE);
}
+void
post(ch)
char ch;
{
- struct timeval tv;
- char *date, *ctime();
+ time_t tv;
+ char *date;
sigset_t sigset, osigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGINT);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
- gettimeofday(&tv, (struct timezone *)0); /* can't call time */
- date = ctime(&tv.tv_sec);
+ tv = time(NULL);
+ date = ctime(&tv);
date[24] = '\0';
fprintf(score_fp, "%s %8s %c%20s", date, uname, ch, rate());
@@ -166,6 +172,7 @@ rate()
}
}
+int
drive()
{
if (testbit(location[position].objects,CAR)){
@@ -174,7 +181,7 @@ drive()
clearbit(location[position].objects,CAR);
setbit(location[position].objects,CRASH);
injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1;
- time += 15;
+ btime += 15;
zzz();
return(0);
}
@@ -183,6 +190,7 @@ drive()
return(-1);
}
+int
ride()
{
if (testbit(location[position].objects,HORSE)){
@@ -205,11 +213,12 @@ ride()
return(-1);
}
+void
light() /* synonyms = {strike, smoke} */
{ /* for matches, cigars */
if (testbit(inven,MATCHES) && matchcount){
puts("Your match splutters to life.");
- time++;
+ btime++;
matchlight = 1;
matchcount--;
if (position == 217){
diff --git a/games/battlestar/com7.c b/games/battlestar/com7.c
index 96e4369487f..74d5c1b91e8 100644
--- a/games/battlestar/com7.c
+++ b/games/battlestar/com7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com7.c,v 1.2 1997/06/30 19:56:32 kstailey Exp $ */
+/* $OpenBSD: com7.c,v 1.3 1997/08/24 21:55:04 deraadt Exp $ */
/* $NetBSD: com7.c,v 1.3 1995/03/21 15:07:12 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: com7.c,v 1.3 1995/03/21 15:07:12 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int
fight(enemy,strength)
int enemy,strength;
{
@@ -55,15 +56,15 @@ int enemy,strength;
int exhaustion;
fighton:
- time++;
+ btime++;
snooze -= 5;
- if (snooze > time)
- exhaustion = CYCLE/(snooze - time);
+ if (snooze > btime)
+ exhaustion = CYCLE/(snooze - btime);
else {
puts("You collapse exhausted, and he pulverizes your skull.");
die();
}
- if (snooze - time < 20)
+ if (snooze - btime < 20)
puts("You look tired! I hope you're able to fight.");
next = getcom(auxbuf, LINELENGTH, "<fight!>-: ", 0);
for (i=0; next && i < 10; i++)
@@ -193,7 +194,7 @@ fighton:
puts("he flees down the dark caverns.");
clearbit(location[position].objects,DARK);
injuries[SKULL] = 1;
- followfight = time;
+ followfight = btime;
return (0);
}
else{
@@ -238,7 +239,7 @@ fighton:
case DROP:
case DRAW:
cypher();
- time--;
+ btime--;
break;
default:
diff --git a/games/battlestar/cypher.c b/games/battlestar/cypher.c
index 53716c93728..f3c78fe324e 100644
--- a/games/battlestar/cypher.c
+++ b/games/battlestar/cypher.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cypher.c,v 1.2 1997/06/30 19:56:33 kstailey Exp $ */
+/* $OpenBSD: cypher.c,v 1.3 1997/08/24 21:55:05 deraadt Exp $ */
/* $NetBSD: cypher.c,v 1.3 1995/03/21 15:07:15 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: cypher.c,v 1.3 1995/03/21 15:07:15 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int
cypher()
{
register int n;
@@ -102,7 +103,7 @@ cypher()
case SHOOT:
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && *objsht[n]){
+ if (testbit(location[position].objects,n) && objsht[n]){
wordvalue[wordnumber+1] = n;
wordnumber = shoot();
}
@@ -116,8 +117,11 @@ cypher()
case TAKE:
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && *objsht[n]){
+ if (testbit(location[position].objects,n) && objsht[n]){
wordvalue[wordnumber+1] = n;
+ wordtype[wordnumber+1] = OBJECT;
+ if ((n == AMULET) || (n == MEDALION) || (n == TALISMAN) || (n == MAN) || (n == TIMER) || (n == NATIVE))
+ wordtype[wordnumber+1] = NOUNS;
wordnumber = take(location[position].objects);
}
wordnumber++;
@@ -148,7 +152,7 @@ cypher()
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
for (n=0; n < NUMOFOBJECTS; n++)
if (testbit(inven,n) ||
- testbit(location[position].objects, n) && *objsht[n]){
+ testbit(location[position].objects, n) && objsht[n]){
wordvalue[wordnumber+1] = n;
wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
}
@@ -190,7 +194,7 @@ cypher()
if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){
for (n=0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects,n) && *objsht[n]){
+ if (testbit(location[position].objects,n) && objsht[n]){
wordvalue[wordnumber+1] = n;
wordnumber = puton();
}
@@ -290,10 +294,10 @@ cypher()
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d", &position);
- printf("Time (was %d) = ",time);
+ printf("Time (was %d) = ",btime);
fgets(buffer,10,stdin);
if (*buffer != '\n')
- sscanf(buffer,"%d", &time);
+ sscanf(buffer,"%d", &btime);
printf("Fuel (was %d) = ",fuel);
fgets(buffer,10,stdin);
if (*buffer != '\n')
@@ -310,10 +314,10 @@ cypher()
fgets(buffer,10,stdin);
if (*buffer != '\n')
sscanf(buffer,"%d",&WEIGHT);
- printf("Clock (was %d) = ",clock);
+ printf("Clock (was %d) = ",bclock);
fgets(buffer,10,stdin);
if (*buffer != '\n')
- sscanf(buffer,"%d",&clock);
+ sscanf(buffer,"%d",&bclock);
printf("Wizard (was %d, %d) = ",wiz, tempwiz);
fgets(buffer,10,stdin);
if (*buffer != '\n'){
@@ -331,7 +335,7 @@ cypher()
case SCORE:
printf("\tPLEASURE\tPOWER\t\tEGO\n");
printf("\t%3d\t\t%3d\t\t%3d\n\n",pleasure,power,ego);
- printf("This gives you the rating of %s in %d turns.\n",rate(),time);
+ printf("This gives you the rating of %s in %d turns.\n",rate(),btime);
printf("You have visited %d out of %d rooms this run (%d%%).\n",card(beenthere,NUMOFROOMS),NUMOFROOMS,card(beenthere,NUMOFROOMS)*100/NUMOFROOMS);
break;
diff --git a/games/battlestar/dayfile.c b/games/battlestar/dayfile.c
index 07be532b51d..06a0021a4a5 100644
--- a/games/battlestar/dayfile.c
+++ b/games/battlestar/dayfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dayfile.c,v 1.2 1997/06/30 19:56:34 kstailey Exp $ */
+/* $OpenBSD: dayfile.c,v 1.3 1997/08/24 21:55:06 deraadt Exp $ */
/* $NetBSD: dayfile.c,v 1.3 1995/03/21 15:07:18 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: dayfile.c,v 1.3 1995/03/21 15:07:18 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
struct room dayfile[] = {
{ 0 },
@@ -187,7 +187,7 @@ face downward on the carpet clutching his chest.*\n\
The hallway leads -.**\n" },
{ "You are in the dining hall.",
0, 30, 31, 23, 0, 0, 0, 0,
-"This was the seen of a mass suicide. Hundreds of ambassadors and assorted\n\
+"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\
dignitaries sit slumped over their breakfast cereal. I suppose the news\n\
of the cylon attack killed them. There is a strange chill in this room. I\n\
would not linger here. * The kitchen is +. Entrances + and +.\n" },
@@ -452,7 +452,7 @@ outcroppings of lava to land. There is a nicer beach ***+.\n" },
{ "You are lost in a sea of fog.",
97, 104, 97, 97, 97, 1, 0, 1,
"What have you gotten us into?\n\
-I cant see a thing! ****\n" },
+I can't see a thing! ****\n" },
{ "You are on a gravel wash.",
125, 126, 127, 128, 84, 0, 0, 0,
"The sound of cascading water is the background for a diluted chorus of \n\
@@ -537,7 +537,7 @@ impossible to climb down to a small cave entrance below. Only at rare\n\
minus tides would it be possible to enter.*** The beach is better +.\n" },
{ "You are on the coast road.",
158, 161, 162, 91, 79, 0, 0, 0,
-"The road is beginning to turn inland.* I can here the surf +. The road\n\
+"The road is beginning to turn inland.* I can hear the surf +. The road\n\
continues +.*\n" },
{ "The road winds deeper into the trees.",
163, 142, 91, 164, 79, 0, 0, 0,
diff --git a/games/battlestar/dayobjs.c b/games/battlestar/dayobjs.c
index 489c16a1203..9ee3c58e465 100644
--- a/games/battlestar/dayobjs.c
+++ b/games/battlestar/dayobjs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dayobjs.c,v 1.2 1997/06/30 19:56:34 kstailey Exp $ */
+/* $OpenBSD: dayobjs.c,v 1.3 1997/08/24 21:55:06 deraadt Exp $ */
/* $NetBSD: dayobjs.c,v 1.3 1995/03/21 15:07:22 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: dayobjs.c,v 1.3 1995/03/21 15:07:22 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
struct objs dayobjs[] = {
{ 236, HORSE },
diff --git a/games/battlestar/externs.h b/games/battlestar/extern.h
index bd2ed985170..783727d3ef8 100644
--- a/games/battlestar/externs.h
+++ b/games/battlestar/extern.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: externs.h,v 1.5 1997/06/30 19:56:35 kstailey Exp $ */
-/* $NetBSD: externs.h,v 1.5 1995/04/24 12:22:18 cgd Exp $ */
+/* $OpenBSD: extern.h,v 1.1 1997/08/24 21:55:07 deraadt Exp $ */
+/* $NetBSD: extern.h,v 1.5 1995/04/24 12:22:18 cgd Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)externs.h 8.1 (Berkeley) 5/31/93
+ * @(#)extern.h 8.1 (Berkeley) 5/31/93
*/
/*
@@ -48,6 +48,7 @@
#include <signal.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#define BITS (8 * sizeof (int))
@@ -239,16 +240,16 @@ struct room {
char *desc;
unsigned int objects[NUMOFWORDS];
};
-struct room dayfile[];
-struct room nightfile[];
+extern struct room dayfile[];
+extern struct room nightfile[];
struct room *location;
/* object characteristics */
-char *objdes[NUMOFOBJECTS];
-char *objsht[NUMOFOBJECTS];
-char *ouch[NUMOFINJURIES];
-int objwt[NUMOFOBJECTS];
-int objcumber[NUMOFOBJECTS];
+extern char *objdes[NUMOFOBJECTS];
+extern char *objsht[NUMOFOBJECTS];
+extern char *ouch[NUMOFINJURIES];
+extern int objwt[NUMOFOBJECTS];
+extern int objcumber[NUMOFOBJECTS];
/* current input line */
#define NWORD 20 /* words per line */
@@ -257,32 +258,83 @@ int wordvalue[NWORD];
int wordtype[NWORD];
int wordcount, wordnumber;
-char *truedirec(), *rate();
-char *getcom(), *getword();
+void bury __P((void));
+int card __P((char *, int));
+void chime __P((void));
+void crash __P((void));
+int cypher __P((void));
+void die __P((void));
+void dig __P((void));
+int draw __P((void));
+void drink __P((void));
+int drive __P((void));
+int drop __P((char *));
+int eat __P((void));
+int fight __P((int, int));
+int follow __P((void));
+char *getcom __P((char *, int, char *, char *));
+char *getword __P((char *, char *, int));
+int give __P((void));
+void initialize __P((char));
+int jump __P((void));
+void kiss __P((void));
+int land __P((void));
+int launch __P((void));
+void light __P((void));
+void live __P((void));
+void love __P((void));
+int move __P((int, int));
+void murder __P((void));
+void news __P((void));
+void newway __P((int));
+void parse __P((void));
+void post __P((char));
+void printobjs __P((void));
+int put __P((void));
+int puton __P((void));
+char *rate __P((void));
+void ravage __P((void));
+void restore __P((void));
+int ride __P((void));
+void save __P((void));
+int shoot __P((void));
+int take __P((unsigned int[]));
+int takeoff __P((void));
+int throw __P((char *));
+char *truedirec __P((int, char));
+int ucard __P((unsigned int *));
+int use __P((void));
+int visual __P((void));
+int wearit __P((void));
+void whichway __P((struct room));
+void wordinit __P((void));
+void writedes __P((void));
+int zzz __P((void));
/* state of the game */
-int time;
+int btime;
int position;
int direction;
int left, right, ahead, back;
-int clock, fuel, torps;
+int bclock, fuel, torps;
int carrying, encumber;
int rythmn;
-int followfight;
+extern int followfight;
int ate;
int snooze;
int meetgirl;
-int followgod;
+extern int followgod;
int godready;
-int win;
+extern int win;
int wintime;
int wiz;
int tempwiz;
-int matchlight, matchcount;
+int matchlight;
+extern int matchcount;
int loved;
int pleasure, power, ego;
-int WEIGHT;
-int CUMBER;
+extern int WEIGHT;
+extern int CUMBER;
int notes[NUMOFNOTES];
unsigned int inven[NUMOFWORDS];
unsigned int wear[NUMOFWORDS];
@@ -300,13 +352,13 @@ struct wlist {
#define HASHMUL 81
#define HASHMASK (HASHSIZE - 1)
struct wlist *hashtab[HASHSIZE];
-struct wlist wlist[];
+extern struct wlist wlist[];
struct objs {
short room;
short obj;
};
-struct objs dayobjs[];
-struct objs nightobjs[];
+extern struct objs dayobjs[];
+extern struct objs nightobjs[];
gid_t egid;
diff --git a/games/battlestar/fly.c b/games/battlestar/fly.c
index f9d72d5507f..323d7572be8 100644
--- a/games/battlestar/fly.c
+++ b/games/battlestar/fly.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fly.c,v 1.3 1997/06/30 19:56:35 kstailey Exp $ */
+/* $OpenBSD: fly.c,v 1.4 1997/08/24 21:55:08 deraadt Exp $ */
/* $NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $ */
/*
@@ -42,7 +42,8 @@ static char rcsid[] = "$NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include <unistd.h>
+#include "extern.h"
#undef UP
#include <curses.h>
@@ -53,10 +54,18 @@ static char rcsid[] = "$NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $";
int row, column;
int dr = 0, dc = 0;
char destroyed;
-int clock = 120; /* time for all the flights in the game */
+int bclock = 120; /* time for all the flights in the game */
char cross = 0;
sig_t oldsig;
+void blast __P((void));
+void endfly __P((void));
+void moveenemy __P((void));
+void notarget __P((void));
+void screen __P((void));
+void succumb __P((void));
+void target __P((void));
+
void
succumb()
{
@@ -70,10 +79,9 @@ succumb()
}
}
+int
visual()
{
- void moveenemy();
-
destroyed = 0;
if(initscr() == NULL){
puts("Whoops! No more memory...");
@@ -173,13 +181,14 @@ visual()
endfly();
return(1);
}
- if (clock <= 0){
+ if (bclock <= 0){
endfly();
die();
}
}
}
+void
screen()
{
register int r,c,n;
@@ -196,6 +205,7 @@ screen()
refresh();
}
+void
target()
{
register int n;
@@ -208,6 +218,7 @@ target()
}
}
+void
notarget()
{
register int n;
@@ -220,6 +231,7 @@ notarget()
}
}
+void
blast()
{
register int n;
@@ -263,7 +275,7 @@ moveenemy()
row += (rnd(9) - 4) % (4 - abs(row - MIDR));
column += (rnd(9) - 4) % (4 - abs(column - MIDC));
}
- clock--;
+ bclock--;
mvaddstr(oldr, oldc - 1, " ");
if (cross)
target();
@@ -273,18 +285,20 @@ moveenemy()
move(LINES-1, 42);
printw("%3d", fuel);
move(LINES-1, 57);
- printw("%3d", clock);
+ printw("%3d", bclock);
refresh();
signal(SIGALRM, moveenemy);
alarm(1);
}
+void
endfly()
{
alarm(0);
signal(SIGALRM, SIG_DFL);
mvcur(0,COLS-1,LINES-1,0);
endwin();
+ setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
signal(SIGTSTP, SIG_DFL);
signal(SIGINT, oldsig);
}
diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c
index 82d45390166..585ea64caea 100644
--- a/games/battlestar/getcom.c
+++ b/games/battlestar/getcom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getcom.c,v 1.2 1997/06/30 19:56:36 kstailey Exp $ */
+/* $OpenBSD: getcom.c,v 1.3 1997/08/24 21:55:08 deraadt Exp $ */
/* $NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $ */
/*
@@ -44,6 +44,7 @@ static char rcsid[] = "$NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $";
#include <stdio.h>
#include <ctype.h>
+#include "extern.h"
char *
getcom(buf, size, prompt, error)
@@ -75,7 +76,7 @@ getcom(buf, size, prompt, error)
char *
getword(buf1, buf2, flag)
register char *buf1, *buf2;
- register flag;
+ register int flag;
{
while (isspace(*buf1))
buf1++;
diff --git a/games/battlestar/globals.c b/games/battlestar/globals.c
index 3c09232b06f..92152582670 100644
--- a/games/battlestar/globals.c
+++ b/games/battlestar/globals.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: globals.c,v 1.2 1997/06/30 19:56:36 kstailey Exp $ */
+/* $OpenBSD: globals.c,v 1.3 1997/08/24 21:55:09 deraadt Exp $ */
/* $NetBSD: globals.c,v 1.3 1995/03/21 15:07:32 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: globals.c,v 1.3 1995/03/21 15:07:32 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
int WEIGHT = MAXWEIGHT;
int CUMBER = MAXCUMBER;
diff --git a/games/battlestar/init.c b/games/battlestar/init.c
index 850221bc541..170816cdd3d 100644
--- a/games/battlestar/init.c
+++ b/games/battlestar/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.2 1997/06/30 19:56:37 kstailey Exp $ */
+/* $OpenBSD: init.c,v 1.3 1997/08/24 21:55:09 deraadt Exp $ */
/* $NetBSD: init.c,v 1.4 1995/03/21 15:07:35 cgd Exp $ */
/*
@@ -42,15 +42,20 @@ static char rcsid[] = "$NetBSD: init.c,v 1.4 1995/03/21 15:07:35 cgd Exp $";
#endif
#endif /* not lint */
+#include <unistd.h>
#include <sys/types.h>
-#include "externs.h"
+#include "extern.h"
#include <pwd.h>
+int checkout __P((char *));
+void getutmp __P((char *));
+int wizard __P((char *));
+
+void
initialize(startup)
char startup;
{
register struct objs *p;
- void die();
puts("Version 4.2, fall 1984.");
puts("First Adventure game written by His Lordship, the honorable");
@@ -61,7 +66,7 @@ initialize(startup)
if (startup) {
location = dayfile;
direction = NORTH;
- time = 0;
+ btime = 0;
snooze = CYCLE * 1.5;
position = 22;
setbit(wear, PAJAMAS);
@@ -75,6 +80,7 @@ initialize(startup)
signal(SIGINT, die);
}
+void
getutmp(uname)
char *uname;
{
@@ -102,6 +108,7 @@ char *badguys[] = {
0
};
+int
wizard(uname)
char *uname;
{
@@ -112,6 +119,7 @@ wizard(uname)
return flag;
}
+int
checkout(uname)
register char *uname;
{
@@ -126,7 +134,7 @@ checkout(uname)
uname);
CUMBER = 3;
WEIGHT = 9; /* that'll get him! */
- clock = 10;
+ bclock = 10;
setbit(location[7].objects, WOODSMAN); /* viper room */
setbit(location[20].objects, WOODSMAN); /* laser " */
setbit(location[13].objects, DARK); /* amulet " */
diff --git a/games/battlestar/misc.c b/games/battlestar/misc.c
index ef5d57ebb70..230bacdd85a 100644
--- a/games/battlestar/misc.c
+++ b/games/battlestar/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.2 1997/06/30 19:56:37 kstailey Exp $ */
+/* $OpenBSD: misc.c,v 1.3 1997/08/24 21:55:10 deraadt Exp $ */
/* $NetBSD: misc.c,v 1.3 1995/03/21 15:07:37 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: misc.c,v 1.3 1995/03/21 15:07:37 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int
card(array, size) /* for beenthere, injuries */
register char *array;
int size;
@@ -57,6 +58,7 @@ card(array, size) /* for beenthere, injuries */
return (i);
}
+int
ucard(array)
register unsigned *array;
{
diff --git a/games/battlestar/nightfile.c b/games/battlestar/nightfile.c
index 7fc2883ea33..b67216795a6 100644
--- a/games/battlestar/nightfile.c
+++ b/games/battlestar/nightfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nightfile.c,v 1.2 1997/06/30 19:56:38 kstailey Exp $ */
+/* $OpenBSD: nightfile.c,v 1.3 1997/08/24 21:55:11 deraadt Exp $ */
/* $NetBSD: nightfile.c,v 1.3 1995/03/21 15:07:41 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: nightfile.c,v 1.3 1995/03/21 15:07:41 cgd Exp $"
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
struct room nightfile[] = {
{ 0 },
@@ -187,7 +187,7 @@ face downward on the carpet clutching his chest.*\n\
The hallway leads -.**\n" },
{ "You are in the dining hall.",
0, 30, 31, 23, 0, 0, 0, 0,
-"This was the seen of a mass suicide. Hundreds of ambassadors and assorted\n\
+"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\
dignitaries sit slumped over their breakfast cereal. I suppose the news\n\
of the cylon attack killed them. There is a strange chill in this room. I\n\
would not linger here. * The kitchen is +. Entrances + and +.\n" },
@@ -440,7 +440,7 @@ The very tip of the island is +.*\n" },
{ "You are lost in a sea of fog.",
97, 104, 97, 97, 97, 1, 0, 1,
"What have you gotten us into?\n\
-I cant see a thing! ****\n" },
+I can't see a thing! ****\n" },
{ "You are on a gravel wash.",
125, 126, 127, 128, 84, 0, 0, 0,
"It is very dark here. A cool breeze is blowing from +. No moonlight can\n\
@@ -519,7 +519,7 @@ small cave entrance below. Large rocks would usually churn the waves\n\
asunder.*** The beach goes -.\n" },
{ "You are on the coast road.",
158, 161, 162, 91, 79, 0, 0, 0,
-"The road is beginning to turn slightly -. I can here the surf +. The road\n\
+"The road is beginning to turn slightly -. I can hear the surf +. The road\n\
continues into the dark forest +.*\n" },
{ "The road winds deeper into the trees.",
163, 142, 91, 164, 79, 0, 0, 0,
diff --git a/games/battlestar/nightobjs.c b/games/battlestar/nightobjs.c
index 2b222da5691..ecb7a42a660 100644
--- a/games/battlestar/nightobjs.c
+++ b/games/battlestar/nightobjs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nightobjs.c,v 1.2 1997/06/30 19:56:39 kstailey Exp $ */
+/* $OpenBSD: nightobjs.c,v 1.3 1997/08/24 21:55:12 deraadt Exp $ */
/* $NetBSD: nightobjs.c,v 1.3 1995/03/21 15:07:46 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: nightobjs.c,v 1.3 1995/03/21 15:07:46 cgd Exp $"
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
struct objs nightobjs[] = {
{ 218, PAJAMAS },
diff --git a/games/battlestar/parse.c b/games/battlestar/parse.c
index 387e2dcb75b..12092b62601 100644
--- a/games/battlestar/parse.c
+++ b/games/battlestar/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.3 1997/07/23 20:04:47 kstailey Exp $ */
+/* $OpenBSD: parse.c,v 1.4 1997/08/24 21:55:12 deraadt Exp $ */
/* $NetBSD: parse.c,v 1.3 1995/03/21 15:07:48 cgd Exp $ */
/*
@@ -42,8 +42,13 @@ static char rcsid[] = "$NetBSD: parse.c,v 1.3 1995/03/21 15:07:48 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+int hash __P((char *));
+void install __P((struct wlist *));
+struct wlist *lookup __P((char *));
+
+void
wordinit()
{
register struct wlist *w;
@@ -52,6 +57,7 @@ wordinit()
install(w);
}
+int
hash(s)
register char *s;
{
@@ -77,6 +83,7 @@ lookup(s)
return NULL;
}
+void
install(wp)
register struct wlist *wp;
{
@@ -90,6 +97,7 @@ install(wp)
printf("Multiply defined %s.\n", wp->string);
}
+void
parse()
{
register struct wlist *wp;
diff --git a/games/battlestar/room.c b/games/battlestar/room.c
index ab79db92d63..5efd65943b1 100644
--- a/games/battlestar/room.c
+++ b/games/battlestar/room.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: room.c,v 1.2 1997/06/30 19:56:41 kstailey Exp $ */
+/* $OpenBSD: room.c,v 1.3 1997/08/24 21:55:13 deraadt Exp $ */
/* $NetBSD: room.c,v 1.3 1995/03/21 15:07:54 cgd Exp $ */
/*
@@ -42,8 +42,9 @@ static char rcsid[] = "$NetBSD: room.c,v 1.3 1995/03/21 15:07:54 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+void
writedes()
{
int compass;
@@ -64,6 +65,7 @@ writedes()
}
}
+void
printobjs()
{
register unsigned int *p = location[position].objects;
@@ -75,6 +77,7 @@ printobjs()
puts(objdes[n]);
}
+void
whichway(here)
struct room here;
{
@@ -172,6 +175,7 @@ char option;
}
}
+void
newway(thisway)
int thisway;
{
diff --git a/games/battlestar/save.c b/games/battlestar/save.c
index 2aa67aab95c..dba31c8795e 100644
--- a/games/battlestar/save.c
+++ b/games/battlestar/save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: save.c,v 1.4 1997/06/30 19:56:41 kstailey Exp $ */
+/* $OpenBSD: save.c,v 1.5 1997/08/24 21:55:13 deraadt Exp $ */
/* $NetBSD: save.c,v 1.3 1995/03/21 15:07:57 cgd Exp $ */
/*
@@ -42,11 +42,11 @@ static char rcsid[] = "$NetBSD: save.c,v 1.3 1995/03/21 15:07:57 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
+void
restore()
{
- char *getenv();
char *home;
char home1[1024];
register int n;
@@ -65,12 +65,12 @@ restore()
if ((fp = fopen(home1, "r")) == 0) {
perror(home1);
setegid(getgid());
- return;
+ exit(1);
}
setegid(getgid());
fread(&WEIGHT, sizeof WEIGHT, 1, fp);
fread(&CUMBER, sizeof CUMBER, 1, fp);
- fread(&clock, sizeof clock, 1, fp);
+ fread(&bclock, sizeof bclock, 1, fp);
fread(&tmp, sizeof tmp, 1, fp);
location = tmp ? dayfile : nightfile;
for (n = 1; n <= NUMOFROOMS; n++) {
@@ -83,7 +83,7 @@ restore()
fread(notes, sizeof notes, 1, fp);
fread(&direction, sizeof direction, 1, fp);
fread(&position, sizeof position, 1, fp);
- fread(&time, sizeof time, 1, fp);
+ fread(&btime, sizeof btime, 1, fp);
fread(&fuel, sizeof fuel, 1, fp);
fread(&torps, sizeof torps, 1, fp);
fread(&carrying, sizeof carrying, 1, fp);
@@ -103,11 +103,12 @@ restore()
fread(&pleasure, sizeof pleasure, 1, fp);
fread(&power, sizeof power, 1, fp);
fread(&ego, sizeof ego, 1, fp);
+ fclose(fp);
}
+void
save()
{
- char *getenv();
char *home;
char home1[100];
register int n;
@@ -132,7 +133,7 @@ save()
printf("Saved in %s.\n", home1);
fwrite(&WEIGHT, sizeof WEIGHT, 1, fp);
fwrite(&CUMBER, sizeof CUMBER, 1, fp);
- fwrite(&clock, sizeof clock, 1, fp);
+ fwrite(&bclock, sizeof bclock, 1, fp);
tmp = location == dayfile;
fwrite(&tmp, sizeof tmp, 1, fp);
for (n = 1; n <= NUMOFROOMS; n++) {
@@ -145,7 +146,7 @@ save()
fwrite(notes, sizeof notes, 1, fp);
fwrite(&direction, sizeof direction, 1, fp);
fwrite(&position, sizeof position, 1, fp);
- fwrite(&time, sizeof time, 1, fp);
+ fwrite(&btime, sizeof btime, 1, fp);
fwrite(&fuel, sizeof fuel, 1, fp);
fwrite(&torps, sizeof torps, 1, fp);
fwrite(&carrying, sizeof carrying, 1, fp);
@@ -165,4 +166,5 @@ save()
fwrite(&pleasure, sizeof pleasure, 1, fp);
fwrite(&power, sizeof power, 1, fp);
fwrite(&ego, sizeof ego, 1, fp);
+ fclose(fp);
}
diff --git a/games/battlestar/words.c b/games/battlestar/words.c
index 02b8e06474c..09fa97e8d76 100644
--- a/games/battlestar/words.c
+++ b/games/battlestar/words.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: words.c,v 1.2 1997/06/30 19:56:42 kstailey Exp $ */
+/* $OpenBSD: words.c,v 1.3 1997/08/24 21:55:14 deraadt Exp $ */
/* $NetBSD: words.c,v 1.3 1995/03/21 15:08:00 cgd Exp $ */
/*
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: words.c,v 1.3 1995/03/21 15:08:00 cgd Exp $";
#endif
#endif /* not lint */
-#include "externs.h"
+#include "extern.h"
struct wlist wlist[] = {
{ "knife", KNIFE, OBJECT },