Text mode screen size max. compatibility

Polytropon freebsd at edvax.de
Fri Jul 23 18:24:53 UTC 2010

I'm going to write a program that will be a text mode application.
In FreeBSD, the default text mode screen size is 80x25. Also, many
terminal emulators for X default to that size, as well as SSH
clients used in the "Windows" land.

Allthough 80x25 sounds alot, it may be useful to use a bigger
screen size, like on the IBM 3270 terminals that default to
132x40 (or nearly that). The modes listed in "man vidcontrol"
also contain bigger sizes than 80x25:

	80x30, 80x43, 80x50, 80x60, 132x25, 132x30,
	132x43, 32x50, 132x60

and additionally

	vGA_40x25, VGA_80x25, VGA_80x30, VGA_80x50, VGA_80x60,
	VGA_90x25, VGA_90x30, VGA_90x43, VGA_90x50, VGA_90x60,
	EGA_80x25, EGA_80x43, VESA_132x25, VESA_132x43,
	VESA_132x50, VESA_132x60.

It's also possible to use -geometry for xterm to define a similar

Here are my questions:

Is there a way to easily determine the terminal output size at
program startup so the program can be preconfigured for certain
screen sizes, and even refuse to run if it's less than 80x25?

Can the program get any notification if the terminal output size
has been changed (e. g. by changed window size), especially when
running in an X terminal emulator, so it can re-arrange things?

I know it takes some work (i. e. settings) to enable a bigger
screen size in the default text mode, but in X, it's quite easy.
If it was just that, querying $TERM and $DISPLAY would be enough
to check if we're in text or in X, but how to get more information
about what terminal output size is currently set in X?

Oh, and the program will be written in C. Due to maximum compatibility,
I want to try to keep the program in text mode (so it's easier to use
it via SSH with no X server present); in any other case, I would
surely default to Tcl/Tk. :-)

Any suggestions or advices?

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list