diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-01-31 00:30:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-01-31 00:30:45 +0000 |
commit | 306f4fe480fe578b78d2c83fa7d13bc2a75f7ea9 (patch) | |
tree | 84298df71edb9d4703410eea52069f80eca55974 | |
parent | 22332fd26f7d37da7ae47c15ecab6edd6a107af3 (diff) | |
download | busybox-306f4fe480fe578b78d2c83fa7d13bc2a75f7ea9.tar.gz |
If the ioctl fails to tell us the winsize, default to 79.
-Erik
-rw-r--r-- | cmdedit.c | 5 | ||||
-rw-r--r-- | shell/cmdedit.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -136,11 +136,14 @@ static void win_changed(int nsig) struct winsize win = { 0, 0, 0, 0 }; static __sighandler_t previous_SIGWINCH_handler; /* for reset */ - /* emulate signal call if not called as a sig handler */ + /* emulate signal call if not called as a sig handler */ if(nsig == -SIGWINCH || nsig == SIGWINCH) { ioctl(0, TIOCGWINSZ, &win); if (win.ws_col > 0) { cmdedit_setwidth( win.ws_col, nsig == SIGWINCH ); + } else { + /* Default to 79 if their console doesn't want to share */ + cmdedit_setwidth( 79, nsig == SIGWINCH ); } } diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 9c2facc7b..169032697 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -136,11 +136,14 @@ static void win_changed(int nsig) struct winsize win = { 0, 0, 0, 0 }; static __sighandler_t previous_SIGWINCH_handler; /* for reset */ - /* emulate signal call if not called as a sig handler */ + /* emulate signal call if not called as a sig handler */ if(nsig == -SIGWINCH || nsig == SIGWINCH) { ioctl(0, TIOCGWINSZ, &win); if (win.ws_col > 0) { cmdedit_setwidth( win.ws_col, nsig == SIGWINCH ); + } else { + /* Default to 79 if their console doesn't want to share */ + cmdedit_setwidth( 79, nsig == SIGWINCH ); } } |