1 Return-Path: <amdragon@mit.edu>
\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 39A33429E21
\r
6 for <notmuch@notmuchmail.org>; Wed, 11 Jan 2012 10:26:43 -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 XiVB7IAi3rmO for <notmuch@notmuchmail.org>;
\r
16 Wed, 11 Jan 2012 10:26:42 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 94761431FB6
\r
20 for <notmuch@notmuchmail.org>; Wed, 11 Jan 2012 10:26:42 -0800 (PST)
\r
21 X-AuditID: 1209190d-b7fbf6d0000008ba-d3-4f0dd461e2e8
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 84.DC.02234.164DD0F4; Wed, 11 Jan 2012 13:26:42 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q0BIQfbG002409;
\r
27 Wed, 11 Jan 2012 13:26:41 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0BIQbqX005764
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Wed, 11 Jan 2012 13:26:38 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Rl2sG-0004D3-I3; Wed, 11 Jan 2012 13:26:12 -0500
\r
37 Date: Wed, 11 Jan 2012 13:26:12 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Jani Nikula <jani@nikula.org>
\r
40 Subject: Re: [PATCH 1/3] count: Convert to new-style argument parsing
\r
41 Message-ID: <20120111182453.GS20796@mit.edu>
\r
42 References: <20120109043101.GH20796@mit.edu>
\r
43 <1326258173-21163-1-git-send-email-amdragon@mit.edu>
\r
44 <1326258173-21163-2-git-send-email-amdragon@mit.edu>
\r
45 <87zkdulkla.fsf@nikula.org>
\r
47 Content-Type: text/plain; charset=us-ascii
\r
48 Content-Disposition: inline
\r
49 In-Reply-To: <87zkdulkla.fsf@nikula.org>
\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
51 X-Brightmail-Tracker:
\r
52 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hRV1k26wutvcPs4o0XTdGeL6zdnMjsw
\r
53 edy6/5rd49mqW8wBTFFcNimpOZllqUX6dglcGZvvnmcuWM9bcbdzFUsD43KuLkZODgkBE4mb
\r
54 zd+YIGwxiQv31rN1MXJxCAnsY5T48msmK4SzgVHi7qyFUM5JJomep+eZIJwljBIz770H62cR
\r
55 UJX4cHw+C4jNJqAhsW3/ckYQW0RAUWLzyf1gNrOAtMS3381g9cICrhL3z9xhBbF5BXQk5vU2
\r
56 gcWFBHYwSjTszYaIC0qcnPmEBaJXS+LGv5dANRxgc5b/4wAJcwKtWvn8MRuILSqgIjHl5Da2
\r
57 CYxCs5B0z0LSPQuhewEj8ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdI73czBK91JTSTYzgsJbk
\r
58 3cH47qDSIUYBDkYlHt6de3n9hVgTy4orcw8xSnIwKYnyhl0CCvEl5adUZiQWZ8QXleakFh9i
\r
59 lOBgVhLhdaoByvGmJFZWpRblw6SkOViUxHlVtd75CQmkJ5akZqemFqQWwWRlODiUJHhPXgZq
\r
60 FCxKTU+tSMvMKUFIM3FwggznARruClLDW1yQmFucmQ6RP8WoKCXO+wgkIQCSyCjNg+uFpZ1X
\r
61 jOJArwjz7gep4gGmLLjuV0CDmYAGb1nHAzK4JBEhJdXA6DWdo/tfV9TrOeUH2Q98Dj95+PUe
\r
62 l+1HW1pPPfr99sXs02I6cruDlp3nd75y4cHFpiszjk15fYn3v/KpoN0rrZ8W7hdN+PUoPO1M
\r
63 U0jo7p8XE6y0Mz7p3D7HGL9odfE5X5YtM//r/ypJ0eBU//K021co0HvXK6ffUs27kpbYyP9L
\r
64 U/0uqVvlwa7EUpyRaKjFXFScCABGhCqxFgMAAA==
\r
65 Cc: notmuch@notmuchmail.org
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.13
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Wed, 11 Jan 2012 18:26:43 -0000
\r
80 Quoth Jani Nikula on Jan 11 at 8:17 am:
\r
81 > On Wed, 11 Jan 2012 00:02:51 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
83 > > notmuch-count.c | 53 +++++++++++++++++++++++++----------------------------
\r
84 > > 1 files changed, 25 insertions(+), 28 deletions(-)
\r
86 > > diff --git a/notmuch-count.c b/notmuch-count.c
\r
87 > > index 20ce334..fb7401b 100644
\r
88 > > --- a/notmuch-count.c
\r
89 > > +++ b/notmuch-count.c
\r
90 > > @@ -21,6 +21,11 @@
\r
92 > > #include "notmuch-client.h"
\r
95 > > + OUTPUT_THREADS,
\r
96 > > + OUTPUT_MESSAGES,
\r
100 > > notmuch_count_command (void *ctx, int argc, char *argv[])
\r
102 > > @@ -28,35 +33,23 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
\r
103 > > notmuch_database_t *notmuch;
\r
104 > > notmuch_query_t *query;
\r
105 > > char *query_str;
\r
107 > > - notmuch_bool_t output_messages = TRUE;
\r
108 > > + int opt_index;
\r
109 > > + output_t output = OUTPUT_MESSAGES;
\r
111 > > - argc--; argv++; /* skip subcommand argument */
\r
112 > > + notmuch_opt_desc_t options[] = {
\r
113 > > + { NOTMUCH_OPT_KEYWORD, &output, "output", 'o',
\r
114 > > + (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
\r
115 > > + { "messages", OUTPUT_MESSAGES },
\r
116 > > + { 0, 0 } } },
\r
118 > To be pedantic, parse_arguments() expects 'output_var' to be a pointer
\r
119 > to int for NOTMUCH_OPT_KEYWORD. sizeof(enum) is implementation
\r
120 > dependent. I would forget about output_t typedef, use plain enum, and
\r
121 > int type for 'output'.
\r
123 Pedantic or not, that's a good point. We should fix this in
\r
124 notmuch-search.c, too (which is where I shamelessly copied this from).
\r
125 Or make the argument parser more type-safe.
\r