Sans ncurses

Rick Stevens rstevens at vitalstream.com
Thu Jun 10 16:29:34 UTC 2004


Karl Pearson wrote:
> On Wed, June 9, 2004 10:17 am, Rick Stevens said:
> 
>>>I'll get to it but hope someone has experience with this and can point
>>>me in the right direction.
>>
>>Take a look at the termcap or terminfo entry for your terminal type.
>>Do an "echo $TERM" to find out which kind of terminal you're emulating
>>(odds are it's "xterm"), then edit /etc/termcap and look for the
>>entry that matches (for xterms, the primary entry is "xterm-xfree86").
>>The stuff in that entry show what escape sequences do what (do "man
>>termcap" for a list of what the entries mean).
> 
> 
> I've found that tput cup will do screen positioning. It's as easy as using
> the names used in the terminfo file after re-composing the entry and then
> seeing what's named what. For example, tput clear will clear the screen
> (duh) and tput home with send the cursor to 0,0 without clearing the
> screen.
> 
> The problem I've found is that it's way slow. I suspect it's because it
> has to call tput which in term looks up the term type (I use uvxterms, a
> kluged term type I created with line drawing and other extensions), then
> parses through the terminfo DB to get what 'home' means, then escapes the
> sequence it finds. For simple things, I don't mind, but this program,
> which I've started to write, is pretty intensive, so the slowness may be a
> 'deal buster'.
> 
> Thanks Rick. Good info. I'll look into it to see if it's faster than tput...

Just find the appropriate escape sequences and display them via the
"echo" command in the script.  E.g., to clear screen and home cursor:

	echo \033[H			(ESC-[-H)

If you don't know the escape sequences, "man termcap" will give you a
list of the termcap capability names, and looking at the /etc/termcap
entry for the xterm-xfree86 entry will show you what escape sequence is
used ("\E" meaning "escape" or 033 octal (27 hex)).
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
- If you're not part of the solution, you're part of the precipitate -
----------------------------------------------------------------------





More information about the Redhat-install-list mailing list