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