6811333 Remove prom_printf() message in emlxs driver
[opensolaris.git] / usr / src / lib / libcurses / screen / termcap.ed
blobda5735809150ae575e2ca2ec3cdfc41feb88d0ec
2 !rm -f termcap.c
3 0a
4 /*
5  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
6  * Use is subject to license terms.
7  */
9 /*
10  * University Copyright- Copyright (c) 1982, 1986, 1988
11  * The Regents of the University of California
12  * All Rights Reserved
13  *
14  * University Acknowledgment- Portions of this document are derived from
15  * software developed by the University of California, Berkeley, and its
16  * contributors.
17  */
19 #pragma ident   "%Z%%M% %I%     %E% SMI"
22  * Simulation of termcap using terminfo.
23  * This file is created from termcap.ed. DO NOT EDIT ME!
24  */
27  * These are declared so people won't get undefineds if they use
28  * old documentation.  We don't do anything with them.
29  */
31 #include        <sys/types.h>
32 #include        <string.h>
33 #include        "curses_inc.h"
35 char    *UP;
36 char    *BC;
37 char    PC;
38 short   ospeed;
40 /* ARGSUSED */
41 int
42 tgetent(char *bp, char *name)
44         int     rv;
46         if (setupterm(name, 1, &rv) >= 0)
47         /* Leave things as they were (for compatibility) */
48                 (void) reset_shell_mode();
49         return (rv);
52 /* Make a 2 letter code into an integer we can switch on easily */
53 #define _TWO(s1, s2)    (s1 + 256*s2)
54 #define _TWOSTR(str)    _TWO(*str, str[1])
56 static  char    *
57 _stripdelays(char *inbuf, char *outbuf, int size)
59         char    *saveoutbuf = outbuf;
61         if (inbuf == NULL)
62                 return (0);
63         else
64                 while (size && *inbuf)
65                         if (*inbuf == '$' && *(inbuf+1) == '<')
66                                 /* LINTED */
67                                 while (*inbuf && *inbuf++ != '>');
68                         else {
69                                 size--;
70                                 *outbuf++ = *inbuf++;
71                                 *outbuf = 0;
72                         }
73                 return (saveoutbuf);
76 /* generated by sort on caps */
77 static  short   booloffsets[] =
78                 {               /* generated by sort on caps */
80 !sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp
81 .r !cat ./tmp/termcap.tmp
83                 };
85 /* generated by sort on caps */
86 static  short   numoffsets[] =
87                 {
89 !sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp
90 .r !cat ./tmp/termcap.tmp
92                 };
94 /* generated by sort on caps */
95 static  short   stroffsets[] =
96                 {
98 !sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp
99 .r !cat ./tmp/termcap.tmp
100 !rm ./tmp/termcap.tmp
102                 };
105  * Return the value of the boolean capability tcstr.
106  * Return 0 if the capability is not found.
107  */
110 tgetflag(char *tcstr)
112         char    *p;
113         char    stripped[16];
115         switch (_TWOSTR(tcstr)) {
116         /* Special cases that do not have exact terminfo equivalents */
117                 case _TWO('b','s'):
118                         /* bs: true if ^H moves the cursor left */
119                         p = _stripdelays(cursor_left, stripped, 16);
120                         return (p && *p == 8 && p[1] == 0);
121                 case _TWO('p','t'):
122                         /* pt: true if terminal has ^I tabs every 8 spaces */
123                         p = _stripdelays(tab, stripped, 16);
124                         return (p && *p == 9 && p[1] == 0);
125                 case _TWO('n','c'):
126                         /* cr: true if ^M does not return the cursor */
127                         p = _stripdelays(carriage_return, stripped, 16);
128                         return (! (p && *p == 13 && p[1] == 0));
129                 case _TWO('n','s'):
130                         /* ns: true if no way to scroll the terminal */
131                         return (scroll_forward == NULL);
132         }
133         {
134                 int     n = _NUMELEMENTS(booloffsets);
135                 int     offset = _tcsearch(tcstr, booloffsets, boolcodes, n, 2);
136                 char    *bool_array = (char *) cur_bools;
138                 if (offset == -1)
139                         return (0);
140                 else
141                         return (bool_array[offset]);
142         }
146  * Return the value of the numeric capability tcstr.
147  * Return -1 if the capability is not found.
148  */
151 tgetnum(char *tcstr)
153         int     n = _NUMELEMENTS(numoffsets);
154         int     offset = _tcsearch(tcstr, numoffsets, numcodes, n, 2);
155         short   *num_array = (short *) cur_nums;
157         if (offset == -1)
158                 return (-1);
159         else
160                 return (num_array[offset]);
164  * Return the string capability for capability "id".  We also copy
165  * it into *area for upward compatibility with a few programs that
166  * actually expect it to be copied, at a slight cost in speed.
167  */
169 char    *
170 tgetstr(char *tcstr, char **area)
172         int     n = _NUMELEMENTS(stroffsets);
173         int     offset = _tcsearch(tcstr, stroffsets, strcodes, n, 2);
174         char    **str_array = (char **) cur_strs;
175         char    *rv;
177         if (offset == -1)
178                 return (0);
179         rv = str_array[offset];
180         if (area && *area && rv) {
181                 (void) strcpy(*area, rv);
182                 *area += strlen(rv) + 1;
183         }
184         return (rv);
187 w termcap.c