diff options
author | Chris Johns <chrisj@rtems.org> | 2022-11-22 21:05:48 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2022-11-23 07:00:08 +1100 |
commit | 8425e679c149096a5d0a97990f6ebdbdd55ca522 (patch) | |
tree | ddde07991b57375146e3a0f77d6e71b3f0ebf324 /cpukit/libmisc/shell/main_edit.c | |
parent | aarch64/versal: Add UART interrupt support (diff) | |
download | rtems-8425e679c149096a5d0a97990f6ebdbdd55ca522.tar.bz2 |
libmisc/shell: Support terminal size as env variables
Closes #4763
Diffstat (limited to '')
-rw-r--r-- | cpukit/libmisc/shell/main_edit.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index 4cc742719a..99871204b7 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -755,8 +755,23 @@ static void get_console_size(struct env *env) { env->cols = ws.ws_col; env->lines = ws.ws_row - 1; #elif defined(__rtems__) - env->cols = 80; + char* e; env->lines = 25; + env->lines = 80; + e = getenv("LINES"); + if (e != NULL) { + int lines = strtol(e, 0, 10); + if (lines > 0) { + env->lines = lines - 1; + } + } + e = getenv("COLUMNS"); + if (e != NULL) { + int cols = strtol(e, 0, 10); + if (cols > 0) { + env->cols = cols; + } + } #else struct term *term = gettib()->proc->term; env->cols = term->cols; |