Make avrdude Solaris-compatible.

* Makefile.am: distclean avrdude.conf.
* avrdude.conf.in: make the parallel-port programmers optional.
* bitbang.c: move the bitbang features out into PROGRAMMER.
* configure.ac: introduce --enable-parport, add Solaris.
* lexer.l: replace str by strng to work around problems in some
versions of flex.
* main.c: move getexitspecs into the respective programmer's
domain; replace rindex by the C-standard strrchr.
* par.c: make parallel port optional.
* par.h: everything but par_initpgm() is private now.
* pgm.h: add setping/getping/highpulsepin/getexitspecs.
* serbb_posix.c: generalize bitbang interface; replace
cfmakeraw() by explicit code.
* serbb_win32.c: generalize bitbang interface.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@539 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch
2005-11-01 23:02:06 +00:00
parent f0decfde12
commit 7dba7155a2
12 changed files with 239 additions and 197 deletions

44
main.c
View File

@@ -129,39 +129,6 @@ void usage(void)
}
/*
* parse the -E string
*/
int getexitspecs(char *s, int *set, int *clr)
{
char *cp;
while ((cp = strtok(s, ","))) {
if (strcmp(cp, "reset") == 0) {
*clr |= par_getpinmask(pgm->pinno[PIN_AVR_RESET]);
}
else if (strcmp(cp, "noreset") == 0) {
*set |= par_getpinmask(pgm->pinno[PIN_AVR_RESET]);
}
else if (strcmp(cp, "vcc") == 0) {
if (pgm->pinno[PPI_AVR_VCC])
*set |= pgm->pinno[PPI_AVR_VCC];
}
else if (strcmp(cp, "novcc") == 0) {
if (pgm->pinno[PPI_AVR_VCC])
*clr |= pgm->pinno[PPI_AVR_VCC];
}
else {
return -1;
}
s = 0; /* strtok() should be called with the actual string only once */
}
return 0;
}
int read_config(char * file)
{
FILE * f;
@@ -742,11 +709,11 @@ int main(int argc, char * argv [])
char * homedir;
#endif
progname = rindex(argv[0],'/');
progname = strrchr(argv[0],'/');
#if defined (WIN32NATIVE)
/* take care of backslash as dir sep in W32 */
if (!progname) progname = rindex(argv[0],'\\');
if (!progname) progname = strrchr(argv[0],'\\');
#endif /* WIN32NATIVE */
if (progname)
@@ -1106,14 +1073,13 @@ int main(int argc, char * argv [])
if (exitspecs != NULL) {
if (strcmp(pgm->type, "PPI") != 0) {
if (pgm->getexitspecs == NULL) {
fprintf(stderr,
"%s: WARNING: -E option is only valid with \"PPI\" "
"programmer types\n",
"%s: WARNING: -E option not supported by this programmer type\n",
progname);
exitspecs = NULL;
}
else if (getexitspecs(exitspecs, &ppisetbits, &ppiclrbits) < 0) {
else if (pgm->getexitspecs(pgm, exitspecs, &ppisetbits, &ppiclrbits) < 0) {
usage();
exit(1);
}