5 int compare_code(const void *a, const void *b)
7 const CMDTYPECODE ca = **(const CMDTYPECODE **)a;
8 const CMDTYPECODE cb = **(const CMDTYPECODE **)b;
10 if((diff = strcmp(ca.cmd, cb.cmd)) == 0) {
11 return ca.type - cb.type;
17 /* 命令と命令タイプがキーのハッシュ表を表示する */
18 void print_cmdtype_code()
23 ar = malloc(sizeof(*ar) * cmdtypecodesize);
24 for(i = 0; i < cmdtabsize; i++) {
27 ar[j++] = np->cmdtypecode;
31 qsort(ar, cmdcodesize, sizeof(*ar), (int (*)(const void*, const void*))compare_code);
32 for(i = 0; i < cmdcodesize; i++) {
33 fprintf(stdout, "%s\t0%02o\t#%04X\n", ar[i]->cmd, ar[i]->type, ar[i]->code);
40 cerr = malloc_chk(sizeof(CERR), "cerr");
42 create_cmdtype_code();
48 printf("\terror - %d: %s\n", cerr->num, cerr->msg);