Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!convex!ndm20.UUCP!lvs From: lvs@ndm20.UUCP Newsgroups: net.unix-wizards Subject: Re: -ltermcap Message-ID: <28800008@ndm20.UUCP> Date: Wed, 6-Aug-86 12:29:00 EDT Article-I.D.: ndm20.28800008 Posted: Wed Aug 6 12:29:00 1986 Date-Received: Sat, 9-Aug-86 08:17:38 EDT References: <2773@mit-eddie.MIT.EDU> Lines: 61 Nf-ID: #R:mit-eddie.MIT.EDU:2773:ndm20.UUCP:28800008:37777777600:1580 Nf-From: ndm20.UUCP!lvs Aug 6 11:29:00 1986 >In article <2773@mit-eddie.MIT.EDU> >shawn@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@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@smu ARPA: ndm20!lvs%smu@csnet-relay.ARPA