1 Return-Path: <jani@nikula.org>
\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 26CDA429E26
\r
6 for <notmuch@notmuchmail.org>; Tue, 6 Dec 2011 12:43:44 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 eVeaDB0OvMFF for <notmuch@notmuchmail.org>;
\r
16 Tue, 6 Dec 2011 12:43:43 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 64406429E21 for <notmuch@notmuchmail.org>; Tue, 6 Dec 2011 12:43:43 -0800
\r
22 Received: by wgbds13 with SMTP id ds13so5706407wgb.2
\r
23 for <notmuch@notmuchmail.org>; Tue, 06 Dec 2011 12:43:42 -0800 (PST)
\r
24 Received: by 10.227.203.10 with SMTP id fg10mr12462465wbb.1.1323204222061;
\r
25 Tue, 06 Dec 2011 12:43:42 -0800 (PST)
\r
26 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.
\r
28 by mx.google.com with ESMTPS id b5sm35340022wbh.4.2011.12.06.12.43.40
\r
29 (version=SSLv3 cipher=OTHER); Tue, 06 Dec 2011 12:43:40 -0800 (PST)
\r
30 From: Jani Nikula <jani@nikula.org>
\r
31 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
32 Subject: Re: [PATCH 2/4] notmuch-dump: convert to notmuch-opts argument
\r
34 In-Reply-To: <1323013675-6929-3-git-send-email-david@tethera.net>
\r
35 References: <1323013675-6929-1-git-send-email-david@tethera.net>
\r
36 <1323013675-6929-3-git-send-email-david@tethera.net>
\r
37 User-Agent: Notmuch/0.10.1+59~ga1814f2 (http://notmuchmail.org) Emacs/23.3.1
\r
39 Date: Tue, 06 Dec 2011 22:43:38 +0200
\r
40 Message-ID: <87wra9xwg5.fsf@nikula.org>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 Cc: David Bremner <bremner@debian.org>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Tue, 06 Dec 2011 20:43:44 -0000
\r
58 On Sun, 4 Dec 2011 11:47:53 -0400, David Bremner <david@tethera.net> wrote:
\r
59 > From: David Bremner <bremner@debian.org>
\r
61 > The output file is handled via positional arguments. There are
\r
62 > currently no "normal" options.
\r
64 > notmuch-dump.c | 32 ++++++++++++++++++++------------
\r
65 > 1 files changed, 20 insertions(+), 12 deletions(-)
\r
67 > diff --git a/notmuch-dump.c b/notmuch-dump.c
\r
68 > index a490917..6fbdc81 100644
\r
69 > --- a/notmuch-dump.c
\r
70 > +++ b/notmuch-dump.c
\r
74 > #include "notmuch-client.h"
\r
75 > +#include "notmuch-opts.h"
\r
78 > notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
\r
79 > @@ -41,27 +42,34 @@ notmuch_dump_command (unused (void *ctx), int argc, char *argv[])
\r
80 > if (notmuch == NULL)
\r
83 > - argc--; argv++; /* skip subcommand argument */
\r
84 > + char *output_file_name = NULL;
\r
87 > - if (argc && strcmp (argv[0], "--") != 0) {
\r
88 > + notmuch_opt_desc_t options[] = {
\r
89 > + { "out-file", 'o', NOTMUCH_OPT_POSITION, 0, &output_file_name },
\r
90 > + { 0, 0, 0, 0, 0 }
\r
93 > + opt_index = notmuch_parse_args (argc, argv, options, 1);
\r
95 > + if (opt_index < 0) {
\r
96 > + /* diagnostics already printed */
\r
99 return 1 rather than exit(1)?
\r
106 > + if (output_file_name) {
\r
107 > fprintf (stderr, "Warning: the output file argument of dump is deprecated.\n");
\r
108 > - output = fopen (argv[0], "w");
\r
109 > + output = fopen (output_file_name, "w");
\r
110 > if (output == NULL) {
\r
111 > fprintf (stderr, "Error opening %s for writing: %s\n",
\r
112 > - argv[0], strerror (errno));
\r
113 > + output_file_name, strerror (errno));
\r
120 > - if (argc && strcmp (argv[0], "--") == 0){
\r
126 > - query_str = query_string_from_args (notmuch, argc, argv);
\r
127 > + if (opt_index < argc) {
\r
128 > + query_str = query_string_from_args (notmuch, argc-opt_index, argv+opt_index);
\r
129 > if (query_str == NULL) {
\r
130 > fprintf (stderr, "Out of memory.\n");
\r
135 > _______________________________________________
\r
136 > notmuch mailing list
\r
137 > notmuch@notmuchmail.org
\r
138 > http://notmuchmail.org/mailman/listinfo/notmuch
\r