diff options
author | mycroft <mycroft@NetBSD.org> | 1993-12-03 10:12:57 +0000 |
---|---|---|
committer | mycroft <mycroft@NetBSD.org> | 1993-12-03 10:12:57 +0000 |
commit | 76bc5de900f936cbc7141eadf218d874b2261d58 (patch) | |
tree | 18ab8efa2f1682c41a69de1bede5807bf459de40 /worm | |
parent | dc8288f25acaefcb350da2bb4adda4053aa7d0a8 (diff) | |
download | bsdgames-darwin-76bc5de900f936cbc7141eadf218d874b2261d58.tar.gz bsdgames-darwin-76bc5de900f936cbc7141eadf218d874b2261d58.tar.zst bsdgames-darwin-76bc5de900f936cbc7141eadf218d874b2261d58.zip |
Restructure a switch to eliminate a compiler warning.
Diffstat (limited to 'worm')
-rw-r--r-- | worm/worm.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/worm/worm.c b/worm/worm.c index 05671d49..f0ea1c95 100644 --- a/worm/worm.c +++ b/worm/worm.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)worm.c 5.8 (Berkeley) 2/28/91";*/ -static char rcsid[] = "$Id: worm.c,v 1.3 1993/08/10 02:05:36 mycroft Exp $"; +static char rcsid[] = "$Id: worm.c,v 1.4 1993/12/03 10:12:57 mycroft Exp $"; #endif /* not lint */ /* @@ -56,8 +56,6 @@ static char rcsid[] = "$Id: worm.c,v 1.3 1993/08/10 02:05:36 mycroft Exp $"; #define BODY 'o' #define LENGTH 7 #define RUNLEN 8 -#define when break;case -#define otherwise break;default #define CNTRL(p) (p-'A'+1) #ifndef baudrate # define baudrate() _tty.sg_ospeed @@ -211,19 +209,19 @@ char ch; y = head->y; switch(ch) { - when 'h': x--; - when 'j': y++; - when 'k': y--; - when 'l': x++; - when 'H': x--; running = RUNLEN; ch = tolower(ch); - when 'J': y++; running = RUNLEN/2; ch = tolower(ch); - when 'K': y--; running = RUNLEN/2; ch = tolower(ch); - when 'L': x++; running = RUNLEN; ch = tolower(ch); - when '\f': setup(); return; - when CNTRL('Z'): suspend(); return; - when CNTRL('C'): crash(); return; - when CNTRL('D'): crash(); return; - otherwise: if (! running) alarm(1); + case 'h': x--; break; + case 'j': y++; break; + case 'k': y--; break; + case 'l': x++; break; + case 'H': x--; running = RUNLEN; ch = tolower(ch); break; + case 'J': y++; running = RUNLEN/2; ch = tolower(ch); break; + case 'K': y--; running = RUNLEN/2; ch = tolower(ch); break; + case 'L': x++; running = RUNLEN; ch = tolower(ch); break; + case '\f': setup(); return; + case CNTRL('Z'): suspend(); return; + case CNTRL('C'): crash(); return; + case CNTRL('D'): crash(); return; + default: if (! running) alarm(1); return; } lastch = ch; |