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
This commit is contained in:
bsd 2001-01-13 20:12:08 +00:00
parent c7a592164b
commit ca7d4f0957
1 changed files with 10 additions and 8 deletions

View File

@ -872,7 +872,7 @@ int ihex2b ( char * infile, FILE * inf,
if (rectype != 0) { if (rectype != 0) {
fprintf(stderr, fprintf(stderr,
"%s: don't know how to deal with rectype=%d " "%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); progname, rectype, lineno, infile);
exit(1); exit(1);
} }
@ -1057,10 +1057,11 @@ int fileio ( int op, char * filename, int format,
} }
} }
else { else {
f = fopen(filename, fio.mode); fname = filename;
f = fopen(fname, fio.mode);
if (f == NULL) { if (f == NULL) {
fprintf(stderr, "%s: can't open %s file %s: %s\n", 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; return -2;
} }
} }
@ -1475,13 +1476,14 @@ int main ( int argc, char * argv [] )
*/ */
fprintf(stderr, "%s: writing %s:\n", fprintf(stderr, "%s: writing %s:\n",
progname, memtypestr(memtype)); progname, memtypestr(memtype));
#if 1 #if 0
rc = avr_write ( fd, memtype, p ); rc = avr_write ( fd, memtype, p );
#else #else
if (memtype == AVR_FLASH) /*
b2ihex ( p->flash, p->flash_size, 32, 0, "<stdout>", stdout); * test mode, don't actually write to the chip, output the buffer
else * to stdout in intel hex instead
b2ihex ( p->eeprom, p->eeprom_size, 32, 0, "<stdout>", stdout); */
fileio(FIO_WRITE, "-", FMT_IHEX, p, memtype);
#endif #endif
if (rc) { if (rc) {
fprintf ( stderr, "%s: failed to write flash memory, rc=%d\n", fprintf ( stderr, "%s: failed to write flash memory, rc=%d\n",