1 From: "Lars Kellogg-Stedman" <lars@seas.harvard.edu>
2 To: notmuch@notmuchmail.org
3 Date: Tue, 17 Nov 2009 20:01:16 -0500
4 Subject: [notmuch] "notmuch help" outputs to stderr?
5 In-Reply-To: <20091118005829.GB25380@dottiness.seas.harvard.edu>
6 References: <20091118005829.GB25380@dottiness.seas.harvard.edu>
7 Message-ID: <20091118010116.GC25380@dottiness.seas.harvard.edu>
9 > I've attached a patch that lets usage() take a FILE * argument so that
10 > you can output to stderr in response to usage errors, and stdout in
11 > response to an explicit request.
13 Whoops, missed a couple of stderr's in that last patch. New one
17 Lars Kellogg-Stedman <lars at seas.harvard.edu>
18 Senior Technologist, Computing and Information Technology
19 Harvard University School of Engineering and Applied Sciences
21 -------------- next part --------------
22 diff --git a/notmuch.c b/notmuch.c
23 index c47e640..446c810 100644
26 @@ -157,23 +157,23 @@ command_t commands[] = {
36 - fprintf (stderr, "Usage: notmuch <command> [args...]\n");
37 - fprintf (stderr, "\n");
38 - fprintf (stderr, "Where <command> and [args...] are as follows:\n");
39 - fprintf (stderr, "\n");
40 + fprintf (out, "Usage: notmuch <command> [args...]\n");
41 + fprintf (out, "\n");
42 + fprintf (out, "Where <command> and [args...] are as follows:\n");
43 + fprintf (out, "\n");
45 for (i = 0; i < ARRAY_SIZE (commands); i++) {
46 command = &commands[i];
48 - fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);
49 + fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);
52 - fprintf (stderr, "Use \"notmuch help <command>\" for more details on each command.\n\n");
53 + fprintf (out, "Use \"notmuch help <command>\" for more details on each command.\n\n");
57 @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])
61 - fprintf (stderr, "The notmuch mail system.\n\n");
63 + fprintf (stdout, "The notmuch mail system.\n\n");
68 @@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])
69 command = &commands[i];
71 if (strcmp (argv[0], command->name) == 0) {
72 - fprintf (stderr, "Help for \"notmuch %s\":\n\n", argv[0]);
73 - fprintf (stderr, "\t%s\t%s\n\n%s\n\n", command->name,
74 + fprintf (stdout, "Help for \"notmuch %s\":\n\n", argv[0]);
75 + fprintf (stdout, "\t%s\t%s\n\n%s\n\n", command->name,
76 command->summary, command->documentation);
79 -------------- next part --------------
80 A non-text attachment was scrubbed...
82 Type: application/pgp-signature
85 URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/8c0e4dc3/attachment.pgp>