mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-10-09 04:01:01 +00:00
Major code cleanup.
- Make all internal functions "static". - Make sure each module's header and implementation file match. - Remove all library-like functionality from main.c, so only the actual frontend remains in main.c. - Add C++ brackets to all header files. That effectively leaves the various module C files as something like an "avrdude library", with main.c being the currently only frontend program for that library. In theory, it should be possible to write different frontends using the same library backend functions though. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@722 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
46
pgm.c
46
pgm.c
@@ -167,3 +167,49 @@ static void pgm_default_6 (struct programmer_t * pgm, char * p)
|
||||
}
|
||||
|
||||
|
||||
void programmer_display(PROGRAMMER * pgm, char * p)
|
||||
{
|
||||
fprintf(stderr, "%sProgrammer Type : %s\n", p, pgm->type);
|
||||
fprintf(stderr, "%sDescription : %s\n", p, pgm->desc);
|
||||
|
||||
pgm->display(pgm, p);
|
||||
}
|
||||
|
||||
PROGRAMMER * locate_programmer(LISTID programmers, char * configid)
|
||||
{
|
||||
LNODEID ln1, ln2;
|
||||
PROGRAMMER * p = NULL;
|
||||
char * id;
|
||||
int found;
|
||||
|
||||
found = 0;
|
||||
|
||||
for (ln1=lfirst(programmers); ln1 && !found; ln1=lnext(ln1)) {
|
||||
p = ldata(ln1);
|
||||
for (ln2=lfirst(p->id); ln2 && !found; ln2=lnext(ln2)) {
|
||||
id = ldata(ln2);
|
||||
if (strcasecmp(configid, id) == 0)
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
return p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void list_programmers(FILE * f, char * prefix, LISTID programmers)
|
||||
{
|
||||
LNODEID ln1;
|
||||
PROGRAMMER * p;
|
||||
|
||||
for (ln1=lfirst(programmers); ln1; ln1=lnext(ln1)) {
|
||||
p = ldata(ln1);
|
||||
fprintf(f, "%s%-8s = %-30s [%s:%d]\n",
|
||||
prefix, (char *)ldata(lfirst(p->id)), p->desc,
|
||||
p->config_file, p->lineno);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user