patch #7671: Sorting programmers and parts lists for console output

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1019 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher
2011-12-16 20:44:07 +00:00
parent 2279ba026f
commit ea21f277b1
8 changed files with 178 additions and 80 deletions

View File

@@ -470,6 +470,24 @@ void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie)
}
}
/*
* Compare function to sort the list of programmers
*/
static int sort_avrparts_compare(AVRPART * p1,AVRPART * p2)
{
if(p1 == NULL || p2 == NULL) {
return 0;
}
return strncasecmp(p1->desc,p2->desc,AVR_IDLEN);
}
/*
* Sort the list of programmers given as "programmers"
*/
void sort_avrparts(LISTID avrparts)
{
lsort(avrparts,(int (*)(void*, void*)) sort_avrparts_compare);
}
static char * reset_disp_str(int r)