aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/widget-tail.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget-tail.c')
-rw-r--r--src/widget-tail.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/widget-tail.c b/src/widget-tail.c
index 69ed7c3..ef6d484 100644
--- a/src/widget-tail.c
+++ b/src/widget-tail.c
@@ -341,15 +341,27 @@ int scu_widget_tail_follow(scu_config * cnf, int fd)
341 char buff[SCU_BUFF_MAX]; 341 char buff[SCU_BUFF_MAX];
342 ssize_t len; 342 ssize_t len;
343 struct timespec ts; 343 struct timespec ts;
344 unsigned alarm_seconds;
345 unsigned tailtimeout;
346 char * value;
347 char * ptr;
344 348
349 alarm_seconds = SCU_TAIL_TIMEOUT;
345 ts.tv_sec = 0; 350 ts.tv_sec = 0;
346 ts.tv_nsec = 10000000; 351 ts.tv_nsec = 10000000;
347 timeout_alarmed = 0; 352 timeout_alarmed = 0;
348 353
349#if (SCU_TAIL_TIMEOUT > 0) 354 // sets alarm for terminating follow
350 signal(SIGALRM, scu_widget_tail_follow_alarm); 355 if ((value = getenv("TAILTIMEOUT")) != NULL)
351 alarm(SCU_TAIL_TIMEOUT); 356 {
352#endif 357 tailtimeout = (unsigned)strtoul(value, &ptr, 0);
358 alarm_seconds = (ptr == value) ? alarm_seconds : tailtimeout;
359 };
360 if (alarm_seconds > 0)
361 {
362 signal(SIGALRM, scu_widget_tail_follow_alarm);
363 alarm(alarm_seconds);
364 };
353 365
354 while (!(timeout_alarmed)) 366 while (!(timeout_alarmed))
355 { 367 {