]> www.hackdaworld.org Git - physik/nlsop.git/commitdiff
gui parsing input fixes
authorhackbard <hackbard>
Mon, 8 Nov 2004 10:13:55 +0000 (10:13 +0000)
committerhackbard <hackbard>
Mon, 8 Nov 2004 10:13:55 +0000 (10:13 +0000)
nlsop_gui.c

index 94e9fd85eccb2c263d8b13999b5c212a5f04255b..ec9de6d160dd72dfe34e7f782af773882501d2a1 100644 (file)
@@ -145,6 +145,7 @@ int send_job(t_net *net,t_input *input,t_display *display) {
   char command[MAX_CONTENT];
   int x,y,z;
   info info;
+  char *ptr;
 
   /* default values */
   x=_X;
@@ -163,51 +164,53 @@ int send_job(t_net *net,t_input *input,t_display *display) {
   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;
     }
   }
@@ -221,6 +224,12 @@ int send_job(t_net *net,t_input *input,t_display *display) {
 
   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;
 }