Fix out-of-bounds error when incorporating email from stdin
[mmh] / sbr / print_help.c
1 /*
2 ** print_help.c -- print a help message, and possibly the
3 **              -- profile/context entries for this command
4 **
5 ** This code is Copyright (c) 2002, by the authors of nmh.  See the
6 ** COPYRIGHT file in the root directory of the nmh distribution for
7 ** complete copyright information.
8 */
9
10 #include <h/mh.h>
11
12
13 void
14 print_help(char *str, struct swit *swp, int print_context)
15 {
16         char *s;
17
18         /* print Usage string */
19         printf("Usage: %s\n", str);
20
21         /* print all the switches */
22         printf("  switches are:\n");
23         print_sw(ALL, swp, "-", stdout);
24
25         /*
26         ** check if we should print any profile entries
27         */
28         if (print_context && (s = context_find(invo_name)))
29                 printf("\nProfile: %s\n", s);
30 }