H
!rm -f tiget.c
0a
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Routines to retrieve a value based on the short terminfo name.
* This file is created from tiget.ed. DO NOT EDIT ME!
*/
#include <sys/types.h>
#include "curses_inc.h"
/* generated by sort on caps */
static short booloffsets[] =
{
.
!sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
.r !cat ./tmp/tiget.tmp
.a
};
/* generated by sort on caps */
static short numoffsets[] =
{
.
!sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
.r !cat ./tmp/tiget.tmp
.a
};
/* generated by sort on caps */
static short stroffsets[] =
{
.
!sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp
.r !cat ./tmp/tiget.tmp
!rm ./tmp/tiget.tmp
.a
};
/*
* Return the value of the boolean capability tistr.
* Return -1 if the name is not a boolean capability.
*/
int
tigetflag(char *tistr)
{
int offset;
char *bool_array = (char *) cur_bools;
return (((offset = _tcsearch(tistr, booloffsets, boolnames,
_NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]);
}
/*
* Return the value of the numeric capability tistr.
* Return -2 if the name is not a numeric capability.
*/
int
tigetnum(char *tistr)
{
int offset;
short *num_array = (short *) cur_nums;
return (((offset = _tcsearch(tistr, numoffsets, numnames,
_NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]);
}
/*
* Return the value of the string capability tistr.
* Return (char *) -1 if the name is not a string capability.
*/
char *
tigetstr(char *tistr)
{
int offset;
char **str_array = (char **) cur_strs;
return (((offset = _tcsearch(tistr, stroffsets, strnames,
_NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 :
str_array[offset]);
}
.
0r copyright.h
1,.g/#pragma ident/d
w tiget.c
q