Commit b2737a08 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] kconfig: geometry defaults

Set geometry defaults, if TIOCGWINSZ fails.
parent d282afeb
...@@ -111,6 +111,7 @@ static int cprint(const char *fmt, ...); ...@@ -111,6 +111,7 @@ static int cprint(const char *fmt, ...);
static void init_wsize(void) static void init_wsize(void)
{ {
struct winsize ws; struct winsize ws;
char *env;
if (ioctl(1, TIOCGWINSZ, &ws) == -1) { if (ioctl(1, TIOCGWINSZ, &ws) == -1) {
rows = 24; rows = 24;
...@@ -118,6 +119,20 @@ static void init_wsize(void) ...@@ -118,6 +119,20 @@ static void init_wsize(void)
} else { } else {
rows = ws.ws_row; rows = ws.ws_row;
cols = ws.ws_col; cols = ws.ws_col;
if (!rows) {
env = getenv("LINES");
if (env)
rows = atoi(env);
if (!rows)
rows = 24;
}
if (!cols) {
env = getenv("COLUMNS");
if (env)
cols = atoi(env);
if (!cols)
cols = 80;
}
} }
if (rows < 19 || cols < 80) { if (rows < 19 || cols < 80) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment