Re: [PATCH] TODO: update entry on date range queries
[notmuch-archives.git] / 98 / 002fad43565949fc85c86e269ec87e10bd177f
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 0AA05429E42\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Oct 2011 06:50:07 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id kWL95MxcYxtM for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Oct 2011 06:50:06 -0700 (PDT)\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 230EA429E57\r
21         for <notmuch@notmuchmail.org>; Mon, 10 Oct 2011 06:49:59 -0700 (PDT)\r
22 Received: from zancas.localnet\r
23         (fctnnbsc36w-156034064058.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
24         [156.34.64.58]) (authenticated bits=0)\r
25         by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9ADntqg010828\r
26         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
27         Mon, 10 Oct 2011 10:49:56 -0300\r
28 Received: from bremner by zancas.localnet with local (Exim 4.76)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1RDGEq-0006fr-92; Mon, 10 Oct 2011 10:49:52 -0300\r
31 From: david@tethera.net\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH 3/6] notmuch-dump: update handling of file name argument\r
34 Date: Mon, 10 Oct 2011 10:49:18 -0300\r
35 Message-Id: <1318254561-25386-4-git-send-email-david@tethera.net>\r
36 X-Mailer: git-send-email 1.7.6.3\r
37 In-Reply-To: <1318254561-25386-1-git-send-email-david@tethera.net>\r
38 References: <8739f2qhla.fsf@zancas.localnet>\r
39         <1318254561-25386-1-git-send-email-david@tethera.net>\r
40 Cc: David Bremner <bremner@debian.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Mon, 10 Oct 2011 13:50:07 -0000\r
54 \r
55 From: David Bremner <bremner@debian.org>\r
56 \r
57 We permit -- as an "option processing terminator".\r
58 \r
59 Currently this does not do anything useful, but we plan to add\r
60 search terms after the --.\r
61 ---\r
62  notmuch-dump.c |   27 ++++++++++++++++-----------\r
63  1 files changed, 16 insertions(+), 11 deletions(-)\r
64 \r
65 diff --git a/notmuch-dump.c b/notmuch-dump.c\r
66 index 7e7bc17..610144e 100644\r
67 --- a/notmuch-dump.c\r
68 +++ b/notmuch-dump.c\r
69 @@ -26,7 +26,7 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
70      notmuch_config_t *config;\r
71      notmuch_database_t *notmuch;\r
72      notmuch_query_t *query;\r
73 -    FILE *output;\r
74 +    FILE *output = stdout;\r
75      notmuch_messages_t *messages;\r
76      notmuch_message_t *message;\r
77      notmuch_tags_t *tags;\r
78 @@ -40,23 +40,28 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])\r
79      if (notmuch == NULL)\r
80         return 1;\r
81  \r
82 -    query = notmuch_query_create (notmuch, "");\r
83 -    if (query == NULL) {\r
84 -       fprintf (stderr, "Out of memory\n");\r
85 -       return 1;\r
86 -    }\r
87 -    notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);\r
88 -\r
89 -    if (argc) {\r
90 +    if (argc && strcmp (argv[0], "--") != 0) {\r
91         output = fopen (argv[0], "w");\r
92         if (output == NULL) {\r
93             fprintf (stderr, "Error opening %s for writing: %s\n",\r
94                      argv[0], strerror (errno));\r
95             return 1;\r
96         }\r
97 -    } else {\r
98 -       output = stdout;\r
99 +       argc--;\r
100 +       argv++;\r
101 +    }\r
102 +\r
103 +    if (argc && strcmp (argv[0], "--") == 0){\r
104 +       argc--;\r
105 +       argv++;\r
106 +    }\r
107 +\r
108 +    query = notmuch_query_create (notmuch, "");\r
109 +    if (query == NULL) {\r
110 +       fprintf (stderr, "Out of memory\n");\r
111 +       return 1;\r
112      }\r
113 +    notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);\r
114  \r
115      for (messages = notmuch_query_search_messages (query);\r
116          notmuch_messages_valid (messages);\r
117 -- \r
118 1.7.6.3\r
119 \r