dovecot-2.1: doveadm dump: Show available types in case a wrong ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Feb 21 02:06:12 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/bf340465cb70
changeset: 14171:bf340465cb70
user: Pascal Volk <user at localhost.localdomain.org>
date: Mon Feb 20 23:39:20 2012 +0000
description:
doveadm dump: Show available types in case a wrong one was given.
diffstat:
src/doveadm/doveadm-dump.c | 15 +++++++++++++--
src/doveadm/doveadm-dump.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diffs (44 lines):
diff -r 0947b28d2903 -r bf340465cb70 src/doveadm/doveadm-dump.c
--- a/src/doveadm/doveadm-dump.c Mon Feb 20 23:34:38 2012 +0200
+++ b/src/doveadm/doveadm-dump.c Mon Feb 20 23:39:20 2012 +0000
@@ -63,9 +63,10 @@
dump = type != NULL ? dump_find_name(type) : dump_find_test(argv[1]);
if (dump == NULL) {
- if (type != NULL)
+ if (type != NULL) {
+ print_dump_types();
i_fatal_status(EX_USAGE, "Unknown type: %s", type);
- else {
+ } else {
i_fatal_status(EX_DATAERR,
"Can't autodetect file type: %s", argv[1]);
}
@@ -88,6 +89,16 @@
&doveadm_cmd_dump_thread
};
+void print_dump_types(void)
+{
+ unsigned int i;
+
+ fprintf(stderr, "Available dump types: %s", dumps_builtin[0]->name);
+ for (i = 1; i < N_ELEMENTS(dumps_builtin); i++)
+ fprintf(stderr, " %s", dumps_builtin[i]->name);
+ fprintf(stderr, "\n");
+}
+
void doveadm_dump_init(void)
{
unsigned int i;
diff -r 0947b28d2903 -r bf340465cb70 src/doveadm/doveadm-dump.h
--- a/src/doveadm/doveadm-dump.h Mon Feb 20 23:34:38 2012 +0200
+++ b/src/doveadm/doveadm-dump.h Mon Feb 20 23:39:20 2012 +0000
@@ -17,6 +17,7 @@
void doveadm_dump_register(const struct doveadm_cmd_dump *dump);
+void print_dump_types(void);
void doveadm_dump_init(void);
void doveadm_dump_deinit(void);
More information about the dovecot-cvs
mailing list