5 static struct option longopts[] = {
6 {"arithmetic", no_argument, NULL, 'a'},
7 {"logical", no_argument, NULL, 'l'},
8 {"help", no_argument, NULL, 'h'},
12 int main(int argc, char *argv[])
14 bool logicalmode = false; /* レジストリの内容を論理値(0〜65535)で表示する場合はtrue */
17 const char *usage = "Usage: %s [-alh] WORD\n";
19 cerr = malloc_chk(sizeof(CERR), "cerr");
20 while((opt = getopt_long(argc, argv, "alh", longopts, NULL)) != -1) {
26 fprintf(stdout, usage, argv[0]);
29 fprintf(stderr, usage, argv[0]);
34 if(argv[optind] == NULL) {
35 fprintf(stderr, usage, argv[0]);
39 word = nh2word(argv[optind]);
41 fprintf(stderr, "Dumpword Error - %d: %s\n", cerr->num, cerr->msg);
44 fprintf(stdout, "%6s: ", argv[optind]);
45 print_dumpword(word, logicalmode);