]>
Commit | Line | Data |
---|---|---|
58b9d8ef | 1 | /* $Header$ |
2 | * | |
3 | * Copyright 1991 by the Massachusetts Institute of Technology. | |
4 | * | |
5 | * For further information on copyright and distribution | |
6 | * see the file mit-copyright.h | |
7 | */ | |
8 | ||
9 | #include <mit-copyright.h> | |
10 | #include <stdio.h> | |
11 | #include <Xm/Xm.h> | |
12 | #include "mmoira.h" | |
13 | ||
14 | ||
15 | help(node) | |
16 | char *node; | |
17 | { | |
18 | FILE *helpfile = NULL; | |
19 | char buf[1024], key[32]; | |
20 | ||
21 | sprintf(key, "*%s\n", node); | |
22 | helpfile = fopen(HELPFILE, "r"); | |
23 | if (helpfile == NULL) { | |
24 | display_error("Sorry, help is currently unavailable.\n"); | |
25 | return; | |
26 | } | |
27 | while (fgets(buf, sizeof(buf), helpfile)) | |
28 | if (!strcmp(buf, key)) | |
29 | break; | |
30 | if (strcmp(buf, key)) { | |
31 | sprintf(buf, "Sorry, unable to find help on topic \"%s\".\n", node); | |
32 | display_error(buf); | |
33 | fclose(helpfile); | |
34 | return; | |
35 | } | |
36 | while (fgets(buf, sizeof(buf), helpfile)) | |
37 | if (buf[0] == '*') | |
38 | break; | |
39 | else | |
40 | fprintf(stderr, buf); | |
41 | fclose(helpfile); | |
42 | return; | |
43 | } | |
44 | ||
45 | help_form_callback(dummy, form) | |
46 | int dummy; | |
47 | EntryForm *form; | |
48 | { | |
49 | help(form->formname); | |
50 | } | |
51 |