]> git.deb.at Git - pkg/abook.git/commitdiff
command-line containing --outformat is less-error prone.
authorRaphaël Droz <raphael.droz+floss@gmail.com>
Mon, 3 Dec 2012 13:28:58 +0000 (14:28 +0100)
committerRaphaël Droz <raphael.droz+floss@gmail.com>
Mon, 3 Dec 2012 13:55:56 +0000 (14:55 +0100)
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

abook.c

diff --git a/abook.c b/abook.c
index 85210584003ff10914d0e04ea2229229c1287bdc..dd05b5679bfa390675c6d5f48c95a46c07d3cea6 100644 (file)
--- 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;