From 3bf29ac656a0c8be972b205005bd2fb18815ab2e Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Fri, 13 Jan 2023 23:43:49 +0100 Subject: [PATCH] test complited --- hexdump.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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: */ -- 2.30.2