12 static struct option longopts[] = {
13 { "arithmetic", no_argument, NULL, 'a' },
14 { "logical", no_argument, NULL, 'l' },
15 { "version", no_argument, NULL, 'v' },
16 { "help", no_argument, NULL, 'h' },
23 int main(int argc, char *argv[])
25 bool logicalmode = false; /* レジストリの内容を論理値(0から65535)で表示する場合はtrue */
28 const char *version = PACKAGE_VERSION, *cmdversion = "dumpword of YACASL2 version %s\n";
29 const char *usage = "Usage: %s [-alh] WORD\n";
33 while((opt = getopt_long(argc, argv, "alvh", longopts, NULL)) != -1) {
39 fprintf(stdout, cmdversion, version);
42 fprintf(stdout, usage, argv[0]);
45 fprintf(stderr, usage, argv[0]);
50 if(argv[optind] == NULL) {
51 fprintf(stderr, usage, argv[0]);
55 word = nh2word(argv[optind]);
57 fprintf(stderr, "Dumpword Error - %d: %s\n", cerr->num, cerr->msg);
60 fprintf(stdout, "%6s: ", argv[optind]);
61 print_dumpword(word, logicalmode);