1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

editor(1) now bails if the terminal resolution isn't 80x25.

This isn't perfect, but support for other resolutions is near!
This commit is contained in:
Jonas 'Sortie' Termansen 2012-07-29 23:41:36 +02:00
parent 5eb48d32fb
commit 829e63f0e9

View file

@ -29,6 +29,7 @@
#include <string.h>
#include <errno.h>
#include <error.h>
#include <termios.h>
const int MODE_QUIT = 1;
const int MODE_TEXT = 2;
@ -442,6 +443,15 @@ void run()
int main(int argc, char* argv[])
{
if ( !isatty(1) ) { error(1, errno, "stdout must be a tty"); return 1; }
struct winsize ws;
if ( tcgetwinsize(1, &ws) != 0 )
error(1, errno, "tcgetwinsize");
if ( ws.ws_col != 80 || ws.ws_row != 25 )
{
fprintf(stderr, "Sorry, this application only works with 80x25 "
"terminal resolutions, please fix it. :)\n");
exit(1);
}
if ( argc < 2 )
{