Refine -L output to include all programmer modules
Flashrom -L output did not contain a list of programmers nor were
all programmers listed. Fix it and mention at least the name of each
programmer. Wiki output is unchanged, and will need separate fixups.
Corresponding to flashrom svn r1199.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
diff --git a/flashrom.c b/flashrom.c
index 0a3e4fe..fa36bfb 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1332,6 +1332,47 @@
msg_ginfo("\n");
}
+void list_programmers_linebreak(int startcol, int cols, int paren)
+{
+ const char *pname;
+ int pnamelen;
+ int remaining = 0;
+ int firstline = 1;
+ enum programmer p;
+ int i;
+
+ for (p = 0; p < PROGRAMMER_INVALID; p++) {
+ pname = programmer_table[p].name;
+ pnamelen = strlen(pname);
+ if (remaining - pnamelen - 2 < 0) {
+ if (firstline)
+ firstline = 0;
+ else
+ printf("\n");
+ for (i = 0; i < startcol; i++)
+ printf(" ");
+ remaining = cols - startcol;
+ } else {
+ printf(" ");
+ remaining--;
+ }
+ if (paren && (p == 0)) {
+ printf("(");
+ remaining--;
+ }
+ printf("%s", pname);
+ remaining -= pnamelen;
+ if (p < PROGRAMMER_INVALID - 1) {
+ printf(",");
+ remaining--;
+ } else {
+ if (paren)
+ printf(")");
+ printf("\n");
+ }
+ }
+}
+
void print_sysinfo(void)
{
#if HAVE_UTSNAME == 1