From 76bc5de900f936cbc7141eadf218d874b2261d58 Mon Sep 17 00:00:00 2001 From: mycroft Date: Fri, 3 Dec 1993 10:12:57 +0000 Subject: Restructure a switch to eliminate a compiler warning. --- worm/worm.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'worm') 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; -- cgit v1.2.3-56-ge451