void parse_input (Tree *T, char *token) { void *check = NULL; int parameter = atoi(token + 1); char instruction[INSTRUCTION]; instruction[1] = '\0'; instruction[0] = toupper((int)token[0]); if (parameter == 0) { ERROR ("A key of integer value zero is not allowed."); } printf("\nReceived: instruction=%s, parameter=%d.\n", instruction,parameter); int *vptr = ¶meter; if (strsame(instruction, "S")) { check = find (T, vptr); if (check) { fprintf (stderr, "Node with key %d was found in the tree.\n", *((int*)check)); } else { fprintf (stderr, "Node with key %d was NOT found in the tree.\n", parameter); check = vptr; } } else if (strsame(instruction, "I")) { check = insert_control (T, vptr); if (check) { fprintf (stderr, "Node with key %d successfully inserted in the tree.\n", *((int*)check)); } } else if (strsame(instruction, "D")) { check = delete_control (T, vptr); if (check) { fprintf (stderr, "Node with key %d successfully deleted from the tree.\n", *((int*)check)); } } if (check == NULL) { fprintf (stderr, "Node with key %d is already in the tree.\n", parameter); } }
int fly_with_route(route_t *route) { printw("create route control...\n"); control_t *control = route_control_create(route); printw("create control success...\n"); if (control == NULL) return -1; printw("flying .."); int ret = fly_with_control_packet(control);//start* end? delete_control(control); return ret; }