diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-31 00:30:45 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-31 00:30:45 +0000 |
commit | 3155484c0fc2b38f046505a8f0358d3bad1f8b07 (patch) | |
tree | 84298df71edb9d4703410eea52069f80eca55974 /shell | |
parent | f3148fa9c9ae39ee0fc8b2d48bca3649077e90ce (diff) | |
download | busybox-w32-3155484c0fc2b38f046505a8f0358d3bad1f8b07.tar.gz busybox-w32-3155484c0fc2b38f046505a8f0358d3bad1f8b07.tar.bz2 busybox-w32-3155484c0fc2b38f046505a8f0358d3bad1f8b07.zip |
If the ioctl fails to tell us the winsize, default to 79.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@1721 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r-- | shell/cmdedit.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) | |||
136 | struct winsize win = { 0, 0, 0, 0 }; | 136 | struct winsize win = { 0, 0, 0, 0 }; |
137 | static __sighandler_t previous_SIGWINCH_handler; /* for reset */ | 137 | static __sighandler_t previous_SIGWINCH_handler; /* for reset */ |
138 | 138 | ||
139 | /* emulate signal call if not called as a sig handler */ | 139 | /* emulate signal call if not called as a sig handler */ |
140 | if(nsig == -SIGWINCH || nsig == SIGWINCH) { | 140 | if(nsig == -SIGWINCH || nsig == SIGWINCH) { |
141 | ioctl(0, TIOCGWINSZ, &win); | 141 | ioctl(0, TIOCGWINSZ, &win); |
142 | if (win.ws_col > 0) { | 142 | if (win.ws_col > 0) { |
143 | cmdedit_setwidth( win.ws_col, nsig == SIGWINCH ); | 143 | cmdedit_setwidth( win.ws_col, nsig == SIGWINCH ); |
144 | } else { | ||
145 | /* Default to 79 if their console doesn't want to share */ | ||
146 | cmdedit_setwidth( 79, nsig == SIGWINCH ); | ||
144 | } | 147 | } |
145 | } | 148 | } |
146 | 149 | ||