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 while((opt = getopt_long(argc, argv, "alh", longopts, NULL)) != -1) {
25 fprintf(stdout, usage, argv[0]);
28 fprintf(stderr, usage, argv[0]);
33 if(argv[optind] == NULL) {
34 fprintf(stderr, usage, argv[0]);
38 word = nh2word(argv[optind]);
40 fprintf(stderr, "Dumpword Error - %d: %s\n", cerrno, cerrmsg);
43 fprintf(stdout, "%6s: ", argv[optind]);
44 print_dumpword(word, logicalmode);