diff options
author | Erik K <erikk@previousplan.org> | 2022-05-20 16:45:00 +0000 |
---|---|---|
committer | Erik K <erikk@previousplan.org> | 2022-05-20 16:45:00 +0000 |
commit | ba923d8016ba75fa59d039bc5518e4460d515c40 (patch) | |
tree | 364001459c810cbd867c07d94dcf2cdcd963d92b | |
parent | cf2ff5f763dd9ebdf38f76761bcc41a4990fc156 (diff) |
show plugins of docs when using the list command
-rw-r--r-- | sm.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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); } } |