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@27 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
1729c5ab2f
commit
a0adf5cd4f
|
@ -1331,7 +1331,7 @@ int main ( int argc, char * argv [] )
|
||||||
memtype = AVR_FLASH;
|
memtype = AVR_FLASH;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "%s: invalid memory type \"%s\"\n",
|
fprintf(stderr, "%s: invalid memory type \"%s\"\n\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -1344,8 +1344,8 @@ int main ( int argc, char * argv [] )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o': /* specify output file */
|
case 'o': /* specify output file */
|
||||||
if (inputf) {
|
if (inputf || interactive) {
|
||||||
fprintf(stderr,"%s: -i and -o are incompatible\n", progname);
|
fprintf(stderr,"%s: -i, -o, and -c are incompatible\n\n", progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
doread = 1;
|
doread = 1;
|
||||||
|
@ -1377,8 +1377,8 @@ int main ( int argc, char * argv [] )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i': /* specify input file */
|
case 'i': /* specify input file */
|
||||||
if (outputf) {
|
if (outputf || interactive) {
|
||||||
fprintf(stderr,"%s: -o and -i are incompatible\n", progname);
|
fprintf(stderr,"%s: -o, -i, and -c are incompatible\n\n", progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
doread = 0;
|
doread = 0;
|
||||||
|
@ -1397,12 +1397,13 @@ int main ( int argc, char * argv [] )
|
||||||
case 'i' : filefmt = FMT_IHEX; break;
|
case 'i' : filefmt = FMT_IHEX; break;
|
||||||
case 'r' : filefmt = FMT_RBIN; break;
|
case 'r' : filefmt = FMT_RBIN; break;
|
||||||
case 's' :
|
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);
|
progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
fprintf(stderr, "%s: invalid file format \"%s\"\n",
|
fprintf(stderr, "%s: invalid file format \"%s\"\n\n",
|
||||||
progname, optarg);
|
progname, optarg);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -1412,7 +1413,7 @@ int main ( int argc, char * argv [] )
|
||||||
case 'c': /* enter interactive command mode */
|
case 'c': /* enter interactive command mode */
|
||||||
if (!((inputf == NULL)||(outputf == NULL))) {
|
if (!((inputf == NULL)||(outputf == NULL))) {
|
||||||
fprintf(stderr,
|
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);
|
progname);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -1430,7 +1431,7 @@ int main ( int argc, char * argv [] )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s: invalid option -%c\n", progname, ch);
|
fprintf(stderr, "%s: invalid option -%c\n\n", progname, ch);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue