From: Raphaƫl Droz Date: Tue, 30 Aug 2011 13:42:09 +0000 (+0200) Subject: mutt-query (3/3): register the --mutt-query-format per-item filter and use it X-Git-Tag: upstream/0.6.1~2^2~53 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=141acfcc;p=pkg%2Fabook.git mutt-query (3/3): register the --mutt-query-format per-item filter and use it --- diff --git a/abook.c b/abook.c index 4ef136c..e9f8841 100644 --- a/abook.c +++ b/abook.c @@ -50,6 +50,8 @@ static void add_email(int); char *datafile = NULL; static char *rcfile = NULL; +struct abook_output_item_filter selected_item_filter; + bool alternative_datafile = FALSE; bool alternative_rcfile = FALSE; @@ -303,6 +305,7 @@ parse_command_line(int argc, char **argv) *infile = "-", *outfile = "-"; int c; + selected_item_filter = select_output_item_filter("muttq"); for(;;) { int option_index = 0; @@ -368,7 +371,8 @@ parse_command_line(int argc, char **argv) set_convert_var(informat); break; case OPT_OUTFORMAT: - set_convert_var(outformat); + outformat = optarg; + selected_item_filter = select_output_item_filter(outformat); break; case OPT_INFILE: set_convert_var(infile); @@ -384,6 +388,8 @@ parse_command_line(int argc, char **argv) } } + if(! selected_item_filter.func) + selected_item_filter = select_output_item_filter("muttq"); if(optind < argc) { fprintf(stderr, _("%s: unrecognized arguments on command line\n"), argv[0]); @@ -462,7 +468,7 @@ mutt_query(char *str) } putchar('\n'); while(i >= 0) { - muttq_print_item(stdout, i); + e_write_item(stdout, i, selected_item_filter.func); i = find_item(str, i + 1, search_fields); } } diff --git a/filter.c b/filter.c index 96fa9c2..2735331 100644 --- a/filter.c +++ b/filter.c @@ -103,6 +103,7 @@ struct abook_output_filter e_filters[] = { }; struct abook_output_item_filter u_filters[] = { + { "muttq", N_("mutt alias"), muttq_print_item }, { "\0", NULL } };