1 Return-Path: <jani@nikula.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 08154429E21
\r
6 for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 14:47:36 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id ybjKceXU+GKr for <notmuch@notmuchmail.org>;
\r
17 Sun, 13 Nov 2011 14:47:35 -0800 (PST)
\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 4278D431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 14:47:35 -0800 (PST)
\r
23 Received: by mail-bw0-f53.google.com with SMTP id q10so6354254bka.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 14:47:34 -0800 (PST)
\r
25 Received: by 10.205.138.140 with SMTP id is12mr8846828bkc.139.1321224454791;
\r
26 Sun, 13 Nov 2011 14:47:34 -0800 (PST)
\r
27 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.
\r
29 by mx.google.com with ESMTPS id q6sm28076066bka.6.2011.11.13.14.47.32
\r
30 (version=SSLv3 cipher=OTHER); Sun, 13 Nov 2011 14:47:33 -0800 (PST)
\r
31 From: Jani Nikula <jani@nikula.org>
\r
32 To: notmuch@notmuchmail.org,
\r
34 Subject: [PATCH 1/6] cli: notmuch new: use getopt_long for parsing command
\r
36 Date: Mon, 14 Nov 2011 00:47:21 +0200
\r
38 <828501bd94ae962dda51fd470cb248921e1c6b79.1321223343.git.jani@nikula.org>
\r
39 X-Mailer: git-send-email 1.7.5.4
\r
40 In-Reply-To: <cover.1321223343.git.jani@nikula.org>
\r
41 References: <cover.1321223343.git.jani@nikula.org>
\r
42 In-Reply-To: <cover.1321223343.git.jani@nikula.org>
\r
43 References: <cover.1321223343.git.jani@nikula.org>
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Sun, 13 Nov 2011 22:47:36 -0000
\r
58 Signed-off-by: Jani Nikula <jani@nikula.org>
\r
60 notmuch-client.h | 1 +
\r
61 notmuch-new.c | 20 +++++++++++++++-----
\r
62 2 files changed, 16 insertions(+), 5 deletions(-)
\r
64 diff --git a/notmuch-client.h b/notmuch-client.h
\r
65 index b50cb38..eb16f0d 100644
\r
66 --- a/notmuch-client.h
\r
67 +++ b/notmuch-client.h
\r
69 #include <sys/stat.h>
\r
70 #include <sys/time.h>
\r
72 +#include <getopt.h>
\r
76 diff --git a/notmuch-new.c b/notmuch-new.c
\r
77 index 81a9350..145aa64 100644
\r
80 @@ -815,16 +815,26 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
81 add_files_state.verbose = 0;
\r
82 add_files_state.output_is_a_tty = isatty (fileno (stdout));
\r
84 - argc--; argv++; /* skip subcommand argument */
\r
87 + static struct option options[] = {
\r
88 + { "verbose", no_argument, NULL, 0 },
\r
89 + { NULL, 0, NULL, 0 },
\r
92 + opt = getopt_long (argc, argv, "", options, NULL);
\r
96 - for (i = 0; i < argc && argv[i][0] == '-'; i++) {
\r
97 - if (STRNCMP_LITERAL (argv[i], "--verbose") == 0) {
\r
100 add_files_state.verbose = 1;
\r
102 - fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
\r
109 config = notmuch_config_open (ctx, NULL, NULL);
\r
110 if (config == NULL)
\r