[notmuch] [PATCH 1/2] notmuch search: Rename the --max-threads option to --max.
authorCarl Worth <cworth@cworth.org>
Sat, 21 Nov 2009 16:24:18 +0000 (17:24 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:38 +0000 (09:35 -0800)
2c/691f72da6225640cd83426eb069fdc2447435e [new file with mode: 0644]

diff --git a/2c/691f72da6225640cd83426eb069fdc2447435e b/2c/691f72da6225640cd83426eb069fdc2447435e
new file mode 100644 (file)
index 0000000..31aec77
--- /dev/null
@@ -0,0 +1,128 @@
+Return-Path: <cworth@cworth.org>\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 6F726431FC4\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 08:24:52 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 pk3R2XALbuQe; Sat, 21 Nov 2009 08:24:51 -0800 (PST)\r
+Received: from localhost.localdomain (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 168D1431FC0;\r
+       Sat, 21 Nov 2009 08:24:50 -0800 (PST)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: notmuch@notmuchmail.org\r
+Date: Sat, 21 Nov 2009 17:24:18 +0100\r
+Message-Id: <1258820659-24473-2-git-send-email-cworth@cworth.org>\r
+X-Mailer: git-send-email 1.6.5.2\r
+In-Reply-To: <1258820659-24473-1-git-send-email-cworth@cworth.org>\r
+References: <1258820659-24473-1-git-send-email-cworth@cworth.org>\r
+Subject: [notmuch] [PATCH 1/2] notmuch search: Rename the --max-threads\r
+       option to --max.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 21 Nov 2009 16:24:52 -0000\r
+\r
+The idea is to make this a little more general so that different\r
+commands can use identical option names.\r
+---\r
+ notmuch-search.c |   22 +++++++++++-----------\r
+ notmuch.c        |    2 +-\r
+ 2 files changed, 12 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 2b1c0fe..845321d 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -29,7 +29,7 @@ static void\r
+ do_search_threads (const void *ctx,\r
+                  notmuch_query_t *query,\r
+                  notmuch_sort_t sort,\r
+-                 int first, int max_threads)\r
++                 int first, int max)\r
+ {\r
+     notmuch_thread_t *thread;\r
+     notmuch_threads_t *threads;\r
+@@ -37,7 +37,7 @@ do_search_threads (const void *ctx,\r
+     time_t date;\r
+     const char *relative_date;\r
\r
+-    for (threads = notmuch_query_search_threads (query, first, max_threads);\r
++    for (threads = notmuch_query_search_threads (query, first, max);\r
+        notmuch_threads_has_more (threads);\r
+        notmuch_threads_advance (threads))\r
+     {\r
+@@ -83,7 +83,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+     notmuch_database_t *notmuch;\r
+     notmuch_query_t *query;\r
+     char *query_str;\r
+-    int i, first = 0, max_threads = -1;\r
++    int i, first = 0, max = -1;\r
+     char *opt, *end;\r
+     notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;\r
\r
+@@ -99,11 +99,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
+               fprintf (stderr, "Invalid value for --first: %s\n", opt);\r
+               return 1;\r
+           }\r
+-      } else if (STRNCMP_LITERAL (argv[i], "--max-threads=") == 0) {\r
+-          opt = argv[i] + sizeof ("--max-threads=") - 1;\r
+-          max_threads = strtoul (opt, &end, 10);\r
++      } else if (STRNCMP_LITERAL (argv[i], "--max=") == 0) {\r
++          opt = argv[i] + sizeof ("--max=") - 1;\r
++          max = strtoul (opt, &end, 10);\r
+           if (*opt == '\0' || *end != '\0') {\r
+-              fprintf (stderr, "Invalid value for --max-threads: %s\n", opt);\r
++              fprintf (stderr, "Invalid value for --max: %s\n", opt);\r
+               return 1;\r
+           }\r
+       } else if (STRNCMP_LITERAL (argv[i], "--sort=") == 0) {\r
+@@ -151,17 +151,17 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
\r
+     notmuch_query_set_sort (query, sort);\r
\r
+-    if (max_threads < 0 || max_threads > NOTMUCH_SHOW_INITIAL_BURST)\r
++    if (max < 0 || max > NOTMUCH_SHOW_INITIAL_BURST)\r
+     {\r
+       do_search_threads (ctx, query, sort,\r
+                          first, NOTMUCH_SHOW_INITIAL_BURST);\r
\r
+       first += NOTMUCH_SHOW_INITIAL_BURST;\r
+-      if (max_threads > 0)\r
+-          max_threads -= NOTMUCH_SHOW_INITIAL_BURST;\r
++      if (max > 0)\r
++          max -= NOTMUCH_SHOW_INITIAL_BURST;\r
+     }\r
\r
+-    do_search_threads (ctx, query, sort, first, max_threads);\r
++    do_search_threads (ctx, query, sort, first, max);\r
\r
+     notmuch_query_destroy (query);\r
+     notmuch_database_close (notmuch);\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 5cc8e4c..14d4865 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -139,7 +139,7 @@ command_t commands[] = {\r
+       "\n"\r
+       "\t\tSupported options for search include:\n"\r
+       "\n"\r
+-      "\t\t--max-threads=<value>\n"\r
++      "\t\t--max=<value>\n"\r
+       "\n"\r
+       "\t\t\tRestricts displayed search results to a subset\n"\r
+       "\t\t\tof the results that would match the terms.\n"\r
+-- \r
+1.6.5.2\r
+\r