%cpu and other changes

This commit is contained in:
albert
2004-09-12 15:43:48 +00:00
parent 55b3e73334
commit 59fc9dd711
5 changed files with 138 additions and 101 deletions

52
top.c
View File

@@ -1810,35 +1810,31 @@ static void whack_terminal (void)
{
struct termios newtty;
// the curses part...
#ifdef PRETENDNOCAP
setupterm("dumb", STDOUT_FILENO, NULL);
#else
setupterm(NULL, STDOUT_FILENO, NULL);
#endif
// our part...
if (!Batch) {
if (-1 == tcgetattr(STDIN_FILENO, &Savedtty))
std_err("failed tty get");
newtty = Savedtty;
newtty.c_lflag &= ~(ICANON | ECHO);
newtty.c_oflag &= ~(TAB3);
newtty.c_cc[VMIN] = 1;
newtty.c_cc[VTIME] = 0;
Ttychanged = 1;
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &newtty) == -1) {
putp(Cap_clr_scr);
std_err(fmtmk("failed tty set: %s", strerror(errno)));
}
tcgetattr(STDIN_FILENO, &Rawtty);
#ifndef STDOUT_IOLBF
// thanks anyway stdio, but we'll manage buffering at the frame level...
setbuffer(stdout, Stdout_buf, sizeof(Stdout_buf));
#endif
putp(Cap_clr_scr);
fflush(stdout);
if (Batch) {
setupterm("dumb", STDOUT_FILENO, NULL);
return;
}
setupterm(NULL, STDOUT_FILENO, NULL);
if (tcgetattr(STDIN_FILENO, &Savedtty) == -1)
std_err("failed tty get");
newtty = Savedtty;
newtty.c_lflag &= ~(ICANON | ECHO);
newtty.c_oflag &= ~(TAB3);
newtty.c_cc[VMIN] = 1;
newtty.c_cc[VTIME] = 0;
Ttychanged = 1;
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &newtty) == -1) {
putp(Cap_clr_scr);
std_err(fmtmk("failed tty set: %s", strerror(errno)));
}
tcgetattr(STDIN_FILENO, &Rawtty);
#ifndef STDOUT_IOLBF
// thanks anyway stdio, but we'll manage buffering at the frame level...
setbuffer(stdout, Stdout_buf, sizeof(Stdout_buf));
#endif
putp(Cap_clr_scr);
fflush(stdout);
}