Changeset View
Changeset View
Standalone View
Standalone View
head/usr.bin/top/display.c
Show First 20 Lines • Show All 1,285 Lines • ▼ Show 20 Lines | memset(old, 0, diff); | ||||
/* remember where the current line is */ | /* remember where the current line is */ | ||||
if (cursor_on_line) | if (cursor_on_line) | ||||
{ | { | ||||
lastline = line; | lastline = line; | ||||
} | } | ||||
} | } | ||||
/* | |||||
* printable(str) - make the string pointed to by "str" into one that is | |||||
* printable (i.e.: all ascii), by converting all non-printable | |||||
* characters into '?'. Replacements are done in place and a pointer | |||||
* to the original buffer is returned. | |||||
*/ | |||||
char * | |||||
printable(char str[]) | |||||
{ | |||||
char *ptr; | |||||
char ch; | |||||
ptr = str; | |||||
while ((ch = *ptr) != '\0') | |||||
{ | |||||
if (!isprint(ch)) | |||||
{ | |||||
*ptr = '?'; | |||||
} | |||||
ptr++; | |||||
} | |||||
return(str); | |||||
} | |||||
void | void | ||||
i_uptime(struct timeval *bt, time_t *tod) | i_uptime(struct timeval *bt, time_t *tod) | ||||
{ | { | ||||
time_t uptime; | time_t uptime; | ||||
int days, hrs, mins, secs; | int days, hrs, mins, secs; | ||||
if (bt->tv_sec != -1) { | if (bt->tv_sec != -1) { | ||||
uptime = *tod - bt->tv_sec; | uptime = *tod - bt->tv_sec; | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |