X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=hexdump.c;fp=hexdump.c;h=b168c0f5ea4ba5148ff586ecd3c2265ded82c040;hb=3bf29ac656a0c8be972b205005bd2fb18815ab2e;hp=d606a121ac3ee4b8263b4a236200e19d29fbbf81;hpb=9e439809c90f266db841a7c1bd35b41072921bf9;p=hexdump.git diff --git a/hexdump.c b/hexdump.c index d606a12..b168c0f 100644 --- a/hexdump.c +++ b/hexdump.c @@ -449,6 +449,7 @@ int main (int argc, char *argv[]) } if (commands == NULL) { + VERBOSE (DEBUG, printf ("no command\n")); hexdump (-1); } else { VERBOSE (DEBUG, printf ("commands: %s\n", commands)); @@ -506,12 +507,7 @@ int main (int argc, char *argv[]) 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 */ @@ -546,7 +542,7 @@ int main (int argc, char *argv[]) } } } - 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)); @@ -632,5 +628,9 @@ int main (int argc, char *argv[]) // 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: */