Re: bug#6214: 23.1; json-read-string crashes emacs with long string
[notmuch-archives.git] / 13 / dd6222979e497bc1d90551ea8edefe1cfe3b22
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 75784431FBC\r
6         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 17:01:19 -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 IoYHzHoKBskU for <notmuch@notmuchmail.org>;\r
11         Tue, 17 Nov 2009 17:01:18 -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 7E033431FAE\r
15         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 17:01:18 -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         nAI11Gkj008772\r
20         for <notmuch@notmuchmail.org>; Tue, 17 Nov 2009 20:01:16 -0500\r
21 Received: by dottiness.seas.harvard.edu (sSMTP sendmail emulation);\r
22         Tue, 17 Nov 2009 20:01:16 -0500\r
23 Date: Tue, 17 Nov 2009 20:01:16 -0500\r
24 From: Lars Kellogg-Stedman <lars@seas.harvard.edu>\r
25 To: notmuch <notmuch@notmuchmail.org>\r
26 Message-ID: <20091118010116.GC25380@dottiness.seas.harvard.edu>\r
27 References: <20091118005829.GB25380@dottiness.seas.harvard.edu>\r
28 MIME-Version: 1.0\r
29 Content-Type: multipart/signed; micalg=pgp-sha256;\r
30         protocol="application/pgp-signature"; boundary="ZInfyf7laFu/Kiw7"\r
31 Content-Disposition: inline\r
32 In-Reply-To: <20091118005829.GB25380@dottiness.seas.harvard.edu>\r
33 User-Agent: Mutt/1.5.19 (2009-01-05)\r
34 Subject: Re: [notmuch] "notmuch help" outputs to stderr?\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.12\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Wed, 18 Nov 2009 01:01:19 -0000\r
48 \r
49 \r
50 --ZInfyf7laFu/Kiw7\r
51 Content-Type: multipart/mixed; boundary="KdquIMZPjGJQvRdI"\r
52 Content-Disposition: inline\r
53 \r
54 \r
55 --KdquIMZPjGJQvRdI\r
56 Content-Type: text/plain; charset=us-ascii\r
57 Content-Disposition: inline\r
58 Content-Transfer-Encoding: quoted-printable\r
59 \r
60 > I've attached a patch that lets usage() take a FILE * argument so that\r
61 > you can output to stderr in response to usage errors, and stdout in\r
62 > response to an explicit request.\r
63 \r
64 Whoops, missed a couple of stderr's in that last patch.  New one\r
65 attached.\r
66 \r
67 --=20\r
68 Lars Kellogg-Stedman <lars@seas.harvard.edu>\r
69 Senior Technologist, Computing and Information Technology\r
70 Harvard University School of Engineering and Applied Sciences\r
71 \r
72 \r
73 --KdquIMZPjGJQvRdI\r
74 Content-Type: text/plain; charset=us-ascii\r
75 Content-Disposition: attachment; filename="notmuch-help.patch"\r
76 Content-Transfer-Encoding: quoted-printable\r
77 \r
78 diff --git a/notmuch.c b/notmuch.c\r
79 index c47e640..446c810 100644\r
80 --- a/notmuch.c\r
81 +++ b/notmuch.c\r
82 @@ -157,23 +157,23 @@ command_t commands[] =3D {\r
83  };\r
84 =20\r
85  static void\r
86 -usage (void)\r
87 +usage (FILE *out)\r
88  {\r
89      command_t *command;\r
90      unsigned int i;\r
91 =20\r
92 -    fprintf (stderr, "Usage: notmuch <command> [args...]\n");\r
93 -    fprintf (stderr, "\n");\r
94 -    fprintf (stderr, "Where <command> and [args...] are as follows:\n");\r
95 -    fprintf (stderr, "\n");\r
96 +    fprintf (out, "Usage: notmuch <command> [args...]\n");\r
97 +    fprintf (out, "\n");\r
98 +    fprintf (out, "Where <command> and [args...] are as follows:\n");\r
99 +    fprintf (out, "\n");\r
100 =20\r
101      for (i =3D 0; i < ARRAY_SIZE (commands); i++) {\r
102         command =3D &commands[i];\r
103 =20\r
104 -       fprintf (stderr, "\t%s\t%s\n\n", command->name, command->summary);\r
105 +       fprintf (out, "\t%s\t%s\n\n", command->name, command->summary);\r
106      }\r
107 =20\r
108 -    fprintf (stderr, "Use \"notmuch help <command>\" for more details on e=\r
109 ach command.\n\n");\r
110 +    fprintf (out, "Use \"notmuch help <command>\" for more details on each=\r
111  command.\n\n");\r
112  }\r
113 =20\r
114  static int\r
115 @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, cha=\r
116 r *argv[])\r
117      unsigned int i;\r
118 =20\r
119      if (argc =3D=3D 0) {\r
120 -       fprintf (stderr, "The notmuch mail system.\n\n");\r
121 -       usage ();\r
122 +       fprintf (stdout, "The notmuch mail system.\n\n");\r
123 +       usage (stdout);\r
124         return 0;\r
125      }\r
126 =20\r
127 @@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, cha=\r
128 r *argv[])\r
129         command =3D &commands[i];\r
130 =20\r
131         if (strcmp (argv[0], command->name) =3D=3D 0) {\r
132 -           fprintf (stderr, "Help for \"notmuch %s\":\n\n", argv[0]);\r
133 -           fprintf (stderr, "\t%s\t%s\n\n%s\n\n", command->name,\r
134 +           fprintf (stdout, "Help for \"notmuch %s\":\n\n", argv[0]);\r
135 +           fprintf (stdout, "\t%s\t%s\n\n%s\n\n", command->name,\r
136                      command->summary, command->documentation);\r
137             return 0;\r
138         }\r
139 \r
140 --KdquIMZPjGJQvRdI--\r
141 \r
142 --ZInfyf7laFu/Kiw7\r
143 Content-Type: application/pgp-signature\r
144 Content-Disposition: inline\r
145 \r
146 -----BEGIN PGP SIGNATURE-----\r
147 Version: GnuPG v1.4.9 (GNU/Linux)\r
148 \r
149 iQEcBAEBCAAGBQJLA0dcAAoJENdGlQYxQazY4nIIAIBCds86/uTmnouvyoPruUUR\r
150 Bg5mXcnjuopz1Nwotl9s9U5sGeZuZngxyEvDz1Z1aTEjwab8ndNTf1xCwIoqBs+l\r
151 i/sc4nPYubLdy1Ab/84DKVtCSbj+v5rtqhegwUWV7S1BY7t8dKNPNv7YBg7P0Azs\r
152 6s3CUxDV5eJCcxCGxxWHH8JDKRf7rDs6vzDwyPWLxlg1Xb1lEM/sRgPCKiShPdO3\r
153 Ak2hECusjskALhSDYX8/FLMd9HwLBC13sfWuSi/pHUAIOI2jru2p5sXrVSlTnFIJ\r
154 fiMbPhKWiEaJj2kmm4pRwAhbTWp/J8ZvXWp0AyosxXQhQUWqujiyxgfiXS70SdQ=\r
155 =t3Yc\r
156 -----END PGP SIGNATURE-----\r
157 \r
158 --ZInfyf7laFu/Kiw7--\r