1 /* $NetBSD: ip_term.c,v 1.3 2013/11/25 22:43:46 christos Exp $ */
4 * Keith Bostic. All rights reserved.
6 * See the LICENSE file for redistribution information.
12 static const char sccsid
[] = "Id: ip_term.c,v 8.9 2001/06/25 15:19:24 skimo Exp (Berkeley) Date: 2001/06/25 15:19:24 ";
15 #include <sys/types.h>
16 #include <sys/queue.h>
18 #include <bitstring.h>
22 #include "../common/common.h"
23 #include "../ipc/ip.h"
27 * Initialize the terminal special keys.
29 * PUBLIC: int ip_term_init __P((SCR *));
37 * Rework any function key mappings that were set before the
38 * screen was initialized.
40 LIST_FOREACH(qp
, &sp
->gp
->seqq
, q
)
41 if (F_ISSET(qp
, SEQ_FUNCMAP
))
42 (void)ip_fmap(sp
, qp
->stype
,
43 qp
->input
, qp
->ilen
, qp
->output
, qp
->olen
);
49 * End the special keys defined by the termcap/terminfo entry.
51 * PUBLIC: int ip_term_end __P((GS *));
58 /* Delete screen specific mappings. */
59 LIST_FOREACH_SAFE(qp
, &gp
->seqq
, q
, nqp
) {
60 if (F_ISSET(qp
, SEQ_SCREEN
))
70 * PUBLIC: int ip_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
73 ip_fmap(SCR
*sp
, seq_t stype
, CHAR_T
*from
, size_t flen
, CHAR_T
*to
, size_t tlen
)
75 /* Bind a function key to a string sequence. */
81 * IP screen specific "option changed" routine.
83 * PUBLIC: int ip_optchange __P((SCR *, int, const char *, u_long *));
86 ip_optchange(SCR
*sp
, int offset
, const char *str
, u_long
*valp
)
90 IP_PRIVATE
*ipp
= IPP(sp
);
95 F_SET(sp
->gp
, G_SRESTART
);
96 F_CLR(sp
, SC_SCR_EX
| SC_SCR_VI
);
99 /* Called with "ip_curses"; previously wasn't shown
100 * because switching to EX wasn't allowed
101 msgq(sp, M_ERR, "The screen type may not be changed");
106 opt
= optlist
+ offset
;
120 ipb
.len2
= strlen(str
) + 1;
125 ipb
.code
= SI_EDITOPT
;
126 ipb
.str1
= __UNCONST(opt
->name
);
127 ipb
.len1
= STRLEN(opt
->name
) * sizeof(CHAR_T
);
129 (void)vi_send(ipp
->o_fd
, "ab1", &ipb
);