minor cleanup

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@168 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
bsd 2002-12-12 03:59:28 +00:00
parent 354cd80b4a
commit 4339967b19
1 changed files with 13 additions and 4 deletions

17
main.c
View File

@ -433,7 +433,7 @@ int main(int argc, char * argv [])
char configfile[PATH_MAX]; /* pin configuration file */ char configfile[PATH_MAX]; /* pin configuration file */
int cycles; /* erase-rewrite cycles */ int cycles; /* erase-rewrite cycles */
int set_cycles; /* value to set the erase-rewrite cycles to */ int set_cycles; /* value to set the erase-rewrite cycles to */
char * e; char * e; /* for strtol() error checking */
progname = rindex(argv[0],'/'); progname = rindex(argv[0],'/');
if (progname) if (progname)
@ -690,7 +690,7 @@ int main(int argc, char * argv [])
pgm = locate_pinconfig(programmers, pinconfig); pgm = locate_pinconfig(programmers, pinconfig);
if (pgm == NULL) { if (pgm == NULL) {
fprintf(stderr, fprintf(stderr,
"%s: Can't find pin config id \"%s\"\n", "%s: Can't find programmer id \"%s\"\n",
progname, pinconfig); progname, pinconfig);
fprintf(stderr,"\n"); fprintf(stderr,"\n");
exit(1); exit(1);
@ -703,7 +703,9 @@ int main(int argc, char * argv [])
" Valid Parts are:\n\n", " Valid Parts are:\n\n",
progname); progname);
list_parts(stderr, " ", part_list); list_parts(stderr, " ", part_list);
fprintf(stderr,"\n"); fprintf(stderr, "\n");
fprintf(stderr, "(These come from the config file \"%s\")\n", configfile);
fprintf(stderr, "\n");
exit(1); exit(1);
} }
@ -715,6 +717,8 @@ int main(int argc, char * argv [])
progname, partdesc); progname, partdesc);
list_parts(stderr, " ", part_list); list_parts(stderr, " ", part_list);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fprintf(stderr, "(These come from the config file \"%s\")\n", configfile);
fprintf(stderr, "\n");
exit(1); exit(1);
} }
@ -764,6 +768,9 @@ int main(int argc, char * argv [])
exitrc = 0; exitrc = 0;
/*
* allow the programmer to save its state
*/
rc = pgm->save(pgm); rc = pgm->save(pgm);
if (rc < 0) { if (rc < 0) {
exitrc = 1; exitrc = 1;
@ -776,7 +783,6 @@ int main(int argc, char * argv [])
pgm->ppidata |= ppisetbits; pgm->ppidata |= ppisetbits;
} }
/* /*
* enable the programmer * enable the programmer
*/ */
@ -1040,6 +1046,9 @@ int main(int argc, char * argv [])
pgm->powerdown(pgm); pgm->powerdown(pgm);
/*
* restore programmer state
*/
pgm->restore(pgm); pgm->restore(pgm);
pgm->disable(pgm); pgm->disable(pgm);