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