diff options
author | Marek Polacek <mmpolacek@gmail.com> | 2010-10-28 23:34:56 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-28 23:34:56 +0400 |
commit | 7b18107384d950358e146d42bf02b391fab5ffd6 (patch) | |
tree | 9994e2bcaa038c3128ed8b3bca99486e22f660fb /util-linux/more.c | |
parent | 02788ac7e2a44eee889aa1005e89076f928e964a (diff) |
*: 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/more.c')
-rw-r--r-- | util-linux/more.c | 14 |
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 { #define new_settings (G.new_settings ) #define cin_fileno (G.cin_fileno ) -#define setTermSettings(fd, argp) do { \ - if (ENABLE_FEATURE_USE_TERMIOS) tcsetattr(fd, TCSANOW, argp); \ - } while (0) +#define setTermSettings(fd, argp) \ +do { \ + if (ENABLE_FEATURE_USE_TERMIOS) \ + tcsetattr(fd, TCSANOW, argp); \ +} while (0) #define getTermSettings(fd, argp) tcgetattr(fd, argp) static void gotsig(int sig UNUSED_PARAM) { - bb_putchar('\n'); + /* bb_putchar_stderr doesn't use stdio buffering, + * therefore it is safe in signal handler */ + bb_putchar_stderr('\n'); setTermSettings(cin_fileno, &initial_settings); - exit(EXIT_FAILURE); + _exit(EXIT_FAILURE); } #define CONVERTED_TAB_SIZE 8 |