-ltermcap

lvs at ndm20.UUCP lvs at ndm20.UUCP
Thu Aug 7 02:29:00 AEST 1986


>In article <2773 at mit-eddie.MIT.EDU>
>shawn at mit-eddie.MIT.EDU (Shawn F. Mckay) writes:
>>One would think I could say something like:
>>
>>char	buff[20];
>>
>>	tgetstr ("cl", buff);
>
>Read the termcap(3) man page more carefully.  The declaration for
>tgetstr is:
>
>	char *
>	tgetstr(id, area)
>	char *id, **area;
>
>Note the '**area'.  So you want to do:
>
>  [some more stuff]
>
>The man page also says 'it advances area', which is why you must assign
>buff to bufptr.
>--
>Dave Cohrs
>dave at rsch.wisc.edu

Note that this is not true for the AT&T SV release 2 version of termcap.
They supply termcap routines "strictly for compatibility", and they don't
work like the originals.  In specific:

    tgetent() places NO data in the buffer you supply it
    tgetstr() ignores the buffer pointer you give.

So, when using tgetstr, you MUST save and use the return value of the
function as it returns a pointer to the capability string if found, or NULL
if not found.  Fo example:

   char *tgetstr();
   char *cl_str;
   char junkbuff;
   char *bogus_ptr = &junkbuff;
   
   if( (cl_str = tgetstr( "cl", bogus_ptr )) == NULL ) {
      handle missing capability
   }
   else {
      handle success, fame, and fortune :-)
   }

I have found this to be true on the PC6300PLUS, but I think it holds true
elsewhere also.


Hope this helps,
Larry V. Streepy Jr.                        "Waiting is"
Nathan D. Maier Consulting Engineers

VOICE:  (214)739-4741
Usenet: {seismo!c1east | cbosgd!sun | ihnp4}!convex!infoswx!ndm20!lvs
CSNET:  ndm20!lvs at smu
ARPA:   ndm20!lvs%smu at csnet-relay.ARPA



More information about the Comp.unix.wizards mailing list