Mercurial > dovecot > core-2.2
changeset 14190:bf340465cb70
doveadm dump: Show available types in case a wrong one was given.
author | Pascal Volk <user@localhost.localdomain.org> |
---|---|
date | Mon, 20 Feb 2012 23:39:20 +0000 |
parents | 0947b28d2903 |
children | e8da2675da41 |
files | src/doveadm/doveadm-dump.c src/doveadm/doveadm-dump.h |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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);