--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 89B12431FBC\r
+ for <notmuch@notmuchmail.org>; Sat, 10 Mar 2012 03:05:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id kK3QfH+kCvEL for <notmuch@notmuchmail.org>;\r
+ Sat, 10 Mar 2012 03:05:43 -0800 (PST)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+ [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E3AC7431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 10 Mar 2012 03:05:42 -0800 (PST)\r
+Received: by wibhn6 with SMTP id hn6so1267357wib.2\r
+ for <notmuch@notmuchmail.org>; Sat, 10 Mar 2012 03:05:41 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=abGHG+cDQHnRjuF49w/IsNTgJrmXXA/0Vjxm5mnfdW0=;\r
+ b=IIfrRK0Nq5+8MWTNiudgQcDjbSfztgj/MTRq9hy1T09AQedXEFaTugISIJmvDr4nMP\r
+ HSiWpkfi+MSCkLOu9Cq+4gkBoaKagVNMhWNmONYEuwZyPSll8pLYIynSkPThoeh9HIuC\r
+ itMqOBrT+XVikrBDRv2ww499MnfWXKrsdlUNk/AO7BSibZVUHE3qXx3rsC0zfe/RT2xw\r
+ tUcgpB+bk0BbQRmUOjYVQ5tBaNEXI7//1wP3KQVey+J5FoMTtkL81sCY0DS2e31VNoW7\r
+ r8b4dMvjwHi+J08kLvrFn0pxzoq2RFrJdLIq0i4S8joslRSah5yVyLjeY/qTvCtWmGwK\r
+ HPcQ==\r
+Received: by 10.216.139.129 with SMTP id c1mr3347361wej.48.1331377541532;\r
+ Sat, 10 Mar 2012 03:05:41 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ be4sm24537464wib.8.2012.03.10.03.05.40 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 10 Mar 2012 03:05:40 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] cli: Parsing. Allow true/false parameter for boolean\r
+ options.\r
+Date: Sat, 10 Mar 2012 11:05:32 +0000\r
+Message-Id: <1331377533-30262-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1331377533-30262-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1331377533-30262-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 10 Mar 2012 11:05:43 -0000\r
+\r
+Allow NOTMUCH_OPT_BOOLEAN to take a true or false parameter. In\r
+particular it allows the user to turn off a boolean option with\r
+--option=false.\r
+---\r
+ command-line-arguments.c | 34 ++++++++++++++++++++++++++--------\r
+ 1 files changed, 26 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/command-line-arguments.c b/command-line-arguments.c\r
+index e711414..76b185f 100644\r
+--- a/command-line-arguments.c\r
++++ b/command-line-arguments.c\r
+@@ -28,6 +28,24 @@ _process_keyword_arg (const notmuch_opt_desc_t *arg_desc, const char *arg_str) {\r
+ return FALSE;\r
+ }\r
+ \r
++static notmuch_bool_t\r
++_process_boolean_arg (const notmuch_opt_desc_t *arg_desc, char next, const char *arg_str) {\r
++\r
++ if (next == 0) {\r
++ *((notmuch_bool_t *)arg_desc->output_var) = TRUE;\r
++ return TRUE;\r
++ }\r
++ if (strcmp (arg_str, "false") == 0) {\r
++ *((notmuch_bool_t *)arg_desc->output_var) = FALSE;\r
++ return TRUE;\r
++ }\r
++ if (strcmp (arg_str, "true") == 0) {\r
++ *((notmuch_bool_t *)arg_desc->output_var) = TRUE;\r
++ return TRUE;\r
++ }\r
++ return FALSE;\r
++}\r
++\r
+ /*\r
+ Search for the {pos_arg_index}th position argument, return FALSE if\r
+ that does not exist.\r
+@@ -76,14 +94,15 @@ parse_option (const char *arg,\r
+ char *endptr;\r
+ \r
+ /* Everything but boolean arguments (switches) needs a\r
+- * delimiter, and a non-zero length value\r
++ * delimiter, and a non-zero length value. Boolean\r
++ * arguments may take an optional =true or =false value.\r
+ */\r
+-\r
+- if (try->opt_type != NOTMUCH_OPT_BOOLEAN) {\r
+- if (next != '=' && next != ':') return FALSE;\r
+- if (value[0] == 0) return FALSE;\r
++ if (next != '=' && next != ':' && next != 0) return FALSE;\r
++ if (next == 0) {\r
++ if (try->opt_type != NOTMUCH_OPT_BOOLEAN)\r
++ return FALSE;\r
+ } else {\r
+- if (next != 0) return FALSE;\r
++ if (value[0] == 0) return FALSE;\r
+ }\r
+ \r
+ if (try->output_var == NULL)\r
+@@ -94,8 +113,7 @@ parse_option (const char *arg,\r
+ return _process_keyword_arg (try, value);\r
+ break;\r
+ case NOTMUCH_OPT_BOOLEAN:\r
+- *((notmuch_bool_t *)try->output_var) = TRUE;\r
+- return TRUE;\r
++ return _process_boolean_arg (try, next, value);\r
+ break;\r
+ case NOTMUCH_OPT_INT:\r
+ *((int *)try->output_var) = strtol (value, &endptr, 10);\r
+-- \r
+1.7.9.1\r
+\r