version 1.28, 2021/06/02 08:32:22 |
version 1.29, 2021/07/02 15:34:16 |
|
|
#include <string.h> |
#include <string.h> |
#include <term.h> |
#include <term.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <math.h> |
#include <err.h> |
#include <err.h> |
|
|
/* XXX These are defined in term.h and conflict with our variable names */ |
/* XXX These are defined in term.h and conflict with our variable names */ |
|
|
TAILQ_ENTRY(view_ent) entries; |
TAILQ_ENTRY(view_ent) entries; |
}; |
}; |
|
|
useconds_t udelay = 5000000; |
static struct timespec ts_delay = { 5, 0 }; |
|
static struct itimerval it_delay = { { 0, 0 }, { 5, 0 } }; |
|
|
int dispstart = 0; |
int dispstart = 0; |
int humanreadable = 0; |
int humanreadable = 0; |
int interactive = 1; |
int interactive = 1; |
|
|
read_view(); |
read_view(); |
need_sort = 1; |
need_sort = 1; |
gotsig_alarm = 0; |
gotsig_alarm = 0; |
ualarm(udelay, 0); |
setitimer(ITIMER_REAL, &it_delay, NULL); |
} |
} |
|
|
if (need_sort) { |
if (need_sort) { |
|
|
/* XXX if sort took too long */ |
/* XXX if sort took too long */ |
if (gotsig_alarm) { |
if (gotsig_alarm) { |
gotsig_alarm = 0; |
gotsig_alarm = 0; |
ualarm(udelay, 0); |
setitimer(ITIMER_REAL, &it_delay, NULL); |
} |
} |
} |
} |
|
|
|
|
if (interactive && need_update == 0) |
if (interactive && need_update == 0) |
keyboard(); |
keyboard(); |
else if (interactive == 0) |
else if (interactive == 0) |
usleep(udelay); |
nanosleep(&ts_delay, NULL); |
} |
} |
|
|
if (rawmode == 0) |
if (rawmode == 0) |
|
|
return(1); |
return(1); |
|
|
return(0); |
return(0); |
|
} |
|
|
|
void |
|
refresh_delay(double delay) |
|
{ |
|
double secs, frac; |
|
|
|
frac = modf(delay, &secs); |
|
ts_delay.tv_sec = secs; |
|
ts_delay.tv_nsec = frac * 1000000000.0; |
|
if (!timespecisset(&ts_delay)) |
|
ts_delay.tv_nsec = 1000000000; |
|
TIMESPEC_TO_TIMEVAL(&it_delay.it_value, &ts_delay); |
} |
} |