static int cmd_d(char*args){ char*arg = strtok(NULL," "); int number = atoi(arg); if(number<=0){ printf("argument is illegal!\n"); return 0; } free_wp(number); return 0; }
bool free_wp_caller(int num) { WP *ph = head; while (ph) { if (ph->NO == num) { free_wp(ph); return true; } ph = ph->next; } return false; }
static int cmd_d(char *args) { int n = atoi(args); if(n < 0 || n >= 32) { printf("Args Error\n"); return 0; } free_wp(&(wp_list[n])); return 0; }
static int cmd_d(char *args) { bool *flag = malloc(sizeof(bool)); int no = expr(args, flag); WP* temp = head; while(temp != NULL){ if(temp->NO == no){ free_wp(temp); printf("Delete watchpoint NO:%d\n", temp->NO); break; } temp = temp->next; } return 0; }
static int cmd_d(char *args){ if(args == NULL){ printf("Please input a number!\n"); return 0; } int num; if( sscanf(args, "%d", &num) == 0 ){ printf("Not a number!\n"); return 0; } if( num < 0 || num >= 32 ){ printf("n must be smaller than 32 and no smaller than 0\n"); return 0; } free_wp(num); return 0; }
static int cmd_del_watch(char *args) { if (args==NULL) { printf("error info format [info r/info w]\n"); return 1; } uint8_t n; n=atoi(args); if (n>31){ printf("no such watch point, number is too big\n"); return 1; } free_wp(n); return 0; }
static int cmd_d(char *args) { if (args==NULL){ loop: printf("Delete all watchpoints? (y or n)"); char s[10]; fflush(stdin); scanf("%s",s); if (strcmp(s,"y")==0||strcmp(s,"Y")==0){ free_all_wp(); return 0; } else if (strcmp(s,"n")==0||strcmp(s,"N")==0){ return 0; }else{ printf("Pleas answer y or n.\n"); goto loop; } } int no=atoi(args); free_wp(no); return 0; }