Questions tagged [termcap]

termcap is a library and database that enables programs to use display terminals in a terminal-independent manner. It originated in Berkeley Unix.

termcap is an obsolete facility which has been superseded by the terminfo database and associated libraries.

72 questions
32
votes
3 answers

How do I determine if a terminal is color-capable?

I would like to change a program to automatically detect whether a terminal is color-capable or not, so when I run said program from within a non-color capable terminal (say M-x shell in (X)Emacs), color is automatically turned off. I don't want to…
asjo
  • 3,084
  • 2
  • 26
  • 20
15
votes
1 answer

Where to obtain termios.h

In my particular situation, I am using MinGW/MSys. It doesn't contain termios.h. Turns out that it isn't a library that can be downloaded and installed (Google didn't found any). Termcap also doesn't include termios.h. From where can I get this…
Soergener
  • 703
  • 1
  • 6
  • 7
15
votes
3 answers

Unix screen utility error: Cannot find termcap entry for 'xterm-256color'

I work on a NetBSD system through an ssh connection from my Mac and I want to use the screen utility so that I can start processes and come back to them after my terminal connection has been interrupted. When I type screen I get the error…
Gregory
  • 4,147
  • 7
  • 33
  • 44
10
votes
1 answer

Testing for color support in Linux shell scripts

This is the second time I've wanted to do this and again my google-fu has failed me. When in the course of running a shell script (in my case a bash script) is there a program/script that tests whether the current shell supports color? Alternatively…
lose_the_grimm
  • 313
  • 4
  • 15
6
votes
4 answers

Can I determine if the terminal interprets the C1 control codes?

ISO/IEC 2022 defines the C0 and C1 control codes. The C0 set are the familiar codes between 0x00 and 0x1f in ASCII, ISO-8859-1 and UTF-8 (eg. ESC, CR, LF). Some VT100 terminal emulators (eg. screen(1), PuTTY) support the C1 set, too. These are the…
caf
  • 233,326
  • 40
  • 323
  • 462
6
votes
1 answer

Why is terminfo[kcuu1] = '\EOA'?

From what I can tell reading terminfo(5), kcuu1 should be the sequence that the terminal sends when the up arrow is pressed. I have never, ever seen that be anything other than ^[[A (speaking now about cat, messed up terminal settings, etc). So,…
Steve McKay
  • 2,123
  • 17
  • 26
6
votes
2 answers

Terminfo smkx and Application Cursor Keys vs Application keypad

XTerm Control Sequences specifies the following key sequences: CSI ? 1 h → Application Cursor Keys (DECCKM) CSI ? 1 l → Normal Cursor Mode (DECOM) CSI ? 66 h → Application keypad (DECNKM) CSI ? 66 l → Numeric keypad (DECNKM) and the Terminfo…
fornwall
  • 2,877
  • 3
  • 25
  • 38
5
votes
2 answers

Print embedded Pod as formatted text with termcap escapes

I am trying to output embedded Pod as ANSI text to the terminal. In Perl 5 I can use Pod::Text::Termcap: use strict; use warnings; use Pod::Text::Termcap; my $str = do {local $/; }; my $parser =…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
5
votes
1 answer

How to get the cursor position in a C program using termcap, without writing a character?

I would like to know how to get the cursor position (x, y) in my program, without writing anything on the screen neither tracking it all the time. I found out a way to get its position with this function (I don't check the return of read, write, etc…
MIG-23
  • 511
  • 3
  • 11
5
votes
1 answer

Why does an empty printf allow me to continue reading data from the stdin?

CODE while (1) { keycode = key_hook(); if (keycode == SPACE || keycode == BKSPACE) { render_again = 1; } if (keycode == ESC) break; if (render_again) { …
Rpreda
  • 147
  • 1
  • 7
4
votes
1 answer

Screen truecolor Ubuntu 18.04 broke

One of the few pieces of software that I compile myself is screen. I've found it tends to support some modern features of terminals better than the version in the repositories. I've been doing this for some time now without too much of an issue.…
James
  • 630
  • 1
  • 6
  • 15
4
votes
4 answers

terminal: where am I?

Is there a variable or a function, which can tell me the actual position of the cursor? #!/usr/bin/env perl use warnings; use 5.012; use Term::ReadKey; use Term::Cap; use POSIX; my( $col, $row ) = GetTerminalSize(); my $termios = new…
sid_com
  • 24,137
  • 26
  • 96
  • 187
4
votes
1 answer

Read screen character from terminal

As far I researched, terminfo/termcap and ioctl don't allow to query character at (x,y) position on terminal's screen. This is rather unexpected, because: one can read e.g. screen dimensions from terminal (e.g. tput co, tput li), one can read input…
Rob Luca
  • 153
  • 10
3
votes
3 answers

Get current terminal color pair in Perl

I'm trying to learn about color text in a terminal window. (In case it matters I'm using Terminal.app on OS X.) I'd like to get the terminal's current foreground and background color pair. It looks like I should be able to get this info in a perl…
HairOfTheDog
  • 2,489
  • 2
  • 29
  • 35
3
votes
5 answers

What does &= mean?

I'm using termcaps and I don't understand what &= means in this example: term.c_lflag &= ~(ICANON); Could anyone explain to me how this works?
user3165140
  • 63
  • 1
  • 1
  • 2
1
2 3 4 5