Cleaned up some #ifdef spiderwebs.
This commit is contained in:
parent
c6cdf58747
commit
4fa84e6b54
25
more.c
25
more.c
@ -42,7 +42,6 @@ static const char more_usage[] = "more [FILE ...]\n"
|
|||||||
|
|
||||||
/* ED: sparc termios is broken: revert back to old termio handling. */
|
/* ED: sparc termios is broken: revert back to old termio handling. */
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
#ifdef BB_FEATURE_USE_TERMIOS
|
||||||
|
|
||||||
# if #cpu(sparc)
|
# if #cpu(sparc)
|
||||||
# include <termio.h>
|
# include <termio.h>
|
||||||
# define termios termio
|
# define termios termio
|
||||||
@ -64,24 +63,11 @@ void gotsig(int sig)
|
|||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* BB_FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
|
|
||||||
|
static int terminal_width = 79; /* not 80 in case terminal has linefold bug */
|
||||||
#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */
|
static int terminal_height = 24;
|
||||||
#define TERMINAL_HEIGHT 24
|
|
||||||
|
|
||||||
|
|
||||||
#if defined BB_FEATURE_AUTOWIDTH
|
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
|
||||||
static int terminal_width = TERMINAL_WIDTH;
|
|
||||||
#endif
|
|
||||||
static int terminal_height = TERMINAL_HEIGHT;
|
|
||||||
#else
|
|
||||||
#define terminal_width TERMINAL_WIDTH
|
|
||||||
#define terminal_height TERMINAL_HEIGHT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int more_main(int argc, char **argv)
|
extern int more_main(int argc, char **argv)
|
||||||
@ -209,7 +195,10 @@ extern int more_main(int argc, char **argv)
|
|||||||
if (++lines == terminal_height)
|
if (++lines == terminal_height)
|
||||||
please_display_more_prompt = 1;
|
please_display_more_prompt = 1;
|
||||||
}
|
}
|
||||||
/* If any key other than a return is hit, scroll by one page */
|
/*
|
||||||
|
* If we just read a newline from the file being 'mored' and any
|
||||||
|
* key other than a return is hit, scroll by one page
|
||||||
|
*/
|
||||||
putc(c, stdout);
|
putc(c, stdout);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -42,7 +42,6 @@ static const char more_usage[] = "more [FILE ...]\n"
|
|||||||
|
|
||||||
/* ED: sparc termios is broken: revert back to old termio handling. */
|
/* ED: sparc termios is broken: revert back to old termio handling. */
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
#ifdef BB_FEATURE_USE_TERMIOS
|
||||||
|
|
||||||
# if #cpu(sparc)
|
# if #cpu(sparc)
|
||||||
# include <termio.h>
|
# include <termio.h>
|
||||||
# define termios termio
|
# define termios termio
|
||||||
@ -64,24 +63,11 @@ void gotsig(int sig)
|
|||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
exit(TRUE);
|
exit(TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* BB_FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
|
|
||||||
|
static int terminal_width = 79; /* not 80 in case terminal has linefold bug */
|
||||||
#define TERMINAL_WIDTH 79 /* not 80 in case terminal has linefold bug */
|
static int terminal_height = 24;
|
||||||
#define TERMINAL_HEIGHT 24
|
|
||||||
|
|
||||||
|
|
||||||
#if defined BB_FEATURE_AUTOWIDTH
|
|
||||||
#ifdef BB_FEATURE_USE_TERMIOS
|
|
||||||
static int terminal_width = TERMINAL_WIDTH;
|
|
||||||
#endif
|
|
||||||
static int terminal_height = TERMINAL_HEIGHT;
|
|
||||||
#else
|
|
||||||
#define terminal_width TERMINAL_WIDTH
|
|
||||||
#define terminal_height TERMINAL_HEIGHT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int more_main(int argc, char **argv)
|
extern int more_main(int argc, char **argv)
|
||||||
@ -209,7 +195,10 @@ extern int more_main(int argc, char **argv)
|
|||||||
if (++lines == terminal_height)
|
if (++lines == terminal_height)
|
||||||
please_display_more_prompt = 1;
|
please_display_more_prompt = 1;
|
||||||
}
|
}
|
||||||
/* If any key other than a return is hit, scroll by one page */
|
/*
|
||||||
|
* If we just read a newline from the file being 'mored' and any
|
||||||
|
* key other than a return is hit, scroll by one page
|
||||||
|
*/
|
||||||
putc(c, stdout);
|
putc(c, stdout);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user