struct termios new_settings;
};
#define G (*(struct globals*)bb_common_bufsiz1)
-//#define G (*ptr_to_globals)
#define INIT_G() ((void)0)
-//#define INIT_G() PTR_TO_GLOBALS = xzalloc(sizeof(G))
#define initial_settings (G.initial_settings)
#define new_settings (G.new_settings )
#define cin_fileno (G.cin_fileno )
#define setTermSettings(fd, argp) tcsetattr(fd, TCSANOW, argp)
#define getTermSettings(fd, argp) tcgetattr(fd, argp)
-static void gotsig(int sig)
+static void gotsig(int sig UNUSED_PARAM)
{
bb_putchar('\n');
setTermSettings(cin_fileno, &initial_settings);
#define CONVERTED_TAB_SIZE 8
int more_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int more_main(int argc, char **argv)
+int more_main(int argc UNUSED_PARAM, char **argv)
{
int c = c; /* for gcc */
int lines;
FILE *file;
FILE *cin;
int len;
- int terminal_width;
- int terminal_height;
+ unsigned terminal_width;
+ unsigned terminal_height;
INIT_G();
* is not a tty and turns into cat. This makes sense. */
if (!isatty(STDOUT_FILENO))
return bb_cat(argv);
- cin = fopen(CURRENT_TTY, "r");
+ cin = fopen_for_read(CURRENT_TTY);
if (!cin)
return bb_cat(argv);
new_settings.c_cc[VMIN] = 1;
new_settings.c_cc[VTIME] = 0;
setTermSettings(cin_fileno, &new_settings);
- signal(SIGINT, gotsig);
- signal(SIGQUIT, gotsig);
- signal(SIGTERM, gotsig);
+ bb_signals(0
+ + (1 << SIGINT)
+ + (1 << SIGQUIT)
+ + (1 << SIGTERM)
+ , gotsig);
#endif
do {
if (c == '\t') {
spaces = CONVERTED_TAB_SIZE - 1;
c = ' ';
- }
+ }
/*
* There are two input streams to worry about here: