diff options
author | lukem <lukem@NetBSD.org> | 1997-10-11 01:53:21 +0000 |
---|---|---|
committer | lukem <lukem@NetBSD.org> | 1997-10-11 01:53:21 +0000 |
commit | 7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba (patch) | |
tree | d315e6e1cff5b3f0deb38704e741f5f580ea319d /adventure/wizard.c | |
parent | a020fc98d8da9cac6990006871414e8654ac5c1d (diff) | |
download | bsdgames-darwin-7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba.tar.gz bsdgames-darwin-7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba.tar.zst bsdgames-darwin-7a7d157b6dfb2274277e61ea5f1c8a97e88e73ba.zip |
KNFify
Diffstat (limited to 'adventure/wizard.c')
-rw-r--r-- | adventure/wizard.c | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/adventure/wizard.c b/adventure/wizard.c index 86d556fc..ae064219 100644 --- a/adventure/wizard.c +++ b/adventure/wizard.c @@ -1,4 +1,4 @@ -/* $NetBSD: wizard.c,v 1.5 1997/10/10 12:00:02 lukem Exp $ */ +/* $NetBSD: wizard.c,v 1.6 1997/10/11 01:53:40 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -43,9 +43,9 @@ #if 0 static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93"; #else -__RCSID("$NetBSD: wizard.c,v 1.5 1997/10/10 12:00:02 lukem Exp $"); +__RCSID("$NetBSD: wizard.c,v 1.6 1997/10/11 01:53:40 lukem Exp $"); #endif -#endif /* not lint */ +#endif /* not lint */ /* Re-coding of advent in C: privileged operations */ @@ -57,82 +57,90 @@ __RCSID("$NetBSD: wizard.c,v 1.5 1997/10/10 12:00:02 lukem Exp $"); #include "extern.h" void -datime(d,t) -int *d,*t; -{ time_t tvec; +datime(d, t) + int *d, *t; +{ + time_t tvec; struct tm *tptr; time(&tvec); - tptr=localtime(&tvec); + tptr = localtime(&tvec); /* day since 1977 (mod leap) */ - *d=tptr->tm_yday +365*(tptr->tm_year-77); + *d = tptr->tm_yday + 365 * (tptr->tm_year - 77); /* bug: this will overflow in the year 2066 AD */ /* it will be attributed to Wm the C's millenial celebration */ /* and minutes since midnite */ - *t=tptr->tm_hour*60+tptr->tm_min; -} /* pretty painless */ + *t = tptr->tm_hour * 60 + tptr->tm_min; +} /* pretty painless */ -char magic[6]; +char magic[6]; void poof() { - strcpy(magic, DECR('d','w','a','r','f')); + strcpy(magic, DECR('d', 'w', 'a', 'r', 'f')); latncy = 45; } int Start(n) -{ int d,t,delay; +{ + int d, t, delay; - datime(&d,&t); - delay=(d-saved)*1440+(t-savet); /* good for about a month */ + datime(&d, &t); + delay = (d - saved) * 1440 + (t - savet); /* good for about a + * month */ - if (delay >= latncy) - { saved = -1; - return(FALSE); + if (delay >= latncy) { + saved = -1; + return (FALSE); } printf("This adventure was suspended a mere %d minute%s ago.", - delay, delay == 1? "" : "s"); - if (delay <= latncy/3) - { mspeak(2); + delay, delay == 1 ? "" : "s"); + if (delay <= latncy / 3) { + mspeak(2); exit(0); } mspeak(8); - if (!wizard()) - { mspeak(9); + if (!wizard()) { + mspeak(9); exit(0); } saved = -1; - return(FALSE); + return (FALSE); } int -wizard() /* not as complex as advent/10 (for now) */ -{ char *word,*x; - if (!yesm(16,0,7)) return(FALSE); +wizard() +{ /* not as complex as advent/10 (for now) */ + char *word, *x; + if (!yesm(16, 0, 7)) + return (FALSE); mspeak(17); - getin(&word,&x); - if (!weq(word,magic)) - { mspeak(20); - return(FALSE); + getin(&word, &x); + if (!weq(word, magic)) { + mspeak(20); + return (FALSE); } mspeak(19); - return(TRUE); + return (TRUE); } void ciao(cmdfile) -char *cmdfile; -{ char *c; - char fname[80]; + char *cmdfile; +{ + char *c; + char fname[80]; printf("What would you like to call the saved version?\n"); - for (c=fname;; c++) - if ((*c=getchar())=='\n') break; - *c=0; - if (save(fname) != 0) return; /* Save failed */ + for (c = fname;; c++) + if ((*c = getchar()) == '\n') + break; + *c = 0; + if (save(fname) != 0) + return; /* Save failed */ printf("To resume, say \"adventure %s\".\n", fname); printf("\"With these rooms I might now have been familiarly acquainted.\"\n"); exit(0); @@ -141,10 +149,10 @@ char *cmdfile; int ran(range) -int range; + int range; { - long i; + long i; i = rand() % range; - return(i); + return (i); } |