5 static struct option longopts[] = {
6 {"arithmetic", no_argument, NULL, 'a'},
7 {"logical", no_argument, NULL, 'l'},
8 {"help", no_argument, NULL, 'h'},
12 CERRARRAY cerr_dumpword[] = {
13 { 114, "not integer" },
15 { 116, "out of hex range" },
18 int main(int argc, char *argv[])
20 bool logicalmode = false; /* レジストリの内容を論理値(0〜65535)で表示する場合はtrue */
23 const char *usage = "Usage: %s [-alh] WORD\n";
25 while((opt = getopt_long(argc, argv, "alh", longopts, NULL)) != -1) {
31 fprintf(stdout, usage, argv[0]);
34 fprintf(stderr, usage, argv[0]);
39 if(argv[optind] == NULL) {
40 fprintf(stderr, usage, argv[0]);
43 /* エラーリストにerr_casl2を追加 */
44 addcerrlist(ARRAYSIZE(cerr_dumpword), cerr_dumpword);
46 word = nh2word(argv[optind]);
48 fprintf(stderr, "Dumpword Error - %d: %s\n", cerrno, cerrmsg);
51 fprintf(stdout, "%6s: ", argv[optind]);
52 print_dumpword(word, logicalmode);