forked from Imagelibrary/rtems
cpukit/shell: Add window size retrieval control
This adds an environment variable that can be used to enable or disable window size retrieval for the RTEMS shell. This will also disable window size retrieval upon failure while allowing the user to re-enable it.
This commit is contained in:
committed by
Amar Takhar
parent
8eb4932b13
commit
174b69afd6
@@ -936,6 +936,21 @@ static void rtems_shell_winsize( void )
|
||||
int lines = 0;
|
||||
int cols = 0;
|
||||
int r;
|
||||
const char *detect = getenv("TERM_SIZE_DETECT");
|
||||
|
||||
if (detect) {
|
||||
/* Skip window size detection if set to False, false, or 0 */
|
||||
if (strcmp(detect, "false") == 0) {
|
||||
return;
|
||||
}
|
||||
if (strcmp(detect, "False") == 0) {
|
||||
return;
|
||||
}
|
||||
if (strcmp(detect, "0") == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
r = ioctl(fd, TIOCGWINSZ, &ws);
|
||||
if (r == 0) {
|
||||
ok = true;
|
||||
@@ -992,6 +1007,8 @@ static void rtems_shell_winsize( void )
|
||||
setenv("LINES", buf, 1);
|
||||
snprintf(buf, sizeof(buf) - 1, "%d", cols);
|
||||
setenv("COLUMNS", buf, 1);
|
||||
} else {
|
||||
setenv("TERM_SIZE_DETECT", "0", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user