]> git.notmuchmail.org Git - notmuch/commitdiff
throw error if mbox format specified with --part
authorJameson Graef Rollins <jrollins@finestructure.net>
Mon, 23 May 2011 07:35:37 +0000 (00:35 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 24 May 2011 19:04:08 +0000 (12:04 -0700)
These formats are incompatible, since mbox format requires full
messages.

notmuch-show.c

index e128be541b9f36b1144192e1f094f8db3d85b50b..c57f7bd075d4eb1aa05883b5b60bcef40ad0ad00 100644 (file)
@@ -709,6 +709,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
     char *opt;
     const notmuch_show_format_t *format = &format_text;
     notmuch_show_params_t params;
     char *opt;
     const notmuch_show_format_t *format = &format_text;
     notmuch_show_params_t params;
+    int mbox = 0;
     int i;
 
     params.entire_thread = 0;
     int i;
 
     params.entire_thread = 0;
@@ -729,6 +730,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
                params.entire_thread = 1;
            } else if (strcmp (opt, "mbox") == 0) {
                format = &format_mbox;
                params.entire_thread = 1;
            } else if (strcmp (opt, "mbox") == 0) {
                format = &format_mbox;
+               mbox = 1;
            } else if (strcmp (opt, "raw") == 0) {
                format = &format_raw;
                params.raw = 1;
            } else if (strcmp (opt, "raw") == 0) {
                format = &format_raw;
                params.raw = 1;
@@ -759,6 +761,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
        return 1;
     }
 
        return 1;
     }
 
+    if (mbox && params.part > 0) {
+       fprintf (stderr, "Error: specifying parts is incompatible with mbox output format.\n");
+       return 1;
+    }
+
     if (*query_string == '\0') {
        fprintf (stderr, "Error: notmuch show requires at least one search term.\n");
        return 1;
     if (*query_string == '\0') {
        fprintf (stderr, "Error: notmuch show requires at least one search term.\n");
        return 1;