Merge pull request #1042 from dl8dtl/fix_1041
Handle invalid -U file format specifiers for input
This commit is contained in:
commit
bdfeb0ad34
|
@ -736,14 +736,17 @@ fuse bit settings.
|
|||
hexadecimal; each value will get the string
|
||||
.Em 0x
|
||||
prepended.
|
||||
Only valid on output.
|
||||
.It Ar o
|
||||
octal; each value will get a
|
||||
.Em 0
|
||||
prepended unless it is less than 8 in which case it gets no prefix.
|
||||
Only valid on output.
|
||||
.It Ar b
|
||||
binary; each value will get the string
|
||||
.Em 0b
|
||||
prepended.
|
||||
Only valid on output.
|
||||
.El
|
||||
.Pp
|
||||
The default is to use auto detection for input files, and raw binary
|
||||
|
|
|
@ -809,13 +809,16 @@ fuse bit settings.
|
|||
|
||||
@item h
|
||||
hexadecimal; each value will get the string @emph{0x} prepended.
|
||||
Only valid on output.
|
||||
|
||||
@item o
|
||||
octal; each value will get a @emph{0}
|
||||
prepended unless it is less than 8 in which case it gets no prefix.
|
||||
Only valid on output.
|
||||
|
||||
@item b
|
||||
binary; each value will get the string @emph{0b} prepended.
|
||||
Only valid on output.
|
||||
|
||||
@end table
|
||||
|
||||
|
|
19
src/fileio.c
19
src/fileio.c
|
@ -1157,6 +1157,13 @@ static int fileio_imm(struct fioparms * fio,
|
|||
rc = loc;
|
||||
}
|
||||
break;
|
||||
|
||||
case FIO_WRITE:
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: Invalid file format 'immediate' for output\n",
|
||||
progname);
|
||||
return -1;
|
||||
|
||||
default:
|
||||
avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n",
|
||||
progname, fio->op);
|
||||
|
@ -1271,27 +1278,32 @@ static int fileio_num(struct fioparms * fio,
|
|||
FILEFMT fmt)
|
||||
{
|
||||
const char *prefix;
|
||||
const char *name;
|
||||
char cbuf[20];
|
||||
int base, i, num;
|
||||
|
||||
switch (fmt) {
|
||||
case FMT_HEX:
|
||||
name = "hex";
|
||||
prefix = "0x";
|
||||
base = 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
case FMT_DEC:
|
||||
name = "decimal";
|
||||
prefix = "";
|
||||
base = 10;
|
||||
break;
|
||||
|
||||
case FMT_OCT:
|
||||
name = "octal";
|
||||
prefix = "0";
|
||||
base = 8;
|
||||
break;
|
||||
|
||||
case FMT_BIN:
|
||||
name = "binary";
|
||||
prefix = "0b";
|
||||
base = 2;
|
||||
break;
|
||||
|
@ -1301,6 +1313,13 @@ static int fileio_num(struct fioparms * fio,
|
|||
switch (fio->op) {
|
||||
case FIO_WRITE:
|
||||
break;
|
||||
|
||||
case FIO_READ:
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: Invalid file format '%s' for input\n",
|
||||
progname, name);
|
||||
return -1;
|
||||
|
||||
default:
|
||||
avrdude_message(MSG_INFO, "%s: fileio: invalid operation=%d\n",
|
||||
progname, fio->op);
|
||||
|
|
|
@ -354,6 +354,7 @@ int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd, enum updateflags f
|
|||
progname, mem->desc, alias_mem_desc);
|
||||
|
||||
report_progress(0, 1, "Reading");
|
||||
|
||||
rc = avr_read(pgm, p, upd->memtype, 0);
|
||||
report_progress(1, 1, NULL);
|
||||
if (rc < 0) {
|
||||
|
|
Loading…
Reference in New Issue