]> git.notmuchmail.org Git - notmuch/blob - test/corpus/24
test: Add a corpus of email messages to be used in testing.
[notmuch] / test / corpus / 24
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>
8
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.
12
13 Whoops, missed a couple of stderr's in that last patch.  New one
14 attached.
15
16 -- 
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
20
21 -------------- next part --------------
22 diff --git a/notmuch.c b/notmuch.c
23 index c47e640..446c810 100644
24 --- a/notmuch.c
25 +++ b/notmuch.c
26 @@ -157,23 +157,23 @@ command_t commands[] = {
27  };
28  
29  static void
30 -usage (void)
31 +usage (FILE *out)
32  {
33      command_t *command;
34      unsigned int i;
35  
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");
44  
45      for (i = 0; i < ARRAY_SIZE (commands); i++) {
46         command = &commands[i];
47  
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);
50      }
51  
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");
54  }
55  
56  static int
57 @@ -183,8 +183,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])
58      unsigned int i;
59  
60      if (argc == 0) {
61 -       fprintf (stderr, "The notmuch mail system.\n\n");
62 -       usage ();
63 +       fprintf (stdout, "The notmuch mail system.\n\n");
64 +       usage (stdout);
65         return 0;
66      }
67  
68 @@ -192,8 +192,8 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])
69         command = &commands[i];
70  
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);
77             return 0;
78         }
79 -------------- next part --------------
80 A non-text attachment was scrubbed...
81 Name: not available
82 Type: application/pgp-signature
83 Size: 489 bytes
84 Desc: not available
85 URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/8c0e4dc3/attachment.pgp>
86