1 Return-Path: <cworth@cworth.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 6F726431FC4
\r
6 for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 08:24:52 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id pk3R2XALbuQe; Sat, 21 Nov 2009 08:24:51 -0800 (PST)
\r
11 Received: from localhost.localdomain (localhost [127.0.0.1])
\r
12 by olra.theworths.org (Postfix) with ESMTP id 168D1431FC0;
\r
13 Sat, 21 Nov 2009 08:24:50 -0800 (PST)
\r
14 From: Carl Worth <cworth@cworth.org>
\r
15 To: notmuch@notmuchmail.org
\r
16 Date: Sat, 21 Nov 2009 17:24:18 +0100
\r
17 Message-Id: <1258820659-24473-2-git-send-email-cworth@cworth.org>
\r
18 X-Mailer: git-send-email 1.6.5.2
\r
19 In-Reply-To: <1258820659-24473-1-git-send-email-cworth@cworth.org>
\r
20 References: <1258820659-24473-1-git-send-email-cworth@cworth.org>
\r
21 Subject: [notmuch] [PATCH 1/2] notmuch search: Rename the --max-threads
\r
23 X-BeenThere: notmuch@notmuchmail.org
\r
24 X-Mailman-Version: 2.1.12
\r
26 List-Id: "Use and development of the notmuch mail system."
\r
27 <notmuch.notmuchmail.org>
\r
28 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
29 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
30 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
31 List-Post: <mailto:notmuch@notmuchmail.org>
\r
32 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
33 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
34 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
35 X-List-Received-Date: Sat, 21 Nov 2009 16:24:52 -0000
\r
37 The idea is to make this a little more general so that different
\r
38 commands can use identical option names.
\r
40 notmuch-search.c | 22 +++++++++++-----------
\r
42 2 files changed, 12 insertions(+), 12 deletions(-)
\r
44 diff --git a/notmuch-search.c b/notmuch-search.c
\r
45 index 2b1c0fe..845321d 100644
\r
46 --- a/notmuch-search.c
\r
47 +++ b/notmuch-search.c
\r
48 @@ -29,7 +29,7 @@ static void
\r
49 do_search_threads (const void *ctx,
\r
50 notmuch_query_t *query,
\r
51 notmuch_sort_t sort,
\r
52 - int first, int max_threads)
\r
53 + int first, int max)
\r
55 notmuch_thread_t *thread;
\r
56 notmuch_threads_t *threads;
\r
57 @@ -37,7 +37,7 @@ do_search_threads (const void *ctx,
\r
59 const char *relative_date;
\r
61 - for (threads = notmuch_query_search_threads (query, first, max_threads);
\r
62 + for (threads = notmuch_query_search_threads (query, first, max);
\r
63 notmuch_threads_has_more (threads);
\r
64 notmuch_threads_advance (threads))
\r
66 @@ -83,7 +83,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
67 notmuch_database_t *notmuch;
\r
68 notmuch_query_t *query;
\r
70 - int i, first = 0, max_threads = -1;
\r
71 + int i, first = 0, max = -1;
\r
73 notmuch_sort_t sort = NOTMUCH_SORT_NEWEST_FIRST;
\r
75 @@ -99,11 +99,11 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
76 fprintf (stderr, "Invalid value for --first: %s\n", opt);
\r
79 - } else if (STRNCMP_LITERAL (argv[i], "--max-threads=") == 0) {
\r
80 - opt = argv[i] + sizeof ("--max-threads=") - 1;
\r
81 - max_threads = strtoul (opt, &end, 10);
\r
82 + } else if (STRNCMP_LITERAL (argv[i], "--max=") == 0) {
\r
83 + opt = argv[i] + sizeof ("--max=") - 1;
\r
84 + max = strtoul (opt, &end, 10);
\r
85 if (*opt == '\0' || *end != '\0') {
\r
86 - fprintf (stderr, "Invalid value for --max-threads: %s\n", opt);
\r
87 + fprintf (stderr, "Invalid value for --max: %s\n", opt);
\r
90 } else if (STRNCMP_LITERAL (argv[i], "--sort=") == 0) {
\r
91 @@ -151,17 +151,17 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
93 notmuch_query_set_sort (query, sort);
\r
95 - if (max_threads < 0 || max_threads > NOTMUCH_SHOW_INITIAL_BURST)
\r
96 + if (max < 0 || max > NOTMUCH_SHOW_INITIAL_BURST)
\r
98 do_search_threads (ctx, query, sort,
\r
99 first, NOTMUCH_SHOW_INITIAL_BURST);
\r
101 first += NOTMUCH_SHOW_INITIAL_BURST;
\r
102 - if (max_threads > 0)
\r
103 - max_threads -= NOTMUCH_SHOW_INITIAL_BURST;
\r
105 + max -= NOTMUCH_SHOW_INITIAL_BURST;
\r
108 - do_search_threads (ctx, query, sort, first, max_threads);
\r
109 + do_search_threads (ctx, query, sort, first, max);
\r
111 notmuch_query_destroy (query);
\r
112 notmuch_database_close (notmuch);
\r
113 diff --git a/notmuch.c b/notmuch.c
\r
114 index 5cc8e4c..14d4865 100644
\r
117 @@ -139,7 +139,7 @@ command_t commands[] = {
\r
119 "\t\tSupported options for search include:\n"
\r
121 - "\t\t--max-threads=<value>\n"
\r
122 + "\t\t--max=<value>\n"
\r
124 "\t\t\tRestricts displayed search results to a subset\n"
\r
125 "\t\t\tof the results that would match the terms.\n"
\r