[comp.unix.questions] How do you link the terminfo library on SysV.2?

rapin@bnrmtv.UUCP (Eric Rapin) (07/30/87)

I have a program which was developed on 4.3BSD which
uses -ltermcap as a ld option.
I know that SysV uses terminfo not termcap but I've yet
to figure out how to link to it.
terminfo seems to have a strange organization that is unlike
any "typical" library.
Is this standard SysV or could I be dealing with an idiosyncracy
of Amdahl UTS?

Please reply by mail.
Thanks,

-- 
Eric B. Rapin		     UUCP: {3comvax,amdahl,ames,csi,hplabs}!bnrmtv!rapin
Bell-Northern Research, Inc.
Mountain View, California

kimcm@ambush.UUCP (Kim Chr. Madsen) (08/04/87)

In article <2316@bnrmtv.UUCP> rapin@bnrmtv.UUCP (Eric Rapin) writes:
>I have a program which was developed on 4.3BSD which
>uses -ltermcap as a ld option.
>I know that SysV uses terminfo not termcap but I've yet
>to figure out how to link to it.

I know it sounds a little silly but you'll have to use the curses,
library -lcurses to use terminfo (or the interpreted termcap routines).

>terminfo seems to have a strange organization that is unlike
>any "typical" library.

The organization in terminfo is that there is fixed addresses for each
known "terminfo" attribute and the routines just addresses themeselves
into the compiled terminfo entry with the wanted attribute address.
This organization has it's advantages in speed: once you know your
terminal type you have a file containing only the attributes for this 
terminal and looking up the attribute value by random access. But also
the disadvantage of not being able to add new attributes to the files.

>Is this standard SysV or could I be dealing with an idiosyncracy
>of Amdahl UTS?

This is pretty much standard SYSV - though there is PD packages providing
the termcap/termlib libraries using good ol' /etc/termcap and/or terminfo.
Certain vendors also include BSD enhancements in form of the mentioned
libraries.

						Kim Chr. Madsen.

randy@chinet.UUCP (Randy Suess) (08/07/87)

In article <449@ambush.UUCP> kimcm@ambush.UUCP (Kim Chr. Madsen) writes:
>But also
>the disadvantage of not being able to add new attributes to the files.

	Sure you can.  SysVr2 comes with the tic (terminfo compiler) that
	allows you to replace any entry in the /usr/lib/terminfo/* that
	you want.  There are public domain termcap - to - terminfo
	converters (captoinfo) and terminfo de-compilers (untic).
	Release 3 comes with these standard, and also has a general
	purpose terminfo manipulator called infocmp.  Does de-compiles,
	compiles, comparisons, etc.  If you want to play with your
	own terminfo entry, you can set the TERMINFO environment
	variable to it's path, just like the TERMCAP variable back
	in ancient times..

	-randy

-- 
that's the biz, sweetheart.....
Randy Suess
..!ihnp4!chinet!randy

kimcm@ambush.UUCP (Kim Chr. Madsen) (08/11/87)

In article <1377@chinet.UUCP> randy@chinet.UUCP (Randy Suess) writes:
>In article <449@ambush.UUCP> kimcm@ambush.UUCP (Kim Chr. Madsen) writes:
>>But also
>>the disadvantage of not being able to add new attributes to the files.

>	Sure you can.  SysVr2 comes with the tic (terminfo compiler) that
>	allows you to replace any entry in the /usr/lib/terminfo/* that
>	you want.  

Sure, that exactly the point you can replace any existing field but if I
want to include information about using graphic symbols on my teminal i.e.
to make frames around a window - neither the standard termcap or terminfo
supports this, but in termcap you could make new entries (provided you could
find a two-letter code not already in use) however it is impossible in
terminfo since it only allocates addresses (in the compiled entry) for known
fields - which is why the tic command has been altered between SYSVR2 and
SYSVR3 since more entries were added. Fast but clupsy - I'd rather had the
termcap entries split up into several files in /usr/lib/termcap/?/* thus
keeping compatibility between old termcap routines (as used in other UNIX'es)
and the improved speed in finding & readin the entry.

						Kim Chr. Madsen.

gwyn@brl-smoke.ARPA (Doug Gwyn ) (08/12/87)

In article <454@ambush.UUCP> kimcm@ambush.UUCP (Kim Chr. Madsen) writes:
>Sure, that exactly the point you can replace any existing field but if I
>want to include information about using graphic symbols on my teminal i.e.
>to make frames around a window - neither the standard termcap or terminfo
>supports this, but in termcap you could make new entries (provided you could

Both termcap and terminfo support alternate line-drawing character sets,
with terminfo "acsc" (termcap "ac") defining the pairings with the normal
character set, if the VT100 defaults are not appropriate, and smacs (as)
to start alternate character set mode, rmacs (ae) to end alternate character
set mode, and enacs (eA) if something has to be done to enable the alternate
character set before using smacs (as).  These aren't described very well in
older documentation, including that supplied with 4.3BSD, but they're at
least mentioned in current versions, if I recall correctly.  (I may have left
"eA" out of the termcap manual.  I need to bring it up to SVR3 level anyway.)

>find a two-letter code not already in use) however it is impossible in
>terminfo since it only allocates addresses (in the compiled entry) for known
>fields - which is why the tic command has been altered between SYSVR2 and
>SYSVR3 since more entries were added. Fast but clupsy - I'd rather had the
>termcap entries split up into several files in /usr/lib/termcap/?/* thus
>keeping compatibility between old termcap routines (as used in other UNIX'es)
>and the improved speed in finding & readin the entry.

Terminfo has many advantages over termcap besides eliminating the linear
search through the database.  For example, its parameter mechanism is
more general.

	-- your semi-friendly 4.3BSD termcap manual entry editor

allbery@ncoast.UUCP (Brandon Allbery) (08/13/87)

As quoted from <1377@chinet.UUCP> by randy@chinet.UUCP (Randy Suess):
+---------------
| In article <449@ambush.UUCP> kimcm@ambush.UUCP (Kim Chr. Madsen) writes:
| >But also
| >the disadvantage of not being able to add new attributes to the files.
| 
| 	Sure you can.  SysVr2 comes with the tic (terminfo compiler) that
| 	allows you to replace any entry in the /usr/lib/terminfo/* that
| 	you want.  There are public domain termcap - to - terminfo
+---------------

I think what he means is that you can't invent your own attributes and add
them to the terminfo description.  Say, something like:

# new command 'ctr' moves to the center of the screen
test-vt100|VT100 with a new attribute,
	ctr=\E[12;40H, tc=vt100,

will fail -- you can't use the 'ctr' command.
-- 
 Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery
ARPA: necntc!ncoast!allbery@harvard.harvard.edu  Fido: 157/502  MCI: BALLBERY
   <<ncoast Public Access UNIX: +1 216 781 6201 24hrs. 300/1200/2400 baud>>
** Site "cwruecmp" is changing its name to "mandrill".  Please re-address **
*** all mail to ncoast to pass through "mandrill" instead of "cwruecmp". ***

allbery@ncoast.UUCP (08/16/87)

As quoted from <454@ambush.UUCP> by kimcm@ambush.UUCP (Kim Chr. Madsen):
+---------------
| Sure, that exactly the point you can replace any existing field but if I
| want to include information about using graphic symbols on my teminal i.e.
| to make frames around a window - neither the standard termcap or terminfo
| supports this, but in termcap you could make new entries (provided you could
| find a two-letter code not already in use) however it is impossible in
| terminfo since it only allocates addresses (in the compiled entry) for known
| fields - which is why the tic command has been altered between SYSVR2 and
| SYSVR3 since more entries were added. Fast but clupsy - I'd rather had the
+---------------

I solved this with a critter called "tgraph".  SVR3 is supposed to provide a
way to do it (and, module termcap/terminfo incompatibility itself) is actually
compatible with 4.3BSD within the attribute names used.  (--but is not
compatible with tgraph, since that uses capnames in a terminfo-src-like file
while the BSD4.3/SVR3 form uses a single capname with paired characters.)*

I may be able to get the thing reposted if interest warrants.  (My archives
are inaccessible, since cpio doesn't run under MS-DOS.  ;-)  Basically, it
defines a set of functions for box drawing ([mv][w]graph()) and a set of
defines compatible with SVR3 curses (ACS_*) useable with the A_ALTCHARSET
attribute in attrset(), etc.  A header file defines the ACS_* characters,
and the program must call graph("") (or [mv][w]graph("any box-drawing string"))
to initialize the graphics array.

-----
* I've heard that 4.3BSD supports them, at least.  But 4.3BSD curses doesn't
have attributes yet, so you can't use tgraph -- tgraph has to be used at the
curses level, but 4.3 box graphics only work at the termcap level.
-- 
 Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery
ARPA: necntc!ncoast!allbery@harvard.harvard.edu  Fido: 157/502  MCI: BALLBERY
   <<ncoast Public Access UNIX: +1 216 781 6201 24hrs. 300/1200/2400 baud>>
** Site "cwruecmp" is changing its name to "mandrill".  Please re-address **
*** all mail to ncoast to pass through "mandrill" instead of "cwruecmp". ***