}
if (commands == NULL) {
+ VERBOSE (DEBUG, printf ("no command\n"));
hexdump (-1);
} else {
VERBOSE (DEBUG, printf ("commands: %s\n", commands));
case '9': /* read address */
commands--;
addr = strtol (commands, &commands, 10);
- if (addr) {
- rc = gotoaddr (addr);
- } else {
- VERBOSE (ERROR, fprintf (stderr, "erroneous address\n"));
- rc = 1;
- }
+ rc = gotoaddr (addr);
break;
case 'a': /* append mode */
}
}
}
- if ((seq.length > 0) && (rc == 0)) {
+ if ((seq.length > 0) && (rc == 0) && (i % 2 == 0)) {
rc = insertseq (&seq);
} else {
VERBOSE (ERROR, fprintf (stderr, "erroneous sequence '%s'\n", seq.sequence));
// test: hexdump.exe -i hexdump.c -e ' //' 2>&1 | grep -q 'incorrect sequence'
// test: hexdump.exe -i hexdump.c -e 'foo' 2>&1 | grep -q 'unknown command'
// test: hexdump.exe -i hexdump.c -e '0x20 p 8 64 p 8 0200 p 16' | grep -q '0x0080:'
+// test: hexdump.exe -i hexdump.c -e '0xg' 2>&1 | grep -q 'erroneous address'
+// test: hexdump.exe -i hexdump.c -o test.c -e ' /cflags/ a 414e5a /link/ i 2F333B'
+// test: grep -q ANZcflags test.c && grep -q 'link/3;er' test.c; x=$?; rm test.c; test x$x = x0
+// test: hexdump.exe -i hexdump.c -e ' /cflags/ a 414e5' 2>&1 | grep 'erroneous sequence'
/* vim: set ts=4 sw=4 et: */