Debian Codegraph @

texk/web2c/lib/usage.c

raw
1 /* usage.c: Output a help message (from help.h).
2
3 Modified in 2001 by O. Weber.
4 Written in 1995 by K. Berry. Public domain. */
5
6 #include <w2c/config.h>
7
8 /* Print a message about trying --help with program name STR and exit
9 with bad status. */
10
11 void
12 usage (const_string str)
13 {
14 fprintf (stderr, "Try `%s --help' for more information.\n", str);
15 uexit (1);
16 }
17
18
19 /* Print MESSAGE, a NULL-terminated array of strings which make up the
20 help message, and exit successfully. Each string is printed on a
21 separate line. We use arrays instead of a single string to work
22 around compiler limitations (sigh). Then print a line about sending
23 bug reports to BUG_EMAIL, which defaults to [email protected] if passed
24 NULL. If BUG_EMAIL is @tug.org, also output a url to the mailing list. */
25
26 void
27 usagehelp (const_string *message, const_string bug_email)
28 {
29 if (!bug_email) {
30 bug_email = "[email protected]";
31 }
32
33 while (*message) {
34 printf ("%s\n", *message);
35 ++message;
36 }
37
38 printf ("\nEmail bug reports to %s", bug_email);
39 if (strlen (bug_email) > 9) {
40 const_string domain = strchr (bug_email, '@');
41 if (domain && strcmp (domain, "@tug.org") == 0) {
42 const_string ptr;
43
44 printf (" (https://lists.tug.org/");
45 for (ptr = bug_email; ptr < domain; ptr++) {
46 putchar (*ptr);
47 }
48 printf (")");
49 }
50 }
51 puts (".");
52 uexit (0);
53 }