1 Return-Path: <m.walters@qmul.ac.uk>
\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 146F4431FC0
\r
6 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:21:38 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 nEuDQMgFhL2t for <notmuch@notmuchmail.org>;
\r
17 Tue, 21 May 2013 12:21:30 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id DED19431FBF
\r
22 for <notmuch@notmuchmail.org>; Tue, 21 May 2013 12:21:29 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1Ues7b-0006lY-LW; Tue, 21 May 2013 20:21:27 +0100
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1Ues7b-0002Cp-AM; Tue, 21 May 2013 20:21:19 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
33 Subject: Re: [RFC PATCH 1/1] add --stderr option
\r
34 In-Reply-To: <1369161750-12342-1-git-send-email-tomi.ollila@iki.fi>
\r
35 References: <1369161750-12342-1-git-send-email-tomi.ollila@iki.fi>
\r
36 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1
\r
37 (x86_64-pc-linux-gnu)
\r
38 Date: Tue, 21 May 2013 20:21:17 +0100
\r
39 Message-ID: <87d2skuok2.fsf@qmul.ac.uk>
\r
41 Content-Type: text/plain; charset=us-ascii
\r
42 X-Sender-Host-Address: 93.97.24.31
\r
43 X-QM-SPAM-Info: Sender has good ham record. :)
\r
44 X-QM-Body-MD5: 1dc80c8599b12274e6725dc7cc7e41a8 (of first 20000 bytes)
\r
45 X-SpamAssassin-Score: -0.1
\r
46 X-SpamAssassin-SpamBar: /
\r
47 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
49 spam. We require at least 5.0 points to mark a message as spam.
\r
50 This message scored -0.1 points.
\r
51 Summary of the scoring:
\r
52 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
53 provider * (markwalters1009[at]gmail.com)
\r
54 * -0.1 AWL AWL: From: address is in the auto white-list
\r
55 X-QM-Scan-Virus: ClamAV says the message is clean
\r
56 Cc: tomi.ollila@iki.fi
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Tue, 21 May 2013 19:21:38 -0000
\r
72 On Tue, 21 May 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
75 > Note quickly written untested code (but compiles!), just to show an idea...
\r
77 > This implements (i hope) curl(1) --stderr option in notmuch(1):
\r
80 > Redirect all writes to stderr to the specified file instead. If
\r
81 > the file name is a plain '-', it is instead written to stdout.
\r
83 > This would be useful in emacs interface.
\r
85 > Please comment; I'll do help and manual page changes (and NEWS) if
\r
86 > this is good idea :D
\r
88 I think this looks really nice. +1 for something like this.
\r
95 > notmuch.c | 20 ++++++++++++++++++++
\r
96 > 1 file changed, 20 insertions(+)
\r
98 > diff --git a/notmuch.c b/notmuch.c
\r
99 > index f51a84f..3b8bd5d 100644
\r
102 > @@ -21,6 +21,7 @@
\r
105 > #include "notmuch-client.h"
\r
106 > +#include <fcntl.h>
\r
108 > typedef int (*command_function_t) (notmuch_config_t *config, int argc, char *argv[]);
\r
110 > @@ -259,6 +260,7 @@ main (int argc, char *argv[])
\r
111 > const char *command_name = NULL;
\r
112 > command_t *command;
\r
113 > char *config_file_name = NULL;
\r
114 > + char *stderr_file = NULL;
\r
115 > notmuch_config_t *config;
\r
116 > notmuch_bool_t print_help=FALSE, print_version=FALSE;
\r
118 > @@ -268,6 +270,7 @@ main (int argc, char *argv[])
\r
119 > { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },
\r
120 > { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },
\r
121 > { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },
\r
122 > + { NOTMUCH_OPT_STRING, &stderr_file, "stderr", 'c', 0 },
\r
123 > { 0, 0, 0, 0, 0 }
\r
126 > @@ -295,6 +298,23 @@ main (int argc, char *argv[])
\r
130 > + if (stderr_file) {
\r
131 > + if (strcmp (stderr_file, "-") == 0)
\r
132 > + dup2 (STDOUT_FILENO, STDERR_FILENO);
\r
134 > + int fd = open (stderr_file, O_WRONLY|O_CREAT|O_APPEND, 0644);
\r
136 > + fprintf (stderr, "Error: Cannot redirect stderr to '%s': %s\n",
\r
137 > + stderr_file, strerror(errno));
\r
140 > + if (fd != STDERR_FILENO) {
\r
141 > + dup2 (fd, STDERR_FILENO);
\r
147 > if (opt_index < argc)
\r
148 > command_name = argv[opt_index];
\r
153 > _______________________________________________
\r
154 > notmuch mailing list
\r
155 > notmuch@notmuchmail.org
\r
156 > http://notmuchmail.org/mailman/listinfo/notmuch
\r