4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
25 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
32 * kmdb_terminfo_skel.c is the skeleton used to generate
33 * kmdb_terminfo.c, which contains the kmdb-specific version
41 #include <mdb/mdb_io.h>
42 #include <mdb/mdb_debug.h>
54 termio_attr_type_t ta_type
;
60 const termio_attr_t
*td_data
;
66 * tigen will insert the following definitions here:
68 * <term>_attrs (one per terminal type passed to tigen)
74 static const termio_desc_t
*tdp
;
78 setupterm(char *name
, int fd
, int *err
)
80 for (tdp
= termio_db
; tdp
->td_name
!= NULL
; tdp
++) {
81 if (strcmp(tdp
->td_name
, name
) == 0)
90 restartterm(char *name
, int fd
, int *err
)
92 const termio_desc_t
*otdp
= tdp
;
95 if ((status
= setupterm(name
, fd
, err
)) != OK
)
96 tdp
= otdp
; /* restore old terminal settings */
102 tigetstr(const char *name
)
104 const termio_attr_t
*tap
;
106 for (tap
= tdp
->td_data
; tap
->ta_name
!= NULL
; tap
++) {
107 if (strcmp(tap
->ta_name
, name
) == 0) {
108 if (tap
->ta_type
== TIO_ATTR_REQSTR
||
109 tap
->ta_type
== TIO_ATTR_STR
)
110 return ((char *)tap
->ta_data
);
120 tigetflag(const char *name
)
122 const termio_attr_t
*tap
;
124 for (tap
= tdp
->td_data
; tap
->ta_name
!= NULL
; tap
++) {
125 if (strcmp(tap
->ta_name
, name
) == 0) {
126 if (tap
->ta_type
== TIO_ATTR_BOOL
)
127 return ((uintptr_t)tap
->ta_data
);
137 tigetnum(const char *name
)
139 const termio_attr_t
*tap
;
141 for (tap
= tdp
->td_data
; tap
->ta_name
!= NULL
; tap
++) {
142 if (strcmp(tap
->ta_name
, name
) == 0) {
143 if (tap
->ta_type
== TIO_ATTR_INT
)
144 return ((uintptr_t)tap
->ta_data
);