Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.info-terms Subject: Re: wishful thinking dept. Message-ID: <2021@umcp-cs.UUCP> Date: Tue, 29-Oct-85 22:36:26 EST Article-I.D.: umcp-cs.2021 Posted: Tue Oct 29 22:36:26 1985 Date-Received: Thu, 31-Oct-85 08:47:14 EST References: <292@cisden.UUCP> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 55 Among other things, you suggest that termcap use a 2048 byte buffer (as opposed to the current 1024 byte buffers found in most programs). Well, having 2048 characters to work with would help, but still that is not really right: one should dynamically allocate enough space to hold the termcap entry, however large it may be. By the way, note that termcap buffers must be provided in three (!) places, at least with the current implementation in 4.3BSD: in -ltermlib itself---termcap.c has several 1024 byte buffers; and twice in user code: once for the buffer into which the termcap is stored and once more for the buffer into which decoded strings are stored by tgetstr(). Worse yet, there is no manifest constant anywhere. Programs simply assume a maximum of 1024 bytes, or whatever worked for the programmer. As I recall, 4.2BSD curses assumed that there were at most 128 characters of decoded strings, untrue in several of my own termcaps. I have never quite understood why the interface provided by the termcap library is as it is; I would prefer something like char * tgetent(type) char *type; Returns a pointer to the termcap entry for terminal type `type', or NULL if it could not be found. The termcap entry is in static space, thus overwritten by future calls. int tgetflag(te, fl) char *te, *fl; Returns true iff flag `fl' is set in termcap entry `te'. int tgetnum(te, nu) char *te, *nu; Returns the value of `nu' in termcap entry `te', or -1 if not set. char * tgetstr(te, st) char *te, *st; Returns a pointer to the decoded string `st' from termcap `te'. The string is in dynamically allocated space. Less efficient, perhaps, but cleaner---and no other code need assume *anything* about the size of termcap entries. But alas, it is too late for termcap. Terminfo is better anyway. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu