39 |
|
#include <math.h> |
40 |
|
|
41 |
|
#ifdef HAVE_NCURSES_H |
42 |
– |
#include <ncurses.h> |
42 |
|
#define COLOR_SUPPORT |
44 |
– |
#else |
45 |
– |
#include <curses.h> |
43 |
|
#endif |
44 |
+ |
#include CURSES_HEADER_FILE |
45 |
|
|
46 |
|
#define THRESHOLD_LOAD 1.0 |
47 |
|
|
59 |
|
#define THRESHOLD_WARN_DISK 75.0 |
60 |
|
#define THRESHOLD_ALERT_DISK 90.0 |
61 |
|
|
62 |
+ |
int sig_winch_flag = 0; |
63 |
+ |
|
64 |
|
typedef struct{ |
65 |
|
sg_cpu_percents *cpu_percents; |
66 |
|
sg_mem_stats *mem_stats; |
534 |
|
} |
535 |
|
|
536 |
|
void sig_winch_handler(int dummy){ |
537 |
< |
clear(); |
538 |
< |
display_headings(); |
539 |
< |
display_data(0); |
537 |
> |
sig_winch_flag = 1; |
538 |
|
signal(SIGWINCH, sig_winch_handler); |
539 |
|
} |
540 |
|
|
645 |
|
} |
646 |
|
#endif |
647 |
|
nonl(); |
648 |
+ |
curs_set(0); |
649 |
|
cbreak(); |
650 |
|
noecho(); |
651 |
|
timeout(delay * 1000); |
676 |
|
get_stats(); |
677 |
|
} |
678 |
|
last_update = now; |
679 |
+ |
|
680 |
+ |
if(sig_winch_flag) { |
681 |
+ |
clear(); |
682 |
+ |
display_headings(); |
683 |
+ |
sig_winch_flag = 0; |
684 |
+ |
} |
685 |
|
|
686 |
|
display_data(colouron); |
687 |
|
} |