Add a newline before exiting due to command line errors. Perform a
bit more option compatibility testing between -c, -i, and -o. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@27 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
e6950275d9
commit
4624fdbfa8
19
avrprog.c
19
avrprog.c
|
@ -1331,7 +1331,7 @@ int main ( int argc, char * argv [] )
|
|||
memtype = AVR_FLASH;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "%s: invalid memory type \"%s\"\n",
|
||||
fprintf(stderr, "%s: invalid memory type \"%s\"\n\n",
|
||||
progname, optarg);
|
||||
usage();
|
||||
exit(1);
|
||||
|
@ -1344,8 +1344,8 @@ int main ( int argc, char * argv [] )
|
|||
break;
|
||||
|
||||
case 'o': /* specify output file */
|
||||
if (inputf) {
|
||||
fprintf(stderr,"%s: -i and -o are incompatible\n", progname);
|
||||
if (inputf || interactive) {
|
||||
fprintf(stderr,"%s: -i, -o, and -c are incompatible\n\n", progname);
|
||||
return 1;
|
||||
}
|
||||
doread = 1;
|
||||
|
@ -1377,8 +1377,8 @@ int main ( int argc, char * argv [] )
|
|||
break;
|
||||
|
||||
case 'i': /* specify input file */
|
||||
if (outputf) {
|
||||
fprintf(stderr,"%s: -o and -i are incompatible\n", progname);
|
||||
if (outputf || interactive) {
|
||||
fprintf(stderr,"%s: -o, -i, and -c are incompatible\n\n", progname);
|
||||
return 1;
|
||||
}
|
||||
doread = 0;
|
||||
|
@ -1397,12 +1397,13 @@ int main ( int argc, char * argv [] )
|
|||
case 'i' : filefmt = FMT_IHEX; break;
|
||||
case 'r' : filefmt = FMT_RBIN; break;
|
||||
case 's' :
|
||||
fprintf(stderr, "%s: Motorola S-Record format not yet supported\n",
|
||||
fprintf(stderr,
|
||||
"%s: Motorola S-Record format not yet supported\n\n",
|
||||
progname);
|
||||
exit(1);
|
||||
break;
|
||||
default :
|
||||
fprintf(stderr, "%s: invalid file format \"%s\"\n",
|
||||
fprintf(stderr, "%s: invalid file format \"%s\"\n\n",
|
||||
progname, optarg);
|
||||
usage();
|
||||
exit(1);
|
||||
|
@ -1412,7 +1413,7 @@ int main ( int argc, char * argv [] )
|
|||
case 'c': /* enter interactive command mode */
|
||||
if (!((inputf == NULL)||(outputf == NULL))) {
|
||||
fprintf(stderr,
|
||||
"%s: interactive mode is not compatible with -i or -o\n",
|
||||
"%s: interactive mode is not compatible with -i or -o\n\n",
|
||||
progname);
|
||||
usage();
|
||||
exit(1);
|
||||
|
@ -1430,7 +1431,7 @@ int main ( int argc, char * argv [] )
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: invalid option -%c\n", progname, ch);
|
||||
fprintf(stderr, "%s: invalid option -%c\n\n", progname, ch);
|
||||
usage();
|
||||
exit(1);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue