1 /* Copyright (c) 1985 Ceriel J.H. Jacobs */
4 static char rcsid
[] = "$Header$";
20 static int h_cnt
; /* Count # of lines */
21 static struct state
*origin
; /* Keep track of startstate */
24 * Print a key sequence.
25 * We arrived at an endstate. The s_next link in the state structure now
26 * leads us from "origin" to the current state, so that we can print the key
32 register struct state
*p
= origin
;
36 register int i
= 0; /* How many characters printed? */
41 if (c
< ' ' || c
== 0177) {
43 * Will take an extra position
49 if (!p
->s_match
) break;
60 * Print out a description of the keymap. This is done, by temporarily using
61 * the s_next field in the state structure indicate the state matching the
62 * next character, so that we can walk from "origin" to an endstate.
66 pr_mach(currstate
, back
) register struct state
*currstate
, *back
; {
72 save
= back
->s_next
; /* Save original link */
73 back
->s_next
= currstate
;
75 if (!currstate
->s_match
) {
77 * End state, print command
80 putline(commands
[currstate
->s_cnt
].c_descr
);
82 if (++h_cnt
>= maxpagesize
) {
87 else pr_mach(currstate
->s_match
, currstate
);
88 currstate
= currstate
->s_next
;
89 if (back
) back
->s_next
= save
; /* restore */
90 else origin
= currstate
;
96 do_help(i
) long i
; { /* The help command */
100 putline("\r\nSummary of yap commands:\r\n");
101 origin
= currmap
->k_mach
;
102 pr_mach(currmap
->k_mach
, (struct state
*) 0);
106 if (!hardcopy
&& scr_info
.currentpos
) redraw(1);