summaryrefslogtreecommitdiffstats
path: root/monop/execute.c
diff options
context:
space:
mode:
authorsimonb <simonb@NetBSD.org>1999-08-21 10:40:03 +0000
committersimonb <simonb@NetBSD.org>1999-08-21 10:40:03 +0000
commite6fd9858739827671b4b260dd533f89f860a9fa7 (patch)
tree972e93ee56db748e5c589b841304a69ecc01bc25 /monop/execute.c
parentca104a29f1236b5c4ee454e8c132ed8518df7a27 (diff)
downloadbsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.tar.gz
bsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.tar.zst
bsdgames-darwin-e6fd9858739827671b4b260dd533f89f860a9fa7.zip
Convert to something resembling KNF.
Diffstat (limited to 'monop/execute.c')
-rw-r--r--monop/execute.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/monop/execute.c b/monop/execute.c
index 3e9aa0a3..505bbc4e 100644
--- a/monop/execute.c
+++ b/monop/execute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $ */
+/* $NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $");
+__RCSID("$NetBSD: execute.c,v 1.6 1999/08/21 10:40:03 simonb Exp $");
#endif
#endif /* not lint */
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: execute.c,v 1.5 1998/09/11 13:54:08 hubertf Exp $");
#include <sys/stat.h>
#include <sys/time.h>
-# define SEGSIZE 8192
+#define SEGSIZE 8192
typedef struct stat STAT;
typedef struct tm TIME;
@@ -66,9 +66,8 @@ static void show_move __P((void));
*/
void
execute(com_num)
-int com_num;
+ int com_num;
{
-
new_play = FALSE; /* new_play is true if fixing */
(*func[com_num])();
notify();
@@ -78,15 +77,15 @@ int com_num;
else if (num_doub)
printf("%s rolled doubles. Goes again\n", cur_p->name);
}
+
/*
* This routine moves a piece around.
*/
void
do_move()
{
-
- int r1, r2;
- bool was_jail;
+ int r1, r2;
+ bool was_jail;
new_play = was_jail = FALSE;
printf("roll is %d, %d\n", r1=roll(1, 6), r2=roll(1, 6));
@@ -111,15 +110,15 @@ do_move()
ret:
return;
}
+
/*
* This routine moves a normal move
*/
void
move(rl)
-int rl;
+ int rl;
{
-
- int old_loc;
+ int old_loc;
old_loc = cur_p->loc;
cur_p->loc = (cur_p->loc + rl) % N_SQRS;
@@ -129,14 +128,14 @@ int rl;
}
show_move();
}
+
/*
* This routine shows the results of a move
*/
static void
show_move()
{
-
- SQUARE *sqp;
+ SQUARE *sqp;
sqp = &board[cur_p->loc];
printf("That puts you on %s\n", sqp->name);
@@ -172,18 +171,18 @@ show_move()
rent(sqp);
}
}
+
/*
* This routine saves the current game for use at a later date
*/
void
save()
{
-
- char *sp;
- int outf, num;
- time_t t;
- struct stat sb;
- char *start, *end;
+ char *sp;
+ int outf, num;
+ time_t t;
+ struct stat sb;
+ char *start, *end;
printf("Which file do you wish to save it in? ");
sp = buf;
@@ -219,14 +218,14 @@ save()
close(outf);
printf("[%s]\n", buf);
}
+
/*
* This routine restores an old game from a file
*/
void
restore()
{
-
- char *sp;
+ char *sp;
printf("Which file do you wish to restore from? ");
for (sp = buf; (*sp=getchar()) != '\n'; sp++)
@@ -234,20 +233,20 @@ restore()
*sp = '\0';
rest_f(buf);
}
+
/*
* This does the actual restoring. It returns TRUE if the
* backup was successful, else false.
*/
int
rest_f(file)
-char *file;
+ char *file;
{
-
- char *sp;
- int inf, num;
- char buf[80];
- char *start, *end;
- STAT sbuf;
+ char *sp;
+ int inf, num;
+ char buf[80];
+ char *start, *end;
+ STAT sbuf;
if ((inf=open(file, O_RDONLY)) < 0) {
perror(file);