8 static struct option longopts[] = {
9 { "arithmetic", no_argument, NULL, 'a' },
10 { "logical", no_argument, NULL, 'l' },
11 { "help", no_argument, NULL, 'h' },
18 int main(int argc, char *argv[])
20 bool logicalmode = false; /* レジストリの内容を論理値(0から65535)で表示する場合はtrue */
23 const char *usage = "Usage: %s [-alh] WORD\n";
26 while((opt = getopt_long(argc, argv, "alh", longopts, NULL)) != -1) {
32 fprintf(stdout, usage, argv[0]);
35 fprintf(stderr, usage, argv[0]);
40 if(argv[optind] == NULL) {
41 fprintf(stderr, usage, argv[0]);
45 word = nh2word(argv[optind]);
47 fprintf(stderr, "Dumpword Error - %d: %s\n", cerr->num, cerr->msg);
50 fprintf(stdout, "%6s: ", argv[optind]);
51 print_dumpword(word, logicalmode);