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 B6EBD431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:13 -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 RESPAjkmFLY2 for <notmuch@notmuchmail.org>;
\r
16 Mon, 21 Jan 2013 10:05:13 -0800 (PST)
\r
17 Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com
\r
18 [209.85.214.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 00162431FAE
\r
21 for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:12 -0800 (PST)
\r
22 Received: by mail-bk0-f41.google.com with SMTP id jg9so3315307bkc.0
\r
23 for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 10:05:11 -0800 (PST)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=google.com; s=20120113;
\r
26 h=x-received:from:to:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type:x-gm-message-state;
\r
28 bh=jzonoBlp3g+vjyOZ8KS0Kae3836LIfhhJIAtrrPxomM=;
\r
29 b=H8M5mcZqg/4wVcFRD+EX0hkn4ja7L+Ng9mmx4oO0ve92BE1V9v5drgSw4OXlgzU/WK
\r
30 EuOfY/e9U8bqSabXro0b5PlliHqB8YvRKwvMFb/V8Kfr77D7MIidACSwcQ/nEWW129ea
\r
31 Ja6Um8XJV/GPX3ZdcH6Gsx2mSrpJMCMJs+OIkbpOyo+JNDLReZZNwwO7sKYjcxlW4uiy
\r
32 q3pPxTPur7dSjOw89R9GGhdNJmLph3NbU9rcbVeNQfMOaYSMxQXzztWpr95cwsPFty4a
\r
33 X5t0zZCMqZDarR5Vy/ffgh1/6gj2fiwuXQBOoEE4aDyygUUBr9DNrystAo/fCbMrGwnM
\r
35 X-Received: by 10.204.3.206 with SMTP id 14mr5093578bko.120.1358791510116;
\r
36 Mon, 21 Jan 2013 10:05:10 -0800 (PST)
\r
37 Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])
\r
38 by mx.google.com with ESMTPS id q22sm9254720bkv.16.2013.01.21.10.05.07
\r
39 (version=TLSv1.1 cipher=RC4-SHA bits=128/128);
\r
40 Mon, 21 Jan 2013 10:05:08 -0800 (PST)
\r
41 From: Jani Nikula <jani@nikula.org>
\r
42 To: Peter Wang <novalazy@gmail.com>, notmuch@notmuchmail.org
\r
43 Subject: Re: [PATCH v3 08/20] tag-util: move out 'tag' command-line checks
\r
44 In-Reply-To: <1358643004-14522-9-git-send-email-novalazy@gmail.com>
\r
45 References: <1358643004-14522-1-git-send-email-novalazy@gmail.com>
\r
46 <1358643004-14522-9-git-send-email-novalazy@gmail.com>
\r
47 User-Agent: Notmuch/0.14+259~gdee88db (http://notmuchmail.org) Emacs/23.2.1
\r
48 (x86_64-pc-linux-gnu)
\r
49 Date: Mon, 21 Jan 2013 19:05:00 +0100
\r
50 Message-ID: <87boci2z03.fsf@nikula.org>
\r
52 Content-Type: text/plain; charset=us-ascii
\r
54 ALoCoQnCtVWcgeCNxuHsycdsooJhSilZdoY8glHuz8nRH1R6sSBDxN1QDIbQQRWxffieHpgOj6D5
\r
55 X-BeenThere: notmuch@notmuchmail.org
\r
56 X-Mailman-Version: 2.1.13
\r
58 List-Id: "Use and development of the notmuch mail system."
\r
59 <notmuch.notmuchmail.org>
\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
63 List-Post: <mailto:notmuch@notmuchmail.org>
\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
67 X-List-Received-Date: Mon, 21 Jan 2013 18:05:13 -0000
\r
69 On Sun, 20 Jan 2013, Peter Wang <novalazy@gmail.com> wrote:
\r
70 > parse_tag_command_line checked for two error conditions which are
\r
71 > specific to the 'tag' command. It can be reused for the notmuch
\r
72 > 'insert' command if we move the checks out, into notmuch-tag.c.
\r
74 *three* error conditions, two of which are specific to notmuch tag. See
\r
78 > notmuch-tag.c | 10 ++++++++++
\r
79 > tag-util.c | 10 ----------
\r
80 > 2 files changed, 10 insertions(+), 10 deletions(-)
\r
82 > diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
83 > index d9daf8f..a901dad 100644
\r
84 > --- a/notmuch-tag.c
\r
85 > +++ b/notmuch-tag.c
\r
86 > @@ -234,6 +234,16 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
\r
87 > if (parse_tag_command_line (ctx, argc - opt_index, argv + opt_index,
\r
88 > &query_string, tag_ops))
\r
91 > + if (tag_op_list_size (tag_ops) == 0) {
\r
92 > + fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
\r
96 > + if (*query_string == '\0') {
\r
97 > + fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
\r
102 > config = notmuch_config_open (ctx, NULL, NULL);
\r
103 > diff --git a/tag-util.c b/tag-util.c
\r
104 > index 3f9da05..41f2c09 100644
\r
107 > @@ -186,18 +186,8 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
108 > tag_op_list_append (tag_ops, argv[i] + 1, is_remove);
\r
111 > - if (tag_op_list_size (tag_ops) == 0) {
\r
112 > - fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
\r
113 > - return TAG_PARSE_INVALID;
\r
116 > *query_str = query_string_from_args (ctx, argc - i, &argv[i]);
\r
118 > - if (*query_str == NULL || **query_str == '\0') {
\r
120 You must leave *query_str == NULL check intact here. Fix the error
\r
121 message to be about allocation failure and drop the reference to notmuch
\r
126 > - fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
\r
127 > - return TAG_PARSE_INVALID;
\r
130 > return TAG_PARSE_SUCCESS;
\r
136 > _______________________________________________
\r
137 > notmuch mailing list
\r
138 > notmuch@notmuchmail.org
\r
139 > http://notmuchmail.org/mailman/listinfo/notmuch
\r