source: trunk/minix/commands/elle/eehelp.c@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 1.7 KB
Line 
1/* ELLE - Copyright 1982, 1987 by Ken Harrenstien, SRI International
2 * This software is quasi-public; it may be used freely with
3 * like software, but may NOT be sold or made part of licensed
4 * products without permission of the author.
5 */
6/* EEHELP - Help function
7 */
8
9#include "elle.h" /* include structure definitions */
10
11
12#if FX_DESCRIBE
13/* EFUN: "Describe" */
14/* DESCRIBE - Help-command hack.
15** Crude approximation of EMACS function.
16*/
17static struct buffer *help_buf;
18
19f_describe()
20{ register char *cp;
21 register int i, c;
22 char str[10];
23 struct buffer *savbuf, *b, *make_buf();
24 chroff bdot;
25
26 saynow("Help for command: ");
27 i = cmd_idx(c = cmd_read()); /* Get function idx for cmd */
28 if(c&CB_META) sayntoo("M-");
29 if(i == FN_PFXMETA)
30 { sayntoo("M-");
31 i = cmd_idx(c = (cmd_read() | CB_META));
32 }
33 else if(i == FN_PFXEXT)
34 { sayntoo("^X-");
35 i = cmd_idx(c = (cmd_read() | CB_EXT));
36 }
37 str[0] = c&0177;
38 str[1] = 0;
39 sayntoo(str);
40
41 /* Now read in the help file, if necessary */
42 savbuf = cur_buf;
43 if(help_buf)
44 chg_buf(help_buf);
45 else
46 {
47 saynow("Loading ");
48 sayntoo(ev_helpfile);
49 sayntoo("...");
50 chg_buf(help_buf = make_buf(" **HELP**"));
51 if(read_file(ev_helpfile) == 0)
52 { chg_buf(savbuf);
53 kill_buf(help_buf);
54 help_buf = 0;
55 return;
56 }
57 }
58
59
60 /* Find function index in current buffer */
61 cp = str;
62 *cp++ = '<';
63 *cp++ = 'F';
64 cp = dottoa(cp, (chroff)i);
65 *cp++ = '>';
66 e_gobob();
67 if(e_search(str, cp-str, 0) == 0)
68 sayntoo(" No help found");
69 else
70 {
71 bdot = e_dot();
72 while(!e_lblankp()) e_gonl(); /* Move past 1st blank line */
73 b = make_buf(" *SHOW*");
74 sb_sins((SBBUF *)b, e_copyn(bdot - e_dot()));
75 mk_showin(b); /* Show the stuff */
76 kill_buf(b);
77 sayclr();
78 }
79 chg_buf(savbuf);
80}
81#endif /*FX_DESCRIBE*/
Note: See TracBrowser for help on using the repository browser.