Home | History | Annotate | Line # | Download | only in battlestar
cypher.c revision 1.9
      1  1.9  hubertf /*	$NetBSD: cypher.c,v 1.9 1999/07/28 01:45:42 hubertf Exp $	*/
      2  1.3      cgd 
      3  1.1      cgd /*
      4  1.3      cgd  * Copyright (c) 1983, 1993
      5  1.3      cgd  *	The Regents of the University of California.  All rights reserved.
      6  1.1      cgd  *
      7  1.1      cgd  * Redistribution and use in source and binary forms, with or without
      8  1.1      cgd  * modification, are permitted provided that the following conditions
      9  1.1      cgd  * are met:
     10  1.1      cgd  * 1. Redistributions of source code must retain the above copyright
     11  1.1      cgd  *    notice, this list of conditions and the following disclaimer.
     12  1.1      cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1      cgd  *    notice, this list of conditions and the following disclaimer in the
     14  1.1      cgd  *    documentation and/or other materials provided with the distribution.
     15  1.1      cgd  * 3. All advertising materials mentioning features or use of this software
     16  1.1      cgd  *    must display the following acknowledgement:
     17  1.1      cgd  *	This product includes software developed by the University of
     18  1.1      cgd  *	California, Berkeley and its contributors.
     19  1.1      cgd  * 4. Neither the name of the University nor the names of its contributors
     20  1.1      cgd  *    may be used to endorse or promote products derived from this software
     21  1.1      cgd  *    without specific prior written permission.
     22  1.1      cgd  *
     23  1.1      cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.1      cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.1      cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.1      cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.1      cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.1      cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.1      cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.1      cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.1      cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.1      cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.1      cgd  * SUCH DAMAGE.
     34  1.1      cgd  */
     35  1.1      cgd 
     36  1.5    lukem #include <sys/cdefs.h>
     37  1.1      cgd #ifndef lint
     38  1.3      cgd #if 0
     39  1.4      tls static char sccsid[] = "@(#)cypher.c	8.2 (Berkeley) 4/28/95";
     40  1.3      cgd #else
     41  1.9  hubertf __RCSID("$NetBSD: cypher.c,v 1.9 1999/07/28 01:45:42 hubertf Exp $");
     42  1.3      cgd #endif
     43  1.6    lukem #endif				/* not lint */
     44  1.1      cgd 
     45  1.4      tls #include "extern.h"
     46  1.1      cgd 
     47  1.5    lukem int
     48  1.1      cgd cypher()
     49  1.1      cgd {
     50  1.6    lukem 	int     n;
     51  1.6    lukem 	int     junk;
     52  1.6    lukem 	int     lflag = -1;
     53  1.6    lukem 	char    buffer[10];
     54  1.9  hubertf 	char   *filename, *rfilename;
     55  1.9  hubertf 	size_t	filename_len;
     56  1.1      cgd 
     57  1.1      cgd 	while (wordtype[wordnumber] == ADJS)
     58  1.1      cgd 		wordnumber++;
     59  1.1      cgd 	while (wordnumber <= wordcount) {
     60  1.6    lukem 		switch (wordvalue[wordnumber]) {
     61  1.1      cgd 
     62  1.6    lukem 		case UP:
     63  1.6    lukem 			if (location[position].access || wiz || tempwiz) {
     64  1.6    lukem 				if (!location[position].access)
     65  1.6    lukem 					puts("Zap!  A gust of wind lifts you up.");
     66  1.6    lukem 				if (!move(location[position].up, AHEAD))
     67  1.6    lukem 					return (-1);
     68  1.6    lukem 			} else {
     69  1.6    lukem 				puts("There is no way up");
     70  1.6    lukem 				return (-1);
     71  1.6    lukem 			}
     72  1.6    lukem 			lflag = 0;
     73  1.6    lukem 			break;
     74  1.6    lukem 
     75  1.6    lukem 		case DOWN:
     76  1.6    lukem 			if (!move(location[position].down, AHEAD))
     77  1.6    lukem 				return (-1);
     78  1.6    lukem 			lflag = 0;
     79  1.6    lukem 			break;
     80  1.6    lukem 
     81  1.6    lukem 		case LEFT:
     82  1.6    lukem 			if (!move(left, LEFT))
     83  1.6    lukem 				return (-1);
     84  1.6    lukem 			lflag = 0;
     85  1.6    lukem 			break;
     86  1.6    lukem 
     87  1.6    lukem 		case RIGHT:
     88  1.6    lukem 			if (!move(right, RIGHT))
     89  1.6    lukem 				return (-1);
     90  1.6    lukem 			lflag = 0;
     91  1.6    lukem 			break;
     92  1.6    lukem 
     93  1.6    lukem 		case AHEAD:
     94  1.6    lukem 			if (!move(ahead, AHEAD))
     95  1.6    lukem 				return (-1);
     96  1.6    lukem 			lflag = 0;
     97  1.6    lukem 			break;
     98  1.6    lukem 
     99  1.6    lukem 		case BACK:
    100  1.6    lukem 			if (!move(back, BACK))
    101  1.6    lukem 				return (-1);
    102  1.6    lukem 			lflag = 0;
    103  1.6    lukem 			break;
    104  1.6    lukem 
    105  1.6    lukem 		case SHOOT:
    106  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    107  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    108  1.7  hubertf 					if (testbit(location[position].objects, n) && objsht[n]) {
    109  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    110  1.6    lukem 						wordnumber = shoot();
    111  1.6    lukem 					}
    112  1.1      cgd 				wordnumber++;
    113  1.1      cgd 				wordnumber++;
    114  1.6    lukem 			} else
    115  1.6    lukem 				shoot();
    116  1.6    lukem 			break;
    117  1.6    lukem 
    118  1.6    lukem 		case TAKE:
    119  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    120  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    121  1.7  hubertf 					if (testbit(location[position].objects, n) && objsht[n]) {
    122  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    123  1.8  hubertf 						/* Some objects (type NOUNS)
    124  1.8  hubertf 						 * have special treatment in
    125  1.8  hubertf 						 * take().  For these we
    126  1.8  hubertf 						 * must set the type to NOUNS.
    127  1.8  hubertf 						 * However for SWORD and BODY
    128  1.8  hubertf 						 * all it does is find which
    129  1.8  hubertf 						 * of many objects is meant,
    130  1.8  hubertf 						 * so we need do nothing here.
    131  1.8  hubertf 						 * BATHGOD must become
    132  1.8  hubertf 						 * NORMGOD as well.  NOUNS
    133  1.8  hubertf 						 * with no special case
    134  1.8  hubertf 						 * must be included here to
    135  1.8  hubertf 						 * get the right error.  DOOR
    136  1.8  hubertf 						 * cannot occur as an object
    137  1.8  hubertf 						 * so need not be included.  */
    138  1.8  hubertf 						switch(n) {
    139  1.8  hubertf 						case BATHGOD:
    140  1.8  hubertf 							wordvalue[wordnumber + 1] = NORMGOD;
    141  1.8  hubertf 						case NORMGOD:
    142  1.8  hubertf 						case AMULET:
    143  1.8  hubertf 						case MEDALION:
    144  1.8  hubertf 						case TALISMAN:
    145  1.8  hubertf 						case MAN:
    146  1.8  hubertf 						case TIMER:
    147  1.8  hubertf 						case NATIVE:
    148  1.8  hubertf 							wordtype[wordnumber + 1] = NOUNS;
    149  1.8  hubertf 							break;
    150  1.8  hubertf 						default:
    151  1.8  hubertf 							wordtype[wordnumber + 1] = OBJECT;
    152  1.8  hubertf 						}
    153  1.6    lukem 						wordnumber = take(location[position].objects);
    154  1.6    lukem 					}
    155  1.1      cgd 				wordnumber++;
    156  1.1      cgd 				wordnumber++;
    157  1.6    lukem 			} else
    158  1.6    lukem 				take(location[position].objects);
    159  1.6    lukem 			break;
    160  1.6    lukem 
    161  1.6    lukem 		case DROP:
    162  1.6    lukem 
    163  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    164  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    165  1.6    lukem 					if (testbit(inven, n)) {
    166  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    167  1.6    lukem 						wordnumber = drop("Dropped");
    168  1.6    lukem 					}
    169  1.1      cgd 				wordnumber++;
    170  1.1      cgd 				wordnumber++;
    171  1.6    lukem 			} else
    172  1.6    lukem 				drop("Dropped");
    173  1.6    lukem 			break;
    174  1.6    lukem 
    175  1.6    lukem 
    176  1.6    lukem 		case KICK:
    177  1.6    lukem 		case THROW:
    178  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    179  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    180  1.6    lukem 					if (testbit(inven, n) ||
    181  1.7  hubertf 					    (testbit(location[position].objects, n) && objsht[n])) {
    182  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    183  1.6    lukem 						wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
    184  1.6    lukem 					}
    185  1.6    lukem 				wordnumber += 2;
    186  1.6    lukem 			} else
    187  1.6    lukem 				throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
    188  1.6    lukem 			break;
    189  1.6    lukem 
    190  1.6    lukem 		case TAKEOFF:
    191  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    192  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    193  1.6    lukem 					if (testbit(wear, n)) {
    194  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    195  1.6    lukem 						wordnumber = takeoff();
    196  1.6    lukem 					}
    197  1.6    lukem 				wordnumber += 2;
    198  1.6    lukem 			} else
    199  1.6    lukem 				takeoff();
    200  1.6    lukem 			break;
    201  1.1      cgd 
    202  1.1      cgd 
    203  1.6    lukem 		case DRAW:
    204  1.6    lukem 
    205  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    206  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    207  1.6    lukem 					if (testbit(wear, n)) {
    208  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    209  1.6    lukem 						wordnumber = draw();
    210  1.6    lukem 					}
    211  1.6    lukem 				wordnumber += 2;
    212  1.6    lukem 			} else
    213  1.6    lukem 				draw();
    214  1.6    lukem 			break;
    215  1.1      cgd 
    216  1.1      cgd 
    217  1.6    lukem 		case PUTON:
    218  1.6    lukem 
    219  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    220  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    221  1.7  hubertf 					if (testbit(location[position].objects, n) && objsht[n]) {
    222  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    223  1.6    lukem 						wordnumber = puton();
    224  1.6    lukem 					}
    225  1.6    lukem 				wordnumber += 2;
    226  1.6    lukem 			} else
    227  1.6    lukem 				puton();
    228  1.6    lukem 			break;
    229  1.6    lukem 
    230  1.6    lukem 		case WEARIT:
    231  1.6    lukem 
    232  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    233  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    234  1.6    lukem 					if (testbit(inven, n)) {
    235  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    236  1.6    lukem 						wordnumber = wearit();
    237  1.6    lukem 					}
    238  1.6    lukem 				wordnumber += 2;
    239  1.6    lukem 			} else
    240  1.6    lukem 				wearit();
    241  1.6    lukem 			break;
    242  1.1      cgd 
    243  1.1      cgd 
    244  1.6    lukem 		case EAT:
    245  1.6    lukem 
    246  1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    247  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    248  1.6    lukem 					if (testbit(inven, n)) {
    249  1.6    lukem 						wordvalue[wordnumber + 1] = n;
    250  1.6    lukem 						wordnumber = eat();
    251  1.1      cgd 					}
    252  1.6    lukem 				wordnumber += 2;
    253  1.6    lukem 			} else
    254  1.6    lukem 				eat();
    255  1.6    lukem 			break;
    256  1.6    lukem 
    257  1.6    lukem 
    258  1.6    lukem 		case PUT:
    259  1.6    lukem 			put();
    260  1.6    lukem 			break;
    261  1.6    lukem 
    262  1.6    lukem 
    263  1.6    lukem 		case INVEN:
    264  1.6    lukem 			if (ucard(inven)) {
    265  1.6    lukem 				puts("You are holding:\n");
    266  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    267  1.6    lukem 					if (testbit(inven, n))
    268  1.6    lukem 						printf("\t%s\n", objsht[n]);
    269  1.6    lukem 				printf("\n= %d kilogram%s (%d%%)\n", carrying, (carrying == 1 ? "." : "s."), (WEIGHT ? carrying * 100 / WEIGHT : -1));
    270  1.6    lukem 				printf("Your arms are %d%% full.\n", encumber * 100 / CUMBER);
    271  1.6    lukem 			} else
    272  1.6    lukem 				puts("You aren't carrying anything.");
    273  1.6    lukem 
    274  1.6    lukem 			if (ucard(wear)) {
    275  1.6    lukem 				puts("\nYou are wearing:\n");
    276  1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    277  1.6    lukem 					if (testbit(wear, n))
    278  1.6    lukem 						printf("\t%s\n", objsht[n]);
    279  1.6    lukem 			} else
    280  1.6    lukem 				puts("\nYou are stark naked.");
    281  1.6    lukem 			if (card(injuries, NUMOFINJURIES)) {
    282  1.6    lukem 				puts("\nYou have suffered:\n");
    283  1.6    lukem 				for (n = 0; n < NUMOFINJURIES; n++)
    284  1.6    lukem 					if (injuries[n])
    285  1.6    lukem 						printf("\t%s\n", ouch[n]);
    286  1.6    lukem 				printf("\nYou can still carry up to %d kilogram%s\n", WEIGHT, (WEIGHT == 1 ? "." : "s."));
    287  1.6    lukem 			} else
    288  1.6    lukem 				puts("\nYou are in perfect health.");
    289  1.6    lukem 			break;
    290  1.6    lukem 
    291  1.6    lukem 		case USE:
    292  1.6    lukem 			lflag = use();
    293  1.6    lukem 			break;
    294  1.6    lukem 
    295  1.6    lukem 		case LOOK:
    296  1.6    lukem 			if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
    297  1.6    lukem 			    testbit(location[position].objects, LAMPON)
    298  1.6    lukem 			    || matchlight) {
    299  1.6    lukem 				beenthere[position] = 2;
    300  1.6    lukem 				writedes();
    301  1.6    lukem 				printobjs();
    302  1.6    lukem 				if (matchlight) {
    303  1.6    lukem 					puts("\nYour match splutters out.");
    304  1.6    lukem 					matchlight = 0;
    305  1.6    lukem 				}
    306  1.6    lukem 			} else
    307  1.6    lukem 				puts("I can't see anything.");
    308  1.6    lukem 			return (-1);
    309  1.6    lukem 			break;
    310  1.1      cgd 
    311  1.6    lukem 		case SU:
    312  1.6    lukem 			if (wiz || tempwiz) {
    313  1.1      cgd 				printf("\nRoom (was %d) = ", position);
    314  1.6    lukem 				fgets(buffer, 10, stdin);
    315  1.1      cgd 				if (*buffer != '\n')
    316  1.6    lukem 					sscanf(buffer, "%d", &position);
    317  1.5    lukem 				printf("Time (was %d) = ", ourtime);
    318  1.6    lukem 				fgets(buffer, 10, stdin);
    319  1.1      cgd 				if (*buffer != '\n')
    320  1.6    lukem 					sscanf(buffer, "%d", &ourtime);
    321  1.6    lukem 				printf("Fuel (was %d) = ", fuel);
    322  1.6    lukem 				fgets(buffer, 10, stdin);
    323  1.1      cgd 				if (*buffer != '\n')
    324  1.6    lukem 					sscanf(buffer, "%d", &fuel);
    325  1.6    lukem 				printf("Torps (was %d) = ", torps);
    326  1.6    lukem 				fgets(buffer, 10, stdin);
    327  1.1      cgd 				if (*buffer != '\n')
    328  1.6    lukem 					sscanf(buffer, "%d", &torps);
    329  1.6    lukem 				printf("CUMBER (was %d) = ", CUMBER);
    330  1.6    lukem 				fgets(buffer, 10, stdin);
    331  1.1      cgd 				if (*buffer != '\n')
    332  1.6    lukem 					sscanf(buffer, "%d", &CUMBER);
    333  1.6    lukem 				printf("WEIGHT (was %d) = ", WEIGHT);
    334  1.6    lukem 				fgets(buffer, 10, stdin);
    335  1.1      cgd 				if (*buffer != '\n')
    336  1.6    lukem 					sscanf(buffer, "%d", &WEIGHT);
    337  1.5    lukem 				printf("Clock (was %d) = ", ourclock);
    338  1.6    lukem 				fgets(buffer, 10, stdin);
    339  1.1      cgd 				if (*buffer != '\n')
    340  1.6    lukem 					sscanf(buffer, "%d", &ourclock);
    341  1.6    lukem 				printf("Wizard (was %d, %d) = ", wiz, tempwiz);
    342  1.6    lukem 				fgets(buffer, 10, stdin);
    343  1.6    lukem 				if (*buffer != '\n') {
    344  1.6    lukem 					sscanf(buffer, "%d", &junk);
    345  1.1      cgd 					if (!junk)
    346  1.1      cgd 						tempwiz = wiz = 0;
    347  1.1      cgd 				}
    348  1.1      cgd 				printf("\nDONE.\n");
    349  1.6    lukem 				return (0);
    350  1.6    lukem 			} else
    351  1.6    lukem 				puts("You aren't a wizard.");
    352  1.6    lukem 			break;
    353  1.6    lukem 
    354  1.6    lukem 		case SCORE:
    355  1.6    lukem 			printf("\tPLEASURE\tPOWER\t\tEGO\n");
    356  1.6    lukem 			printf("\t%3d\t\t%3d\t\t%3d\n\n", pleasure, power, ego);
    357  1.6    lukem 			printf("This gives you the rating of %s in %d turns.\n", rate(), ourtime);
    358  1.6    lukem 			printf("You have visited %d out of %d rooms this run (%d%%).\n", card(beenthere, NUMOFROOMS), NUMOFROOMS, card(beenthere, NUMOFROOMS) * 100 / NUMOFROOMS);
    359  1.6    lukem 			break;
    360  1.6    lukem 
    361  1.6    lukem 		case KNIFE:
    362  1.6    lukem 		case KILL:
    363  1.6    lukem 			murder();
    364  1.6    lukem 			break;
    365  1.6    lukem 
    366  1.6    lukem 		case UNDRESS:
    367  1.6    lukem 		case RAVAGE:
    368  1.6    lukem 			ravage();
    369  1.6    lukem 			break;
    370  1.6    lukem 
    371  1.6    lukem 		case SAVE:
    372  1.9  hubertf 			printf("\nSave file name (default %s) ",
    373  1.9  hubertf 			       DEFAULT_SAVE_FILE);
    374  1.9  hubertf 			filename = fgetln(stdin, &filename_len);
    375  1.9  hubertf 			if (filename_len == 0
    376  1.9  hubertf 			    || (filename_len == 1 && filename[0] == '\n'))
    377  1.9  hubertf 				rfilename = save_file_name(DEFAULT_SAVE_FILE,
    378  1.9  hubertf 				    strlen(DEFAULT_SAVE_FILE));
    379  1.9  hubertf 			else {
    380  1.9  hubertf 				if (filename[filename_len - 1] == '\n')
    381  1.9  hubertf 					filename_len--;
    382  1.9  hubertf 				rfilename = save_file_name(filename,
    383  1.9  hubertf 							   filename_len);
    384  1.9  hubertf 			}
    385  1.9  hubertf 			save(rfilename);
    386  1.9  hubertf 			free(rfilename);
    387  1.6    lukem 			break;
    388  1.6    lukem 
    389  1.6    lukem 		case FOLLOW:
    390  1.6    lukem 			lflag = follow();
    391  1.6    lukem 			break;
    392  1.6    lukem 
    393  1.6    lukem 		case GIVE:
    394  1.6    lukem 			give();
    395  1.6    lukem 			break;
    396  1.6    lukem 
    397  1.6    lukem 		case KISS:
    398  1.6    lukem 			kiss();
    399  1.6    lukem 			break;
    400  1.6    lukem 
    401  1.6    lukem 		case LOVE:
    402  1.6    lukem 			love();
    403  1.6    lukem 			break;
    404  1.6    lukem 
    405  1.6    lukem 		case RIDE:
    406  1.6    lukem 			lflag = ride();
    407  1.6    lukem 			break;
    408  1.6    lukem 
    409  1.6    lukem 		case DRIVE:
    410  1.6    lukem 			lflag = drive();
    411  1.6    lukem 			break;
    412  1.6    lukem 
    413  1.6    lukem 		case LIGHT:
    414  1.6    lukem 			light();
    415  1.6    lukem 			break;
    416  1.6    lukem 
    417  1.6    lukem 		case LAUNCH:
    418  1.6    lukem 			if (!launch())
    419  1.6    lukem 				return (-1);
    420  1.6    lukem 			else
    421  1.6    lukem 				lflag = 0;
    422  1.6    lukem 			break;
    423  1.6    lukem 
    424  1.6    lukem 		case LANDIT:
    425  1.6    lukem 			if (!land())
    426  1.6    lukem 				return (-1);
    427  1.6    lukem 			else
    428  1.6    lukem 				lflag = 0;
    429  1.6    lukem 			break;
    430  1.6    lukem 
    431  1.6    lukem 		case TIME:
    432  1.6    lukem 			chime();
    433  1.6    lukem 			break;
    434  1.6    lukem 
    435  1.6    lukem 		case SLEEP:
    436  1.6    lukem 			zzz();
    437  1.6    lukem 			break;
    438  1.6    lukem 
    439  1.6    lukem 		case DIG:
    440  1.6    lukem 			dig();
    441  1.6    lukem 			break;
    442  1.6    lukem 
    443  1.6    lukem 		case JUMP:
    444  1.6    lukem 			lflag = jump();
    445  1.6    lukem 			break;
    446  1.6    lukem 
    447  1.6    lukem 		case BURY:
    448  1.6    lukem 			bury();
    449  1.6    lukem 			break;
    450  1.6    lukem 
    451  1.6    lukem 		case SWIM:
    452  1.6    lukem 			puts("Surf's up!");
    453  1.6    lukem 			break;
    454  1.6    lukem 
    455  1.6    lukem 		case DRINK:
    456  1.6    lukem 			drink();
    457  1.6    lukem 			break;
    458  1.6    lukem 
    459  1.6    lukem 		case QUIT:
    460  1.6    lukem 			die();
    461  1.6    lukem 
    462  1.6    lukem 		default:
    463  1.6    lukem 			puts("How's that?");
    464  1.6    lukem 			return (-1);
    465  1.6    lukem 			break;
    466  1.6    lukem 
    467  1.1      cgd 
    468  1.1      cgd 		}
    469  1.1      cgd 		if (wordnumber < wordcount && *words[wordnumber++] == ',')
    470  1.1      cgd 			continue;
    471  1.6    lukem 		else
    472  1.6    lukem 			return (lflag);
    473  1.6    lukem 	}
    474  1.6    lukem 	return (lflag);
    475  1.1      cgd }
    476