Implement -U filename as a shorthand for -U flash:w:filename:a.

This has once been suggested by Brian Dean.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@655 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
joerg_wunsch 2006-09-08 21:52:45 +00:00
parent 92cbfc744a
commit 8ebe96ee2b
4 changed files with 34 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2006-09-08 Joerg Wunsch <j@uriah.heep.sax.de>
* main.c: Implement -U filename as a shorthand for
-U flash:w:filename:a.
* avrdude.1: Document this.
* doc/avrdude.texi: (Ditto.)
2006-09-08 Joerg Wunsch <j@uriah.heep.sax.de> 2006-09-08 Joerg Wunsch <j@uriah.heep.sax.de>
Implement numerical output formats for decimal, hexadecimal, Implement numerical output formats for decimal, hexadecimal,

View File

@ -534,6 +534,14 @@ contains a colon, the
field is no longer optional since the filename part following the colon field is no longer optional since the filename part following the colon
would otherwise be misinterpreted as would otherwise be misinterpreted as
.Ar format . .Ar format .
.Pp
As an abbreviation, the form
.Fl U Ar filename
is equivalent to specifying
.Fl U Em flash:w: Ns Ar filename Ns :a .
This will only work if
.Ar filename
does not have a colon in it.
.It Fl v .It Fl v
Enable verbose output. Enable verbose output.
.It Fl V .It Fl V

View File

@ -775,6 +775,11 @@ Note that if @var{filename} contains a colon, the @var{format} field is
no longer optional since the filename part following the colon would no longer optional since the filename part following the colon would
otherwise be misinterpreted as @var{format}. otherwise be misinterpreted as @var{format}.
As an abbreviation, the form @code{-U} @var{filename}
is equivalent to specifying
@code{-U} @emph{flash:w:}@var{filename}@emph{:a}.
This will only work if @var{filename} does not have a colon in it.
@item -v @item -v
Enable verbose output. Enable verbose output.

17
main.c
View File

@ -338,9 +338,20 @@ UPDATE * parse_op(char * s)
buf[i++] = *p++; buf[i++] = *p++;
if (*p != ':') { if (*p != ':') {
fprintf(stderr, "%s: invalid update specification\n", progname); upd->memtype = (char *)malloc(strlen("flash")+1);
free(upd); if (upd->memtype == NULL) {
return NULL; outofmem:
fprintf(stderr, "%s: out of memory\n", progname);
exit(1);
}
strcpy(upd->memtype, "flash");
upd->op = DEVICE_WRITE;
upd->filename = (char *)malloc(strlen(buf) + 1);
if (upd->filename == NULL)
goto outofmem;
strcpy(upd->filename, buf);
upd->format = FMT_AUTO;
return upd;
} }
buf[i] = 0; buf[i] = 0;