version 1.11, 2002/07/15 17:20:36 |
version 1.12, 2003/06/12 22:30:23 |
|
|
static void summary_format(); |
static void summary_format(); |
static void line_update(); |
static void line_update(); |
|
|
int display_resize() |
int |
|
display_resize(void) |
{ |
{ |
int display_lines; |
int display_lines; |
|
|
|
|
return(smart_terminal ? display_lines : Largest); |
return(smart_terminal ? display_lines : Largest); |
} |
} |
|
|
int display_init(statics) |
int |
|
display_init(struct statics *statics) |
struct statics *statics; |
|
|
|
{ |
{ |
int display_lines; |
int display_lines; |
char **pp; |
char **pp; |
|
|
return(display_lines); |
return(display_lines); |
} |
} |
|
|
void i_loadave(mpid, avenrun) |
void |
|
i_loadave(pid_t mpid, double *avenrun) |
pid_t mpid; |
|
double *avenrun; |
|
|
|
{ |
{ |
int i; |
int i; |
|
|
|
|
lmpid = mpid; |
lmpid = mpid; |
} |
} |
|
|
void u_loadave(mpid, avenrun) |
void |
|
u_loadave(pid_t mpid, double *avenrun) |
pid_t mpid; |
|
double *avenrun; |
|
|
|
{ |
{ |
int i; |
int i; |
|
|
|
|
} |
} |
} |
} |
|
|
void i_timeofday(tod) |
void |
|
i_timeofday(time_t *tod) |
time_t *tod; |
|
|
|
{ |
{ |
/* |
/* |
* Display the current time. |
* Display the current time. |
|
|
* lastline is valid |
* lastline is valid |
*/ |
*/ |
|
|
void i_procstates(total, brkdn) |
void |
|
i_procstates(int total, int *brkdn) |
int total; |
|
int *brkdn; |
|
|
|
{ |
{ |
int i; |
int i; |
|
|
|
|
memcpy(lprocstates, brkdn, num_procstates * sizeof(int)); |
memcpy(lprocstates, brkdn, num_procstates * sizeof(int)); |
} |
} |
|
|
void u_procstates(total, brkdn) |
void |
|
u_procstates(int total, int *brkdn) |
int total; |
|
int *brkdn; |
|
|
|
{ |
{ |
static char new[128]; |
static char new[128]; |
int i; |
int i; |
|
|
|
|
/* cpustates_tag() calculates the correct tag to use to label the line */ |
/* cpustates_tag() calculates the correct tag to use to label the line */ |
|
|
static char *cpustates_tag() |
static char * |
|
cpustates_tag(void) |
{ |
{ |
char *use; |
char *use; |
|
|
|
|
return(use); |
return(use); |
} |
} |
|
|
void i_cpustates(states) |
void |
|
i_cpustates(int *states) |
int *states; |
|
|
|
{ |
{ |
int i = 0; |
int i = 0; |
int value; |
int value; |
|
|
memcpy(lcpustates, states, num_cpustates * sizeof(int)); |
memcpy(lcpustates, states, num_cpustates * sizeof(int)); |
} |
} |
|
|
void u_cpustates(states) |
void |
|
u_cpustates(int *states) |
int *states; |
|
|
|
{ |
{ |
int value; |
int value; |
char **names = cpustate_names; |
char **names = cpustate_names; |
|
|
} |
} |
} |
} |
|
|
void z_cpustates() |
void |
|
z_cpustates(void) |
{ |
{ |
int i = 0; |
int i = 0; |
char **names = cpustate_names; |
char **names = cpustate_names; |
|
|
|
|
static char memory_buffer[MAX_COLS]; |
static char memory_buffer[MAX_COLS]; |
|
|
void i_memory(stats) |
void |
|
i_memory(int *stats) |
int *stats; |
|
|
|
{ |
{ |
if (fputs("\nMemory: ", stdout) == EOF) |
if (fputs("\nMemory: ", stdout) == EOF) |
exit(1); |
exit(1); |
|
|
exit(1); |
exit(1); |
} |
} |
|
|
void u_memory(stats) |
void |
|
u_memory(int *stats) |
int *stats; |
|
|
|
{ |
{ |
static char new[MAX_COLS]; |
static char new[MAX_COLS]; |
|
|
|
|
/* Invariant: msglen is always the length of the message currently displayed |
/* Invariant: msglen is always the length of the message currently displayed |
on the screen (even when next_msg doesn't contain that message). */ |
on the screen (even when next_msg doesn't contain that message). */ |
|
|
void i_message() |
void |
|
i_message(void) |
{ |
{ |
while (lastline < y_message) |
while (lastline < y_message) |
{ |
{ |
|
|
} |
} |
} |
} |
|
|
void u_message() |
void |
|
u_message(void) |
{ |
{ |
i_message(); |
i_message(); |
} |
} |
|
|
* Assumptions: cursor is on the previous line and lastline is consistent |
* Assumptions: cursor is on the previous line and lastline is consistent |
*/ |
*/ |
|
|
void i_header(text) |
void |
|
i_header(char *text) |
char *text; |
|
|
|
{ |
{ |
header_length = strlen(text); |
header_length = strlen(text); |
if (header_status == ON) |
if (header_status == ON) |
|
|
} |
} |
|
|
/*ARGSUSED*/ |
/*ARGSUSED*/ |
void u_header(text) |
void |
|
u_header(char *text) |
char *text; /* ignored */ |
|
|
|
{ |
{ |
if (header_status == ERASE) |
if (header_status == ERASE) |
{ |
{ |
|
|
* Assumptions: lastline is consistent |
* Assumptions: lastline is consistent |
*/ |
*/ |
|
|
void i_process(line, thisline) |
void |
|
i_process(int line, char *thisline) |
int line; |
|
char *thisline; |
|
|
|
{ |
{ |
char *p; |
char *p; |
char *base; |
char *base; |
|
|
memset(p, 0, display_width - (p - base)); |
memset(p, 0, display_width - (p - base)); |
} |
} |
|
|
void u_process(linenum, linebuf) |
void |
|
u_process(int linenum, char *linebuf) |
int linenum; |
|
char *linebuf; |
|
|
|
{ |
{ |
char *optr; |
char *optr; |
int screen_line = linenum + Header_lines; |
int screen_line = linenum + Header_lines; |
|
|
} |
} |
} |
} |
|
|
void u_endscreen(hi) |
void |
|
u_endscreen(int hi) |
int hi; |
|
|
|
{ |
{ |
int screen_line = hi + Header_lines; |
int screen_line = hi + Header_lines; |
int i; |
int i; |
|
|
} |
} |
} |
} |
|
|
void display_header(t) |
void |
|
display_header(int t) |
int t; |
|
|
|
{ |
{ |
if (t) |
if (t) |
{ |
{ |
|
|
} |
} |
|
|
/*VARARGS2*/ |
/*VARARGS2*/ |
void new_message(type, msgfmt, a1, a2, a3) |
void |
|
new_message(int type, char *msgfmt, caddr_t a1, caddr_t a2, caddr_t a3) |
int type; |
|
char *msgfmt; |
|
caddr_t a1, a2, a3; |
|
|
|
{ |
{ |
int i; |
int i; |
|
|
|
|
} |
} |
} |
} |
|
|
void clear_message() |
void |
|
clear_message(void) |
{ |
{ |
if (clear_eol(msglen) == 1) |
if (clear_eol(msglen) == 1) |
{ |
{ |
|
|
} |
} |
} |
} |
|
|
int readline(buffer, size, numeric) |
int |
|
readline(char *buffer, int size, int numeric) |
char *buffer; |
|
int size; |
|
int numeric; |
|
|
|
{ |
{ |
char *ptr = buffer; |
char *ptr = buffer; |
char ch; |
char ch; |
|
|
|
|
/* internal support routines */ |
/* internal support routines */ |
|
|
static int string_count(pp) |
static int |
|
string_count(char **pp) |
char **pp; |
|
|
|
{ |
{ |
int cnt; |
int cnt; |
|
|
|
|
return(cnt); |
return(cnt); |
} |
} |
|
|
static void summary_format(str, numbers, names) |
static void |
|
summary_format(char *str, int *numbers, char **names) |
char *str; |
|
int *numbers; |
|
char **names; |
|
|
|
{ |
{ |
char *p; |
char *p; |
int num; |
int num; |
|
|
} |
} |
} |
} |
|
|
static void line_update(old, new, start, line) |
static void |
|
line_update(char *old, char *new, int start, int line) |
char *old; |
|
char *new; |
|
int start; |
|
int line; |
|
|
|
{ |
{ |
int ch; |
int ch; |
int diff; |
int diff; |
|
|
* to the original buffer is returned. |
* to the original buffer is returned. |
*/ |
*/ |
|
|
char *printable(str) |
char * |
|
printable(char *str) |
char *str; |
|
|
|
{ |
{ |
char *ptr; |
char *ptr; |
char ch; |
char ch; |