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