-/* $NetBSD: command6.c,v 1.2 2003/08/07 09:37:01 agc Exp $ */
+/* $NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command6.c,v 1.2 2003/08/07 09:37:01 agc Exp $");
+__RCSID("$NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $");
#endif
#endif /* not lint */
#include "extern.h"
#include "pathnames.h"
+static void post(int);
+
int
-launch()
+launch(void)
{
if (testbit(location[position].objects, VIPER) && !notes[CANTLAUNCH]) {
if (fuel > 4) {
notes[LAUNCHED] = 1;
ourtime++;
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.");
+ printf("You climb into the viper and prepare for ");
+ puts("launch.");
+ printf("With a touch of your thumb the turbo engines ");
+ printf("ignite, thrusting you back into\nyour seat.\n");
return (1);
} else
puts("Not enough fuel to launch.");
}
int
-land()
+land(void)
{
if (notes[LAUNCHED] && testbit(location[position].objects, LAND) &&
location[position].down) {
}
void
-die()
+die(void)
{ /* endgame */
printf("bye.\nYour rating was %s.\n", rate());
post(' ');
}
void
-diesig(dummy)
- int dummy __attribute__((__unused__));
+diesig(int dummy __unused)
{
die();
}
void
-live()
+live(void)
{
puts("\nYou win!");
post('!');
static FILE *score_fp;
void
-open_score_file()
+open_score_file(void)
{
score_fp = fopen(_PATH_SCORE, "a");
if (score_fp == NULL)
exit(1);
}
-void
-post(ch)
- char ch;
+static void
+post(int ch)
{
time_t tv;
- char *date;
- sigset_t sigset, osigset;
+ sigset_t isigset, osigset;
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGINT);
- sigprocmask(SIG_BLOCK, &sigset, &osigset);
+ sigemptyset(&isigset);
+ sigaddset(&isigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &isigset, &osigset);
tv = time(NULL);
- date = ctime(&tv);
- date[24] = '\0';
if (score_fp != NULL) {
- fprintf(score_fp, "%s %8s %c%20s", date, username, ch, rate());
+ fprintf(score_fp, "%24.24s %8s %c%20s", ctime(&tv), username,
+ ch, rate());
if (wiz)
fprintf(score_fp, " wizard\n");
else
else
fprintf(score_fp, "\n");
}
+ fflush(score_fp);
sigprocmask(SIG_SETMASK, &osigset, (sigset_t *) 0);
}
-const char *
-rate()
+const char *
+rate(void)
{
int score;
}
int
-drive()
+drive(void)
{
if (testbit(location[position].objects, CAR)) {
- puts("You hop in the car and turn the key. There is a perceptible grating noise,");
+ printf("You hop in the car and turn the key. There is ");
+ puts("a perceptible grating noise,");
puts("and an explosion knocks you unconscious...");
clearbit(location[position].objects, CAR);
setbit(location[position].objects, CRASH);
}
int
-ride()
+ride(void)
{
if (testbit(location[position].objects, HORSE)) {
- puts("You climb onto the stallion and kick it in the guts. The stupid steed launches");
- puts("forward through bush and fern. You are thrown and the horse gallops off.");
+ printf("You climb onto the stallion and kick it in the guts.");
+ puts(" The stupid steed launches");
+ printf("forward through bush and fern. You are thrown and ");
+ puts("the horse gallops off.");
clearbit(location[position].objects, HORSE);
- while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere)
+ while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE ||
+ !beenthere[position] || location[position].flyhere)
continue;
setbit(location[position].objects, HORSE);
if (location[position].north)
}
void
-light()
+light(void)
{ /* synonyms = {strike, smoke} *//* for
* matches, cigars */
if (testbit(inven, MATCHES) && matchcount) {
matchlight = 1;
matchcount--;
if (position == 217) {
- puts("The whole bungalow explodes with an intense blast.");
+ printf("The whole bungalow explodes with an ");
+ puts("intense blast.");
die();
}
} else
}
void
-dooropen()
+dooropen(void)
{ /* synonyms = {open, unlock} */
wordnumber++;
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS