2018-08-15 04:07:33 +03:00
|
|
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
|
|
* This file is part of ToaruOS and is released under the terms
|
2018-05-09 13:27:42 +03:00
|
|
|
* of the NCSA / University of Illinois License - see LICENSE.md
|
2018-07-23 14:01:23 +03:00
|
|
|
* Copyright (C) 2013 K. Lange
|
2018-08-15 04:07:33 +03:00
|
|
|
*
|
|
|
|
* term-size - Print the size of the tty
|
|
|
|
*
|
|
|
|
* This is mostly redundant with ttysize, and should probably
|
|
|
|
* be replaced with setting COLUMNS and LINES in the shell,
|
|
|
|
* like bash does, but it's left here for historical reasons
|
2018-05-09 13:27:42 +03:00
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <termios.h>
|
|
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
|
|
|
struct winsize w;
|
|
|
|
ioctl(0, TIOCGWINSZ, &w);
|
|
|
|
printf("Terminal is %dx%d (%d px x %d px)\n", w.ws_col, w.ws_row, w.ws_xpixel, w.ws_ypixel);
|
|
|
|
return 0;
|
|
|
|
}
|