Re: [PATCH v4 01/16] add util/search-path.{c, h} to test for executables in $PATH
[notmuch-archives.git] / 97 / cf56221f6cbfffe452567526822480fca88344
1 Return-Path: <lars@seas.harvard.edu>\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 382FC431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 16:58:31 -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 SP9jWc9RTkoz for <notmuch@notmuchmail.org>;\r
11         Tue, 17 Nov 2009 16:58:30 -0800 (PST)\r
12 Received: from smtp-outbound.seas.harvard.edu (smtp-outbound.seas.harvard.edu\r
13         [140.247.51.171])\r
14         by olra.theworths.org (Postfix) with ESMTP id 80C56431FAE\r
15         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 16:58:30 -0800 (PST)\r
16 Received: from dottiness.seas.harvard.edu (dottiness.seas.harvard.edu\r
17         [140.247.52.224])\r
18         by smtp-outbound.seas.harvard.edu (8.13.8/8.13.8) with SMTP id\r
19         nAI0wTmG008606\r
20         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 19:58:29 -0500\r
21 Received: by dottiness.seas.harvard.edu (sSMTP sendmail emulation);\r
22         Tue, 17 Nov 2009 19:58:29 -0500\r
23 Date: Tue, 17 Nov 2009 19:58:29 -0500\r
24 From: Lars Kellogg-Stedman <lars@seas.harvard.edu>\r
25 To: notmuch <notmuch@notmuchmail.org>\r
26 Message-ID: <20091118005829.GB25380@dottiness.seas.harvard.edu>\r
27 MIME-Version: 1.0\r
28 Content-Type: multipart/signed; micalg=pgp-sha256;\r
29         protocol="application/pgp-signature"; boundary="L6iaP+gRLNZHKoI4"\r
30 Content-Disposition: inline\r
31 User-Agent: Mutt/1.5.19 (2009-01-05)\r
32 Subject: [notmuch] "notmuch help" outputs to stderr?\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.12\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Wed, 18 Nov 2009 00:58:31 -0000\r
46 \r
47 \r
48 --L6iaP+gRLNZHKoI4\r
49 Content-Type: multipart/mixed; boundary="z6Eq5LdranGa6ru8"\r
50 Content-Disposition: inline\r
51 \r
52 \r
53 --z6Eq5LdranGa6ru8\r
54 Content-Type: text/plain; charset=us-ascii\r
55 Content-Disposition: inline\r
56 Content-Transfer-Encoding: quoted-printable\r
57 \r
58 I'm just noticing that 'notmuch help ...' outputs to stderr, which\r
59 isn't terribly intuitive.  For example, the obvious invocation:\r
60 \r
61   notmuch help | less\r
62 \r
63 =2E..isn't terribly helpful.\r
64 \r
65 I've attached a patch that lets usage() take a FILE * argument so that\r
66 you can output to stderr in response to usage errors, and stdout in\r
67 response to an explicit request.\r
68 \r
69 --=20\r
70 Lars Kellogg-Stedman <lars@seas.harvard.edu>\r
71 Senior Technologist, Computing and Information Technology\r
72 Harvard University School of Engineering and Applied Sciences\r
73 \r
74 \r
75 --z6Eq5LdranGa6ru8\r
76 Content-Type: text/plain; charset=us-ascii\r
77 Content-Disposition: attachment; filename="notmuch-help.patch"\r
78 Content-Transfer-Encoding: quoted-printable\r
79 \r
80 diff --git a/notmuch.c b/notmuch.c\r
81 index c47e640..a35cb99 100644\r
82 --- a/notmuch.c\r
83 +++ b/notmuch.c\r
84 @@ -157,23 +157,23 @@ command_t commands[] =3D {\r
85  };\r
86 =20\r
87  static void\r
88 -usage (void)\r
89 +usage (FILE *out)\r
90  {\r
91      command_t *command;\r
92      unsigned int i;\r
93 =20\r
94 -    fprintf (stderr, "Usage: notmuch <command> [args...]\n");\r
95 -    fprintf (stderr, "\n");\r
96 -    fprintf (stderr, "Where <command> and [args...] are as follows:\n");\r
97 -    fprintf (stderr, "\n");\r
98 +    fprintf (out, "Usage: notmuch <command> [args...]\n");\r
99 +    fprintf (out, "\n");\r
100 +    fprintf (out, "Where <command> and [args...] are as follows:\n");\r
101 +    fprintf (out, "\n");\r
102 =20\r
103      for (i =3D 0; i < ARRAY_SIZE (commands); i++) {\r
104         command =3D &commands[i];\r
105 =20\r
106 -       fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);\r
107 +       fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);\r
108      }\r
109 =20\r
110 -    fprintf (stderr, "Use \"notmuch help <command>\" for more details on e=\r
111 ach command.\n\n");\r
112 +    fprintf (out, "Use \"notmuch help <command>\" for more details on each=\r
113  command.\n\n");\r
114  }\r
115 =20\r
116  static int\r
117 @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, cha=\r
118 r *argv[])\r
119      unsigned int i;\r
120 =20\r
121      if (argc =3D=3D 0) {\r
122 -       fprintf (stderr, "The notmuch mail system.\n\n");\r
123 -       usage ();\r
124 +       fprintf (stdout, "The notmuch mail system.\n\n");\r
125 +       usage (stdout);\r
126         return 0;\r
127      }\r
128 =20\r
129 \r
130 --z6Eq5LdranGa6ru8--\r
131 \r
132 --L6iaP+gRLNZHKoI4\r
133 Content-Type: application/pgp-signature\r
134 Content-Disposition: inline\r
135 \r
136 -----BEGIN PGP SIGNATURE-----\r
137 Version: GnuPG v1.4.9 (GNU/Linux)\r
138 \r
139 iQEcBAEBCAAGBQJLA0a1AAoJENdGlQYxQazYr78IAJtqTWIpBqSdOWqTzt/r4XNn\r
140 KJ5mWAoNfq4H+3kx3xoWOFYS7qAYeJoHQWCDbMdb+zEXvPX6hMFn9+OxRN+N5FdQ\r
141 uxGTugSG9xSsK28oGDCQUtr5uheo+tH0jygPjI+LTD97vjUYS4K2qzhLGFJmpLcj\r
142 1akMJXM0gSdPZT8dJyjxvC15pgboLspE4+b6jexXmd4UoFvXgqvjkYHeV4Wk+s0L\r
143 xu+HkCGXL9WHYc3t171fFAru4Zd1AUxFQl4BZ2Y+OqRZUrD28Mtz3zGQxbJQoifl\r
144 JFrgPAWioLN71SkVq/y+efjvGSl0osPpKU5dftMmyY1zV7k7mMlO08ZSJU+wANA=\r
145 =Iijt\r
146 -----END PGP SIGNATURE-----\r
147 \r
148 --L6iaP+gRLNZHKoI4--\r