Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!mcvax!ukc!reading!riddle!domo From: domo@riddle.UUCP (Dominic Dunlop) Newsgroups: comp.unix.questions Subject: Re: Curses: Drawing Boxes -- sending control chars Message-ID: <806@riddle.UUCP> Date: 5 Sep 88 09:59:02 GMT Article-I.D.: riddle.806 References: <873@wpg.UUCP> <384@marob.MASA.COM> Reply-To: domo@riddle.UUCP (Dominic Dunlop) Organization: Sphinx Ltd., Maidenhead, England Lines: 41 In article <873@wpg.UUCP> russ@wpg.UUCP (Russell Lawrence) writes: > >The curses box() function draws crude boxes around windows using ascii >characters like '|' and '-' that are passed to the function as >arguments. By contrast, I'd like to write a better box drawing routine >that would take advantage of box drawing graphics capabilities on some >terminals. Unfortunately, the terminfo definitions don't include any >parameters that would be appropriate, and the tic(1M) program won't >allow me to define new ones. Er... Oh, yes it does. Oh, yes it will. If you look in the _UNIX System V Programmer's Guide_ (AT&T select code 307-225, or available at bookstores in the Prentice-Hall edition), chapter 10, _Curses/terminfo_, you will find a section called ``Using Advanced curses Features'' which describes the use of ACS_* characters from an alternate character set to draw boxes. There's even an example program, which uses the box() function to do the job: box() will use the ACS characters in preference to `+' and `-', provided that the necessary characters are defined. The definition is a little baroque: Moving to _UNIX System V Programmer's Reference Manual_ (select code 307-226, or from Prentice Hall), section TERMINFO(4), you (eventually) find a section called ``Line Graphics''. This discusses the ``acsc'' (alternate character set characters) capability, a single string containing your terminal's half of a mapping between the VT100's alternate character set and your terminal's alternate character set. So, if you feed tic a terminal description containing an acsc=... capability, you should get prettier boxes when you use the curses box() function. Admittedly, this is all theory: I've never had to do it myself in anger -- although I've spent plenty of time persuading applications authors that they should be doing it, rather than... >I figured I could get around the problem >by concocting a small database containing the command strings for the >various terminals we use in our office... Please, please, don't do this. Maintaining non-standard extensions to curses, termcap and terminfo has been one of the banes of my life. Every (supply your own adjective) application does it differently. No more unnecessary diversity, please. (Even if I don't get to maintain it.) -- Dominic Dunlop domo@sphinx.co.uk domo@riddle.uucp