aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/rspamc.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-13 13:03:35 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-13 13:04:26 +0000
commit768dce24d41f51691d13328f21e52240257d4185 (patch)
treef438ffbc7b9d26682c1200eb3b297f1cfc64145d /src/client/rspamc.c
parent3a145180bc1398ab06f25fee22baa9cd8757caa3 (diff)
downloadrspamd-768dce24d41f51691d13328f21e52240257d4185.tar.gz
rspamd-768dce24d41f51691d13328f21e52240257d4185.zip
[Minor] Fix rspamc --commands
Diffstat (limited to 'src/client/rspamc.c')
-rw-r--r--src/client/rspamc.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 33d49345a..ea1003437 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -432,16 +432,31 @@ static void
print_commands_list (void)
{
guint i;
+ guint cmd_len = 0;
+ gchar fmt_str[32];
rspamd_fprintf (stdout, "Rspamc commands summary:\n");
+
+ for (i = 0; i < G_N_ELEMENTS (rspamc_commands); i++) {
+ gsize clen = strlen (rspamc_commands[i].name);
+
+ if (clen > cmd_len) {
+ cmd_len = clen;
+ }
+ }
+
+ rspamd_snprintf (fmt_str, sizeof (fmt_str), " %%%ds (%%7s%%1s)\t%%s\n",
+ cmd_len);
+
for (i = 0; i < G_N_ELEMENTS (rspamc_commands); i++) {
- rspamd_fprintf (stdout,
- " %10s (%7s%1s)\t%s\n",
- rspamc_commands[i].name,
- rspamc_commands[i].is_controller ? "control" : "normal",
- rspamc_commands[i].is_privileged ? "*" : "",
- rspamc_commands[i].description);
+ fprintf (stdout,
+ fmt_str,
+ rspamc_commands[i].name,
+ rspamc_commands[i].is_controller ? "control" : "normal",
+ rspamc_commands[i].is_privileged ? "*" : "",
+ rspamc_commands[i].description);
}
+
rspamd_fprintf (stdout,
"\n* is for privileged commands that may need password (see -P option)\n");
rspamd_fprintf (stdout,