From ca7d4f0957f10473a573e62264165d8046f9f0d2 Mon Sep 17 00:00:00 2001 From: bsd Date: Sat, 13 Jan 2001 20:12:08 +0000 Subject: [PATCH] Fix filename assignment error. Clean up debugging code a little, utilize fileio() instead of making direct calls to b2ihex(). git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@21 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrprog.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/avrprog.c b/avrprog.c index 08e03b8f..93e894ab 100644 --- a/avrprog.c +++ b/avrprog.c @@ -872,7 +872,7 @@ int ihex2b ( char * infile, FILE * inf, if (rectype != 0) { fprintf(stderr, "%s: don't know how to deal with rectype=%d " - "at line %d of \"%s\"\n", + "at line %d of %s\n", progname, rectype, lineno, infile); exit(1); } @@ -1057,10 +1057,11 @@ int fileio ( int op, char * filename, int format, } } else { - f = fopen(filename, fio.mode); + fname = filename; + f = fopen(fname, fio.mode); if (f == NULL) { fprintf(stderr, "%s: can't open %s file %s: %s\n", - progname, fio.iodesc, filename, strerror(errno)); + progname, fio.iodesc, fname, strerror(errno)); return -2; } } @@ -1475,13 +1476,14 @@ int main ( int argc, char * argv [] ) */ fprintf(stderr, "%s: writing %s:\n", progname, memtypestr(memtype)); -#if 1 +#if 0 rc = avr_write ( fd, memtype, p ); #else - if (memtype == AVR_FLASH) - b2ihex ( p->flash, p->flash_size, 32, 0, "", stdout); - else - b2ihex ( p->eeprom, p->eeprom_size, 32, 0, "", stdout); + /* + * test mode, don't actually write to the chip, output the buffer + * to stdout in intel hex instead + */ + fileio(FIO_WRITE, "-", FMT_IHEX, p, memtype); #endif if (rc) { fprintf ( stderr, "%s: failed to write flash memory, rc=%d\n",