Reading termcap database other than termcap

Marcus J. Ranum mjr at hussar.dco.dec.com
Wed Nov 28 01:56:14 AEST 1990


In article <WAYNE.90Nov26180444 at forchammer.cs.odu.edu> wayne at cs.odu.edu (C Wayne Huling) writes:
>
>  I have written a small program to accept the name of a printer and search
>the printcap for the hostmachine.  I use the termcap routines supplied in the
>Unix PRM.  Unfortunatly it reads from a environment set variable.  My problem
>is if I set this variable "TERM" to be /etc/printcap and then run another
>program that needs "TERM" to be /etc/termcap then it will bomb.  Is there any
>way of setting the file to be read from internally?

	I have a hacked up copy of the printcap code from the BSD 'lpr'
command that implements a "caplib" library - generic "termcap" capabilities.
It differs from the "standard" termcap in that it wants to know the sizes
of the buffers passed to it, and checks for overflow. It also doesn't
support the egregious tc= kludge. There's no support for grabbing the
entry out of the environment, but that shouldn't be very hard at all.
[the way BSD does that also is a kludge - getting it out of the environment
or not should be done at a higher level than in capgetent(), IE: if there
is no XXXXCAP in the environment, *then* it uses capgetent(), etc]

	If anyone wants a copy, let me know.

mjr.
-- 
	Good software will grow smaller and faster as time goes by and
the code is improved and features that proved to be less useful are
weeded out.	[from the programming notebooks of a heretic, 1990]



More information about the Comp.unix.programmer mailing list