From ba923d8016ba75fa59d039bc5518e4460d515c40 Mon Sep 17 00:00:00 2001 From: Erik K Date: Fri, 20 May 2022 16:45:00 +0000 Subject: show plugins of docs when using the list command --- sm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sm.c b/sm.c index 6358086..3ab7726 100644 --- a/sm.c +++ b/sm.c @@ -356,14 +356,26 @@ static void list(const char *filename) { char path[512]; + char plugstats[NPLUGINS+3]; FILE *f; - int i; + int i, j, k; + plugstats[0] = '['; + plugstats[NPLUGINS+1] = ']'; if (filename) { snprintf(path, sizeof(path), "%s/%s", kcontentdir, filename); cat(path, stdout); } else for (i = 0; i < ndocdb; i++) { - printf("%-15s: %s\n", docdb[i]->filename, docdb[i]->title); + for (j = 0; j < NPLUGINS; j++) { + plugstats[j + 1] = ' '; + for (k = 0; k < plugins[j]->nusedby; k++) { + if (plugins[j]->usedby[k] == docdb[i]) { + plugstats[j + 1] = plugins[j]->name[0] & ~0x20; + break; + } + } + } + printf("%s %-15s: %s\n", plugstats, docdb[i]->filename, docdb[i]->title); } } -- cgit v1.2.3