Jochen Schulz <m...@well-adjusted.de> writes: > Camaleón: >> On Tue, 23 Nov 2010 17:29:49 +0800, Magicloud Magiclouds wrote: >> >>> But I do not know how it gets the width of the screen. >> >> Well... gathering information about the running terminal is possible: >> >> s...@stt008:~$ stty -a | grep column >> speed 38400 baud; rows 63; columns 86; line = 0; > > Or simply: > > $ echo $LINES $COLUMNS > 31 107
Or even more simply: $ stty size 57 118 In reply to the original question, I think the curses interface can get the terminal size. I haven't tried it from C, but in perl I use the GetTerminalSize function in the Term::ReadKey module (in the debian package libterm-readkey-perl). The shells should also send the signal SIGWINCH to notify the user when the terminal size changes (WINdow CHange?). The bash documentation state that LINES and COLUMNS are automatically set when a SIGWINCH is received. -- Carl Johnson ca...@peak.org -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87lj4kufr4....@oak.localnet