Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/console-tools/resize.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/console-tools/resize.c
r1765 r2725 3 3 * resize - set terminal width and height. 4 4 * 5 * Copyright 2006 Bernhard Fischer5 * Copyright 2006 Bernhard Reutner-Fischer 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 /* no options, no getopt */ … … 12 12 #define ESC "\033" 13 13 14 #define old_termios (*(struct termios*)&bb_common_bufsiz1)14 #define old_termios_p ((struct termios*)&bb_common_bufsiz1) 15 15 16 16 static void 17 onintr(int sig ATTRIBUTE_UNUSED)17 onintr(int sig UNUSED_PARAM) 18 18 { 19 tcsetattr(STDERR_FILENO, TCSANOW, &old_termios);20 exit(1);19 tcsetattr(STDERR_FILENO, TCSANOW, old_termios_p); 20 _exit(EXIT_FAILURE); 21 21 } 22 22 23 int resize_main(int argc, char **argv) ;24 int resize_main(int argc , char **argv)23 int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 24 int resize_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 25 25 { 26 26 struct termios new; 27 struct winsize w = { 0, 0,0,0 };27 struct winsize w = { 0, 0, 0, 0 }; 28 28 int ret; 29 29 … … 34 34 */ 35 35 36 tcgetattr(STDERR_FILENO, &old_termios); /* fiddle echo */37 new = old_termios;36 tcgetattr(STDERR_FILENO, old_termios_p); /* fiddle echo */ 37 memcpy(&new, old_termios_p, sizeof(new)); 38 38 new.c_cflag |= (CLOCAL | CREAD); 39 39 new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); 40 signal(SIGINT, onintr); 41 signal(SIGQUIT, onintr); 42 signal(SIGTERM, onintr); 43 signal(SIGALRM, onintr); 40 bb_signals(0 41 + (1 << SIGINT) 42 + (1 << SIGQUIT) 43 + (1 << SIGTERM) 44 + (1 << SIGALRM) 45 , onintr); 44 46 tcsetattr(STDERR_FILENO, TCSANOW, &new); 45 47 … … 60 62 ret = ioctl(STDERR_FILENO, TIOCSWINSZ, &w); 61 63 62 tcsetattr(STDERR_FILENO, TCSANOW, &old_termios);64 tcsetattr(STDERR_FILENO, TCSANOW, old_termios_p); 63 65 64 66 if (ENABLE_FEATURE_RESIZE_PRINT)
Note:
See TracChangeset
for help on using the changeset viewer.