dovecot-2.2: doveadm: Removed duplicate subcommands from list of...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 5 11:01:25 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/8fe127697587
changeset: 18053:8fe127697587
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 05 13:00:14 2014 +0200
description:
doveadm: Removed duplicate subcommands from list of commands.
For example don't show "mailbox ..|metadata|metadata|metadata|.."

diffstat:

 src/doveadm/doveadm.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 46b1b81ad90d -r 8fe127697587 src/doveadm/doveadm.c
--- a/src/doveadm/doveadm.c	Tue Nov 04 14:49:44 2014 +0200
+++ b/src/doveadm/doveadm.c	Wed Nov 05 13:00:14 2014 +0200
@@ -54,7 +54,8 @@
 static void
 doveadm_usage_compress_lines(FILE *out, const char *str, const char *prefix)
 {
-	const char *cmd, *args, *p, *short_name, *prev_name = "";
+	const char *cmd, *args, *p, *short_name, *sub_name;
+	const char *prev_name = "", *prev_sub_name = "";
 	const char **lines;
 	unsigned int i, count, prefix_len = strlen(prefix);
 
@@ -97,8 +98,13 @@
 				fprintf(out, USAGE_CMDNAME_FMT" %s",
 					short_name, t_strcut(p + 1, ' '));
 				prev_name = short_name;
+				prev_sub_name = "";
 			} else {
-				fprintf(out, "|%s", t_strcut(p + 1, ' '));
+				sub_name = t_strcut(p + 1, ' ');
+				if (strcmp(prev_sub_name, sub_name) != 0) {
+					fprintf(out, "|%s", sub_name);
+					prev_sub_name = sub_name;
+				}
 			}
 		}
 	}


More information about the dovecot-cvs mailing list