215 |
|
VIEW vparams; |
216 |
|
char cmd[128]; |
217 |
|
register char *args; |
218 |
< |
register int cmdno; |
218 |
> |
register int i; |
219 |
|
|
220 |
|
if (fgets(cmd, sizeof(cmd), sstdin) == NULL) |
221 |
|
return(DC_QUIT); |
225 |
|
*args++ = '\0'; |
226 |
|
if (!*cmd) |
227 |
|
return(DC_RESUME); |
228 |
< |
for (cmdno = 0; cmdno < DC_NCMDS; cmdno++) |
229 |
< |
if (!strcmp(cmd, cmdlist[cmdno])) |
228 |
> |
if (*args && args[i=strlen(args)-1] == '\n') |
229 |
> |
args[i] = '\0'; |
230 |
> |
for (i = 0; i < DC_NCMDS; i++) |
231 |
> |
if (!strcmp(cmd, cmdlist[i])) |
232 |
|
break; |
233 |
< |
if (cmdno >= DC_NCMDS) { |
233 |
> |
if (i >= DC_NCMDS) { |
234 |
|
sprintf(errmsg, "unknown command: %s", cmd); |
235 |
|
error(COMMAND, errmsg); |
236 |
|
return(-1); |
237 |
|
} |
238 |
< |
switch (cmdno) { |
238 |
> |
switch (i) { |
239 |
|
case DC_SETVIEW: /* set the view */ |
240 |
|
copystruct(&vparams, &odev.v); |
241 |
|
if (!sscanview(&vparams, args)) |
256 |
|
default: |
257 |
|
error(CONSISTENCY, "bad command id in usr_input"); |
258 |
|
} |
259 |
< |
return(cmdno); |
258 |
< |
|
259 |
> |
return(i); |
260 |
|
} |
261 |
|
|
262 |
|
|