aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorMarek Polacek <mmpolacek@gmail.com>2010-10-28 21:34:56 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-10-28 21:34:56 +0200
commit7b18107384d950358e146d42bf02b391fab5ffd6 (patch)
tree9994e2bcaa038c3128ed8b3bca99486e22f660fb /util-linux
parent02788ac7e2a44eee889aa1005e89076f928e964a (diff)
downloadbusybox-w32-7b18107384d950358e146d42bf02b391fab5ffd6.tar.gz
busybox-w32-7b18107384d950358e146d42bf02b391fab5ffd6.tar.bz2
busybox-w32-7b18107384d950358e146d42bf02b391fab5ffd6.zip
*: use _exit() in sighandlers; showkey: do not use exit-thru-sighandler
While at it, make ESC sequences more readable; and removed check for isatty(stdin) in reset. Code shrink: text data bss dec hex filename 884771 936 17216 902923 dc70b busybox_old 884723 936 17216 902875 dc6db busybox_unstripped Signed-off-by: Marek Polacek <mmpolacek@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/more.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index 1fd6f9ee8..788609a08 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -29,16 +29,20 @@ struct globals {
29#define new_settings (G.new_settings ) 29#define new_settings (G.new_settings )
30#define cin_fileno (G.cin_fileno ) 30#define cin_fileno (G.cin_fileno )
31 31
32#define setTermSettings(fd, argp) do { \ 32#define setTermSettings(fd, argp) \
33 if (ENABLE_FEATURE_USE_TERMIOS) tcsetattr(fd, TCSANOW, argp); \ 33do { \
34 } while (0) 34 if (ENABLE_FEATURE_USE_TERMIOS) \
35 tcsetattr(fd, TCSANOW, argp); \
36} while (0)
35#define getTermSettings(fd, argp) tcgetattr(fd, argp) 37#define getTermSettings(fd, argp) tcgetattr(fd, argp)
36 38
37static void gotsig(int sig UNUSED_PARAM) 39static void gotsig(int sig UNUSED_PARAM)
38{ 40{
39 bb_putchar('\n'); 41 /* bb_putchar_stderr doesn't use stdio buffering,
42 * therefore it is safe in signal handler */
43 bb_putchar_stderr('\n');
40 setTermSettings(cin_fileno, &initial_settings); 44 setTermSettings(cin_fileno, &initial_settings);
41 exit(EXIT_FAILURE); 45 _exit(EXIT_FAILURE);
42} 46}
43 47
44#define CONVERTED_TAB_SIZE 8 48#define CONVERTED_TAB_SIZE 8