Home | History | Annotate | Line # | Download | only in battlestar
cypher.c revision 1.10
      1  1.10      jsm /*	$NetBSD: cypher.c,v 1.10 1999/09/18 16:41:38 jsm 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.10      jsm __RCSID("$NetBSD: cypher.c,v 1.10 1999/09/18 16:41:38 jsm 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.10      jsm 							/* FALLTHROUGH */
    142   1.8  hubertf 						case NORMGOD:
    143   1.8  hubertf 						case AMULET:
    144   1.8  hubertf 						case MEDALION:
    145   1.8  hubertf 						case TALISMAN:
    146   1.8  hubertf 						case MAN:
    147   1.8  hubertf 						case TIMER:
    148   1.8  hubertf 						case NATIVE:
    149   1.8  hubertf 							wordtype[wordnumber + 1] = NOUNS;
    150   1.8  hubertf 							break;
    151   1.8  hubertf 						default:
    152   1.8  hubertf 							wordtype[wordnumber + 1] = OBJECT;
    153   1.8  hubertf 						}
    154   1.6    lukem 						wordnumber = take(location[position].objects);
    155   1.6    lukem 					}
    156   1.1      cgd 				wordnumber++;
    157   1.1      cgd 				wordnumber++;
    158   1.6    lukem 			} else
    159   1.6    lukem 				take(location[position].objects);
    160   1.6    lukem 			break;
    161   1.6    lukem 
    162   1.6    lukem 		case DROP:
    163   1.6    lukem 
    164   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    165   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    166   1.6    lukem 					if (testbit(inven, n)) {
    167   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    168   1.6    lukem 						wordnumber = drop("Dropped");
    169   1.6    lukem 					}
    170   1.1      cgd 				wordnumber++;
    171   1.1      cgd 				wordnumber++;
    172   1.6    lukem 			} else
    173   1.6    lukem 				drop("Dropped");
    174   1.6    lukem 			break;
    175   1.6    lukem 
    176   1.6    lukem 
    177   1.6    lukem 		case KICK:
    178   1.6    lukem 		case THROW:
    179   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    180   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    181   1.6    lukem 					if (testbit(inven, n) ||
    182   1.7  hubertf 					    (testbit(location[position].objects, n) && objsht[n])) {
    183   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    184   1.6    lukem 						wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
    185   1.6    lukem 					}
    186   1.6    lukem 				wordnumber += 2;
    187   1.6    lukem 			} else
    188   1.6    lukem 				throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
    189   1.6    lukem 			break;
    190   1.6    lukem 
    191   1.6    lukem 		case TAKEOFF:
    192   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    193   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    194   1.6    lukem 					if (testbit(wear, n)) {
    195   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    196   1.6    lukem 						wordnumber = takeoff();
    197   1.6    lukem 					}
    198   1.6    lukem 				wordnumber += 2;
    199   1.6    lukem 			} else
    200   1.6    lukem 				takeoff();
    201   1.6    lukem 			break;
    202   1.1      cgd 
    203   1.1      cgd 
    204   1.6    lukem 		case DRAW:
    205   1.6    lukem 
    206   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    207   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    208   1.6    lukem 					if (testbit(wear, n)) {
    209   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    210   1.6    lukem 						wordnumber = draw();
    211   1.6    lukem 					}
    212   1.6    lukem 				wordnumber += 2;
    213   1.6    lukem 			} else
    214   1.6    lukem 				draw();
    215   1.6    lukem 			break;
    216   1.1      cgd 
    217   1.1      cgd 
    218   1.6    lukem 		case PUTON:
    219   1.6    lukem 
    220   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    221   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    222   1.7  hubertf 					if (testbit(location[position].objects, n) && objsht[n]) {
    223   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    224   1.6    lukem 						wordnumber = puton();
    225   1.6    lukem 					}
    226   1.6    lukem 				wordnumber += 2;
    227   1.6    lukem 			} else
    228   1.6    lukem 				puton();
    229   1.6    lukem 			break;
    230   1.6    lukem 
    231   1.6    lukem 		case WEARIT:
    232   1.6    lukem 
    233   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    234   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    235   1.6    lukem 					if (testbit(inven, n)) {
    236   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    237   1.6    lukem 						wordnumber = wearit();
    238   1.6    lukem 					}
    239   1.6    lukem 				wordnumber += 2;
    240   1.6    lukem 			} else
    241   1.6    lukem 				wearit();
    242   1.6    lukem 			break;
    243   1.1      cgd 
    244   1.1      cgd 
    245   1.6    lukem 		case EAT:
    246   1.6    lukem 
    247   1.6    lukem 			if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
    248   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    249   1.6    lukem 					if (testbit(inven, n)) {
    250   1.6    lukem 						wordvalue[wordnumber + 1] = n;
    251   1.6    lukem 						wordnumber = eat();
    252   1.1      cgd 					}
    253   1.6    lukem 				wordnumber += 2;
    254   1.6    lukem 			} else
    255   1.6    lukem 				eat();
    256   1.6    lukem 			break;
    257   1.6    lukem 
    258   1.6    lukem 
    259   1.6    lukem 		case PUT:
    260   1.6    lukem 			put();
    261   1.6    lukem 			break;
    262   1.6    lukem 
    263   1.6    lukem 
    264   1.6    lukem 		case INVEN:
    265   1.6    lukem 			if (ucard(inven)) {
    266   1.6    lukem 				puts("You are holding:\n");
    267   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    268   1.6    lukem 					if (testbit(inven, n))
    269   1.6    lukem 						printf("\t%s\n", objsht[n]);
    270   1.6    lukem 				printf("\n= %d kilogram%s (%d%%)\n", carrying, (carrying == 1 ? "." : "s."), (WEIGHT ? carrying * 100 / WEIGHT : -1));
    271   1.6    lukem 				printf("Your arms are %d%% full.\n", encumber * 100 / CUMBER);
    272   1.6    lukem 			} else
    273   1.6    lukem 				puts("You aren't carrying anything.");
    274   1.6    lukem 
    275   1.6    lukem 			if (ucard(wear)) {
    276   1.6    lukem 				puts("\nYou are wearing:\n");
    277   1.6    lukem 				for (n = 0; n < NUMOFOBJECTS; n++)
    278   1.6    lukem 					if (testbit(wear, n))
    279   1.6    lukem 						printf("\t%s\n", objsht[n]);
    280   1.6    lukem 			} else
    281   1.6    lukem 				puts("\nYou are stark naked.");
    282   1.6    lukem 			if (card(injuries, NUMOFINJURIES)) {
    283   1.6    lukem 				puts("\nYou have suffered:\n");
    284   1.6    lukem 				for (n = 0; n < NUMOFINJURIES; n++)
    285   1.6    lukem 					if (injuries[n])
    286   1.6    lukem 						printf("\t%s\n", ouch[n]);
    287   1.6    lukem 				printf("\nYou can still carry up to %d kilogram%s\n", WEIGHT, (WEIGHT == 1 ? "." : "s."));
    288   1.6    lukem 			} else
    289   1.6    lukem 				puts("\nYou are in perfect health.");
    290   1.6    lukem 			break;
    291   1.6    lukem 
    292   1.6    lukem 		case USE:
    293   1.6    lukem 			lflag = use();
    294   1.6    lukem 			break;
    295   1.6    lukem 
    296   1.6    lukem 		case LOOK:
    297   1.6    lukem 			if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
    298   1.6    lukem 			    testbit(location[position].objects, LAMPON)
    299   1.6    lukem 			    || matchlight) {
    300   1.6    lukem 				beenthere[position] = 2;
    301   1.6    lukem 				writedes();
    302   1.6    lukem 				printobjs();
    303   1.6    lukem 				if (matchlight) {
    304   1.6    lukem 					puts("\nYour match splutters out.");
    305   1.6    lukem 					matchlight = 0;
    306   1.6    lukem 				}
    307   1.6    lukem 			} else
    308   1.6    lukem 				puts("I can't see anything.");
    309   1.6    lukem 			return (-1);
    310   1.6    lukem 			break;
    311   1.1      cgd 
    312   1.6    lukem 		case SU:
    313   1.6    lukem 			if (wiz || tempwiz) {
    314   1.1      cgd 				printf("\nRoom (was %d) = ", position);
    315   1.6    lukem 				fgets(buffer, 10, stdin);
    316   1.1      cgd 				if (*buffer != '\n')
    317   1.6    lukem 					sscanf(buffer, "%d", &position);
    318   1.5    lukem 				printf("Time (was %d) = ", ourtime);
    319   1.6    lukem 				fgets(buffer, 10, stdin);
    320   1.1      cgd 				if (*buffer != '\n')
    321   1.6    lukem 					sscanf(buffer, "%d", &ourtime);
    322   1.6    lukem 				printf("Fuel (was %d) = ", fuel);
    323   1.6    lukem 				fgets(buffer, 10, stdin);
    324   1.1      cgd 				if (*buffer != '\n')
    325   1.6    lukem 					sscanf(buffer, "%d", &fuel);
    326   1.6    lukem 				printf("Torps (was %d) = ", torps);
    327   1.6    lukem 				fgets(buffer, 10, stdin);
    328   1.1      cgd 				if (*buffer != '\n')
    329   1.6    lukem 					sscanf(buffer, "%d", &torps);
    330   1.6    lukem 				printf("CUMBER (was %d) = ", CUMBER);
    331   1.6    lukem 				fgets(buffer, 10, stdin);
    332   1.1      cgd 				if (*buffer != '\n')
    333   1.6    lukem 					sscanf(buffer, "%d", &CUMBER);
    334   1.6    lukem 				printf("WEIGHT (was %d) = ", WEIGHT);
    335   1.6    lukem 				fgets(buffer, 10, stdin);
    336   1.1      cgd 				if (*buffer != '\n')
    337   1.6    lukem 					sscanf(buffer, "%d", &WEIGHT);
    338   1.5    lukem 				printf("Clock (was %d) = ", ourclock);
    339   1.6    lukem 				fgets(buffer, 10, stdin);
    340   1.1      cgd 				if (*buffer != '\n')
    341   1.6    lukem 					sscanf(buffer, "%d", &ourclock);
    342   1.6    lukem 				printf("Wizard (was %d, %d) = ", wiz, tempwiz);
    343   1.6    lukem 				fgets(buffer, 10, stdin);
    344   1.6    lukem 				if (*buffer != '\n') {
    345   1.6    lukem 					sscanf(buffer, "%d", &junk);
    346   1.1      cgd 					if (!junk)
    347   1.1      cgd 						tempwiz = wiz = 0;
    348   1.1      cgd 				}
    349   1.1      cgd 				printf("\nDONE.\n");
    350   1.6    lukem 				return (0);
    351   1.6    lukem 			} else
    352   1.6    lukem 				puts("You aren't a wizard.");
    353   1.6    lukem 			break;
    354   1.6    lukem 
    355   1.6    lukem 		case SCORE:
    356   1.6    lukem 			printf("\tPLEASURE\tPOWER\t\tEGO\n");
    357   1.6    lukem 			printf("\t%3d\t\t%3d\t\t%3d\n\n", pleasure, power, ego);
    358   1.6    lukem 			printf("This gives you the rating of %s in %d turns.\n", rate(), ourtime);
    359   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);
    360   1.6    lukem 			break;
    361   1.6    lukem 
    362   1.6    lukem 		case KNIFE:
    363   1.6    lukem 		case KILL:
    364   1.6    lukem 			murder();
    365   1.6    lukem 			break;
    366   1.6    lukem 
    367   1.6    lukem 		case UNDRESS:
    368   1.6    lukem 		case RAVAGE:
    369   1.6    lukem 			ravage();
    370   1.6    lukem 			break;
    371   1.6    lukem 
    372   1.6    lukem 		case SAVE:
    373   1.9  hubertf 			printf("\nSave file name (default %s) ",
    374   1.9  hubertf 			       DEFAULT_SAVE_FILE);
    375   1.9  hubertf 			filename = fgetln(stdin, &filename_len);
    376   1.9  hubertf 			if (filename_len == 0
    377   1.9  hubertf 			    || (filename_len == 1 && filename[0] == '\n'))
    378   1.9  hubertf 				rfilename = save_file_name(DEFAULT_SAVE_FILE,
    379   1.9  hubertf 				    strlen(DEFAULT_SAVE_FILE));
    380   1.9  hubertf 			else {
    381   1.9  hubertf 				if (filename[filename_len - 1] == '\n')
    382   1.9  hubertf 					filename_len--;
    383   1.9  hubertf 				rfilename = save_file_name(filename,
    384   1.9  hubertf 							   filename_len);
    385   1.9  hubertf 			}
    386   1.9  hubertf 			save(rfilename);
    387   1.9  hubertf 			free(rfilename);
    388   1.6    lukem 			break;
    389   1.6    lukem 
    390   1.6    lukem 		case FOLLOW:
    391   1.6    lukem 			lflag = follow();
    392   1.6    lukem 			break;
    393   1.6    lukem 
    394   1.6    lukem 		case GIVE:
    395   1.6    lukem 			give();
    396   1.6    lukem 			break;
    397   1.6    lukem 
    398   1.6    lukem 		case KISS:
    399   1.6    lukem 			kiss();
    400   1.6    lukem 			break;
    401   1.6    lukem 
    402   1.6    lukem 		case LOVE:
    403   1.6    lukem 			love();
    404   1.6    lukem 			break;
    405   1.6    lukem 
    406   1.6    lukem 		case RIDE:
    407   1.6    lukem 			lflag = ride();
    408   1.6    lukem 			break;
    409   1.6    lukem 
    410   1.6    lukem 		case DRIVE:
    411   1.6    lukem 			lflag = drive();
    412   1.6    lukem 			break;
    413   1.6    lukem 
    414   1.6    lukem 		case LIGHT:
    415   1.6    lukem 			light();
    416   1.6    lukem 			break;
    417   1.6    lukem 
    418   1.6    lukem 		case LAUNCH:
    419   1.6    lukem 			if (!launch())
    420   1.6    lukem 				return (-1);
    421   1.6    lukem 			else
    422   1.6    lukem 				lflag = 0;
    423   1.6    lukem 			break;
    424   1.6    lukem 
    425   1.6    lukem 		case LANDIT:
    426   1.6    lukem 			if (!land())
    427   1.6    lukem 				return (-1);
    428   1.6    lukem 			else
    429   1.6    lukem 				lflag = 0;
    430   1.6    lukem 			break;
    431   1.6    lukem 
    432   1.6    lukem 		case TIME:
    433   1.6    lukem 			chime();
    434   1.6    lukem 			break;
    435   1.6    lukem 
    436   1.6    lukem 		case SLEEP:
    437   1.6    lukem 			zzz();
    438   1.6    lukem 			break;
    439   1.6    lukem 
    440   1.6    lukem 		case DIG:
    441   1.6    lukem 			dig();
    442   1.6    lukem 			break;
    443   1.6    lukem 
    444   1.6    lukem 		case JUMP:
    445   1.6    lukem 			lflag = jump();
    446   1.6    lukem 			break;
    447   1.6    lukem 
    448   1.6    lukem 		case BURY:
    449   1.6    lukem 			bury();
    450   1.6    lukem 			break;
    451   1.6    lukem 
    452   1.6    lukem 		case SWIM:
    453   1.6    lukem 			puts("Surf's up!");
    454   1.6    lukem 			break;
    455   1.6    lukem 
    456   1.6    lukem 		case DRINK:
    457   1.6    lukem 			drink();
    458   1.6    lukem 			break;
    459   1.6    lukem 
    460   1.6    lukem 		case QUIT:
    461   1.6    lukem 			die();
    462   1.6    lukem 
    463   1.6    lukem 		default:
    464   1.6    lukem 			puts("How's that?");
    465   1.6    lukem 			return (-1);
    466   1.6    lukem 			break;
    467   1.6    lukem 
    468   1.1      cgd 
    469   1.1      cgd 		}
    470   1.1      cgd 		if (wordnumber < wordcount && *words[wordnumber++] == ',')
    471   1.1      cgd 			continue;
    472   1.6    lukem 		else
    473   1.6    lukem 			return (lflag);
    474   1.6    lukem 	}
    475   1.6    lukem 	return (lflag);
    476   1.1      cgd }
    477