Patch supplied by Kent R. Spillner <kspillner@acm.org>.
Previous watch -g would do the following:
unchanged screen (wait)
changed screen (wait)
(exit)
Now it exits right after the screen changes.
int pipefd[2];
int status;
- int exit_early = 0;
pid_t child;
static struct option longopts[] = {
if (precise_timekeeping)
next_loop = get_time_usec();
- do {
+ while (1) {
time_t t = time(NULL);
char *ts = ctime(&t);
int tsl = strlen(ts);
if ((p = fdopen(pipefd[0], "r")) == NULL)
xerr(5, _("fdopen"));
+ int exit_early = 0;
for (y = show_title; y < height; y++) {
int eolseen = 0, tabpending = 0;
#ifdef WITH_WATCH8BIT
}
first_screen = 0;
refresh();
+
+ if (exit_early)
+ break;
+
if (precise_timekeeping) {
watch_usec_t cur_time = get_time_usec();
next_loop += USECS_PER_SEC * interval;
usleep(next_loop - cur_time);
} else
usleep(interval * 1000000);
- } while (!exit_early);
+ }
endwin();