summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik K <erikk@previousplan.org>2022-05-20 16:45:00 +0000
committerErik K <erikk@previousplan.org>2022-05-20 16:45:00 +0000
commitba923d8016ba75fa59d039bc5518e4460d515c40 (patch)
tree364001459c810cbd867c07d94dcf2cdcd963d92b
parentcf2ff5f763dd9ebdf38f76761bcc41a4990fc156 (diff)
show plugins of docs when using the list command
-rw-r--r--sm.c16
1 files 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);
}
}