From: Raphaƫl Droz Date: Mon, 3 Dec 2012 13:28:58 +0000 (+0100) Subject: command-line containing --outformat is less-error prone. X-Git-Tag: upstream/0.6.1~2^2~45 X-Git-Url: https://git.deb.at/w?p=pkg%2Fabook.git;a=commitdiff_plain;h=370d475165c2dd25ba2e7dd6553f00f8064ac352;hp=6e4a7610dcb671089f011061603a6bc7c604881d command-line containing --outformat is less-error prone. Since --convert isn't mandatory anymore for --outformat to be used (what was conflicting with --mutt-query), we removed the call to set_convert_var() in 141acfcc. We now need to test that one of MODE_CONVERT and MODE_QUERY is 'on' before allowing the use of --outformat. $ abook --outformat anyformat < file # won't hang anymore --- diff --git a/abook.c b/abook.c index 8521058..dd05b56 100644 --- a/abook.c +++ b/abook.c @@ -377,6 +377,11 @@ parse_command_line(int argc, char **argv) set_convert_var(informat); break; case OPT_OUTFORMAT: + if(mode != MODE_CONVERT && mode != MODE_QUERY) { + fprintf(stderr, + _("please use option --outformat after --convert or --mutt-query option\n")); + exit(EXIT_FAILURE); + } // ascii-name is stored, it's used to traverse // e_filters[] in MODE_CONVERT (see export_file()) outformat = optarg;