version 1.30, 2007/10/16 07:33:08 |
version 1.31, 2007/11/01 19:10:32 |
|
|
* *_procstates(total, brkdn, names) - print the process summary line |
* *_procstates(total, brkdn, names) - print the process summary line |
* |
* |
* Assumptions: cursor is at the beginning of the line on entry |
* Assumptions: cursor is at the beginning of the line on entry |
* lastline is valid |
|
*/ |
*/ |
void |
void |
i_procstates(int total, int *brkdn) |
i_procstates(int total, int *brkdn) |
|
|
if (screen_length > 2 + cpu || !smart_terminal) { |
if (screen_length > 2 + cpu || !smart_terminal) { |
move(2 + cpu, 0); |
move(2 + cpu, 0); |
clrtoeol(); |
clrtoeol(); |
/* print tag and bump lastline */ |
|
addstrp(cpustates_tag(cpu)); |
addstrp(cpustates_tag(cpu)); |
|
|
while ((thisname = *names++) != NULL) { |
while ((thisname = *names++) != NULL) { |
|
|
|
|
/* |
/* |
* *_memory(stats) - print "Memory: " followed by the memory summary string |
* *_memory(stats) - print "Memory: " followed by the memory summary string |
* |
|
* Assumptions: cursor is on "lastline" |
|
* for i_memory ONLY: cursor is on the previous line |
|
*/ |
*/ |
void |
void |
i_memory(int *stats) |
i_memory(int *stats) |
|
|
/* |
/* |
* *_message() - print the next pending message line, or erase the one |
* *_message() - print the next pending message line, or erase the one |
* that is there. |
* that is there. |
* |
|
* Note that u_message is (currently) the same as i_message. |
|
* |
|
* Assumptions: lastline is consistent |
|
*/ |
*/ |
|
|
/* |
/* |
|
|
*/ |
*/ |
|
|
static char next_msg[MAX_COLS + 5]; |
static char next_msg[MAX_COLS + 5]; |
static int msglen = 0; |
static int msgon = 0; |
/* |
|
* Invariant: msglen is always the length of the message currently displayed |
|
* on the screen (even when next_msg doesn't contain that message). |
|
*/ |
|
|
|
void |
void |
i_message(void) |
i_message(void) |
{ |
{ |
/* |
|
while (lastline < y_message) { |
|
if (fputc('\n', stdout) == EOF) |
|
exit(1); |
|
lastline++; |
|
} |
|
*/ |
|
move(y_message, 0); |
move(y_message, 0); |
if (next_msg[0] != '\0') { |
if (next_msg[0] != '\0') { |
standoutp(); |
standoutp(); |
addstrp(next_msg); |
addstrp(next_msg); |
standendp(); |
standendp(); |
clrtoeol(); |
clrtoeol(); |
msglen = strlen(next_msg); |
msgon = TRUE; |
next_msg[0] = '\0'; |
next_msg[0] = '\0'; |
} else if (msglen > 0) { |
} else if (msgon) { |
clrtoeol(); |
clrtoeol(); |
msglen = 0; |
msgon = FALSE; |
} |
} |
} |
} |
|
|
|
|
|
|
/* |
/* |
* *_header(text) - print the header for the process area |
* *_header(text) - print the header for the process area |
* |
|
* Assumptions: cursor is on the previous line and lastline is consistent |
|
*/ |
*/ |
|
|
void |
void |
|
|
|
|
/* |
/* |
* *_process(line, thisline) - print one process line |
* *_process(line, thisline) - print one process line |
* |
|
* Assumptions: lastline is consistent |
|
*/ |
*/ |
|
|
void |
void |
|
|
new_message(int type, const char *msgfmt,...) |
new_message(int type, const char *msgfmt,...) |
{ |
{ |
va_list ap; |
va_list ap; |
int i; |
|
|
|
va_start(ap, msgfmt); |
va_start(ap, msgfmt); |
/* first, format the message */ |
/* first, format the message */ |
vsnprintf(next_msg, sizeof(next_msg), msgfmt, ap); |
vsnprintf(next_msg, sizeof(next_msg), msgfmt, ap); |
va_end(ap); |
va_end(ap); |
|
|
if (msglen > 0) { |
if (next_msg[0] != '\0') { |
/* message there already -- can we clear it? */ |
/* message there already -- can we clear it? */ |
/* yes -- write it and clear to end */ |
/* yes -- write it and clear to end */ |
i = strlen(next_msg); |
|
if ((type & MT_delayed) == 0) { |
if ((type & MT_delayed) == 0) { |
move(y_message, 0); |
move(y_message, 0); |
if (type & MT_standout) |
if (type & MT_standout) |
|
|
if (type & MT_standout) |
if (type & MT_standout) |
standendp(); |
standendp(); |
clrtoeol(); |
clrtoeol(); |
msglen = i; |
msgon = TRUE; |
next_msg[0] = '\0'; |
next_msg[0] = '\0'; |
|
if (smart_terminal) |
|
refresh(); |
} |
} |
} else { |
|
if ((type & MT_delayed) == 0) { |
|
move(y_message, 0); |
|
if (type & MT_standout) |
|
standoutp(); |
|
addstrp(next_msg); |
|
if (type & MT_standout) |
|
standendp(); |
|
clrtoeol(); |
|
msglen = strlen(next_msg); |
|
next_msg[0] = '\0'; |
|
} |
|
} |
} |
if (smart_terminal) |
|
refresh(); |
|
} |
} |
|
|
void |
void |
|
|
|
|
/* all done -- null terminate the string */ |
/* all done -- null terminate the string */ |
*ptr = '\0'; |
*ptr = '\0'; |
|
|
/* account for the extra characters in the message area */ |
|
msglen += cnt; |
|
|
|
/* return either inputted number or string length */ |
/* return either inputted number or string length */ |
putr(); |
putr(); |