From 0f9c0a5fab33a0c14a79a3cdbad2d0136f5f41f6 Mon Sep 17 00:00:00 2001 From: bsd Date: Sat, 13 Jan 2001 21:58:46 +0000 Subject: [PATCH] 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 --- avrprog.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/avrprog.c b/avrprog.c index 4066c5b3..2e8ea3be 100644 --- a/avrprog.c +++ b/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;