ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rhdisp.c
(Generate patch)

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.10 by gregl, Mon Dec 8 18:51:15 1997 UTC vs.
Revision 3.11 by gregl, Tue Dec 9 17:12:15 1997 UTC

# Line 215 | Line 215 | usr_input()                    /* get user input and process it */
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);
# Line 225 | Line 225 | usr_input()                    /* get user input and process it */
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))
# Line 254 | Line 256 | usr_input()                    /* get user input and process it */
256          default:
257                  error(CONSISTENCY, "bad command id in usr_input");
258          }
259 <        return(cmdno);
258 <                
259 >        return(i);
260   }
261  
262  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines