char command[MAX_CONTENT];
int x,y,z;
info info;
+ char *ptr;
/* default values */
x=_X;
info.dr_ac=DR_AC;
strncpy(command,input->content,MAX_CONTENT);
+ ptr=command;
- strtok(command," ");
- while(strtok(NULL," ")!=NULL) {
- switch(command[0]) {
+ ptr=strtok(command," ");
+ while((ptr=strtok(NULL," "))!=NULL) {
+ switch(ptr[0]) {
case 'b':
- info.b=atof(command+1);
+ info.b=atof(ptr+1);
break;
case 'c':
- info.c=atof(command+1);
+ info.c=atof(ptr+1);
break;
case 's':
- info.s=atof(command+1);
+ info.s=atof(ptr+1);
break;
case 'd':
- info.diff_rate=atoi(command+1);
+ info.diff_rate=atoi(ptr+1);
break;
case 'D':
- info.dr_ac=atof(command+1);
+ info.dr_ac=atof(ptr+1);
break;
case 'S':
- info.steps=atoi(command+1);
+ info.steps=atoi(ptr+1);
break;
case 'C':
- info.cpi=atoi(command+1);
+ info.cpi=atoi(ptr+1);
break;
case 'r':
- info.range=atoi(command+1);
+ info.range=atoi(ptr+1);
break;
case 'R':
- info.s_rate=atoi(command+1);
+ info.s_rate=atoi(ptr+1);
break;
case 'x':
- info.save_rate=atoi(command+1);
+ info.save_rate=atoi(ptr+1);
break;
case 'X':
- x=atoi(command+1);
+ x=atoi(ptr+1);
break;
case 'Y':
- y=atoi(command+1);
+ y=atoi(ptr+1);
break;
case 'Z':
- z=atoi(command+1);
+ z=atoi(ptr+1);
break;
default:
display_new_line(display,input,"unknown command");
+ dprintf(display->outfd,"unknown command %s\n",ptr);
break;
}
}
network_send_chan(net,0,(unsigned char *)&info,sizeof(info));
+ display_new_line(display,input,"added new job:");
+ snprintf(command,MAX_CONTENT,"b:%f | c:%f | s:%f | d: %d %f | %d",
+ info.b,info.c,info.s,info.diff_rate,info.dr_ac,info.steps);
+ display_new_line(display,input,command);
+
+
return 1;
}