Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!haven!decuac!hussar.dco.dec.com!mjr From: mjr@hussar.dco.dec.com (Marcus J. Ranum) Newsgroups: comp.unix.programmer Subject: Re: Reading termcap database other than termcap Message-ID: <1990Nov27.145614.24112@decuac.dec.com> Date: 27 Nov 90 14:56:14 GMT References: Sender: news@decuac.dec.com (Network News) Organization: Digital Equipment Corp., Washington Ultrix Resource Center Lines: 26 In article wayne@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]