From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A826E431FAF for ; Sat, 9 Mar 2013 06:56:58 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sVE43W-E6peB for ; Sat, 9 Mar 2013 06:56:58 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0DFC0431FAE for ; Sat, 9 Mar 2013 06:56:57 -0800 (PST) Received: by mail-lb0-f172.google.com with SMTP id n8so2079196lbj.3 for ; Sat, 09 Mar 2013 06:56:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-gm-message-state; bh=yPjzWOdSh1kW90PtUSe1QKGmaBSEWwwcXgtTDiNJhS8=; b=ERzn75uY6lGQQAALABva709Rv12skPJEitgHnKDLKB9ZK+YzVvWyBUfujirZ+E3hB1 wvGygK3iinKQCjdYPxHDWcF/bgCsTBoAu7zOSzqyYIGCiUSUj5W6kK2/mgeFqg8npmlm VU8PrXMk0B3I7sCBUBcgNo6scYjQyBRbA9d+b0I9wc6X2/KQcQrm1IXa0Z/T02Yeu7dJ dBjtQG9LmMekWtrievS2cOM7ivsSDU0Jyuijvut5CCFjP69cfQq7BxE2xyvp/3zUSf6B N0Cek7X3w45qyu+2eaqALzrOhJmr9fk1bjvc0GGMAiMCQ/t9ZGWuswQrRcP+Pfz2XV4H rDhQ== X-Received: by 10.152.133.52 with SMTP id oz20mr5184947lab.30.1362841016522; Sat, 09 Mar 2013 06:56:56 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id iq6sm4256051lab.10.2013.03.09.06.56.54 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 06:56:55 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2 1/4] cli: make caller check tag count in parse_tag_command_line Date: Sat, 9 Mar 2013 16:56:48 +0200 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQkc2/dRPl6Y+4XYi5BF8pFYA15kEnXjiXKqk7ap6OjrG8wxLDh2FbR6O8eUqv/WNVN6AEBo X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Mar 2013 14:56:58 -0000 --- notmuch-tag.c | 5 +++++ tag-util.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/notmuch-tag.c b/notmuch-tag.c index 0e73197..bc61aab 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -233,6 +233,11 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[]) if (parse_tag_command_line (config, argc - opt_index, argv + opt_index, &query_string, tag_ops)) return 1; + + if (tag_op_list_size (tag_ops) == 0) { + fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n"); + return 1; + } } if (notmuch_database_open (notmuch_config_get_database_path (config), diff --git a/tag-util.c b/tag-util.c index 701d329..c5f5859 100644 --- a/tag-util.c +++ b/tag-util.c @@ -188,11 +188,6 @@ parse_tag_command_line (void *ctx, int argc, char **argv, tag_op_list_append (tag_ops, argv[i] + 1, is_remove); } - if (tag_op_list_size (tag_ops) == 0) { - fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n"); - return TAG_PARSE_INVALID; - } - *query_str = query_string_from_args (ctx, argc - i, &argv[i]); if (*query_str == NULL || **query_str == '\0') { -- 1.7.10.4