u31b3hs@cip-s03.informatik.rwth-aachen.de (Michael Haardt) (08/13/90)
Hello world!
I am glad to see that the Minix termcap entry is nearly complete, because
it takes much time to describe *all* fields. But there are still some
capabilities which should be defined. Some of them are the ac, as and ae.
Their meanings are:
ac - alternative characters
as - alternative charset start
ae - alternative charset end
After defining them, you could use terminal independent block grafic
characters as well as some other special characters too. This is very useful
for the Minix console and vt100 terminals too, because you can forget the
comment "This program only runs on console, because it uses the IBM grafic
charset." although your terminal has grafic characters. It would be useful
for Andy's children shell. (Could someone repost this shell, please ???
It is nice for beginners who had never used a computer before.)
It is a little bit difficult to use the ac entry, so I wrote a small
include file. To my opinion, everyone can understand how it works and how the
capabilities should be described. You could find a detailed description
in the AT&T System V Programmer's reference manual, page 675 in the german
translation, which can be bought for about 120 dutch mark, I think.
(Carl Hanser Verlag, ISBN 3-446-15073-0.)
This is an entry for the MINIX console. The ac string has to be ONE line
in your termcap file.
:ac=0\333I\017`\04a\261f\370g\361j\331k\277l\332m\300n\305q\304
t\303u\264v\301w\302x\263~\025:\
:as=\0:ae=\0:
This is another entry for a vt101 terminal with US charset.
:ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxx:\
:as=\E(0:ae=\E(B:
On my system, there is a /usr/include/local directory for files like this
one. Ok, this is what I am talking about: tgetgraf.h
---- cut here ----- or snip ------ cut, cut, cut ------ snip, snip, snip ----
#ifdef TESTSYM
#include <termcap.h>
#include <stdio.h>
#endif
#define RIGHTARROW 0
#define LEFTARROW 1
#define DOWNARROW 2
#define UPARROW 3
#define FULLSQUARE 4
#define GREYSQUARE 5
#define EMPTYSQUARE 6
#define LATERN 7
#define DIAMOND 8
#define DEGREE 9
#define PLUSMINUS 10
#define DOWNRIGHT 11
#define UPRIGHT 12
#define UPLEFT 13
#define DOWNLEFT 14
#define CROSS 15
#define UPLINE 16
#define UPMIDLINE 17
#define MIDLINE 18
#define DOMIDLINE 19
#define DOWNLINE 20
#define TEELEFT 21
#define TEERIGHT 22
#define TEEHEAD 23
#define TEENORMAL 24
#define VERTLINE 25
#define PARAGRAPH 26
/* tgetgraf returns '\0' if the symbol is not defined for this terminal */
char tgetgraf(sym,tcapbuf) int sym; char *tcapbuf;
{
static char graftable[27];
static int validtable=0;
static char ident[28] = "+,.-0ahI`fgjklmnopqrstuvwx~";
char *ac;
int i;
if (!validtable)
{
for (i=0; i<27; i++) graftable[i]='\0';
if (ac=tgetstr("ac",tcapbuf))
while (*ac)
{
i=0;
while (*ac != ident[i]) i++;
graftable[i] = *++ac;
ac++;
}
validtable=1;
}
return graftable[sym];
}
#ifdef TESTSYM
main()
{
char buf[1024], c;
int i;
tgetent(buf,getenv("TERM"));
printf("%s",tgetstr("as",buf));
for (i=0; i<27; i++) if (c=tgetgraf(i,buf)) putchar(c); else putchar(' ');
printf("%s\n",tgetstr("ae",buf));
}
#endif
------------------------------------------------------------------------------
Flames will be moved to /dev/null on my machine. Send any other comments to
u31b3hs@cip-s02.informatik.rwth-aachen.de (Michael Haardt)
---------------------------------- ciao --------------------------------------