int debug_flags_set(const char *flagname) { struct flag_info *i; if(!strcmp(flagname,"clear")) { debug_flags_clear(); return 1; } for(i = table; i->name; i++) { if(!strcmp(flagname, i->name)) { debug_flags |= i->flag; return 1; } } return 0; }
static INT64_T do_debug(int argc, char **argv) { if(argv[1]) { if(debug_flags_set(argv[1])) { return 0; } else { printf("Valid debugging flags are: "); debug_flags_print(stdout); printf("\n"); errno = EINVAL; return -1; } } else { debug_flags_clear(); return 0; } }