]> granicus.if.org Git - procps-ng/commitdiff
watch: add additional notes about environment
authorCraig Small <csmall@dropbear.xyz>
Tue, 12 May 2020 09:30:28 +0000 (19:30 +1000)
committerCraig Small <csmall@dropbear.xyz>
Tue, 12 May 2020 09:30:28 +0000 (19:30 +1000)
References:
 procps-ng/procps!62
 commit d3e0ff5a0a1c6d123d270b822a828ff52ca8ecaf

NEWS
watch.1
watch.c

diff --git a/NEWS b/NEWS
index 0f3146f9131f5db68d814b17790af1febd56437a..fb83a6727518d39d24e418df60819cedb772b233 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ procps-ng NEXT
   * top: ensure config file backward compatibility         Debian #951335
   * top: add command line 'e' for symmetry with 'E'        issue #165
   * vmstat: Wide mode gives wider proc columns             merge #48
+  * watch: Add environment variable for interval           merge #62
 
 procps-ng-3.3.16
 ----------------
diff --git a/watch.1 b/watch.1
index 4d8ff96bd2430343e1ed2a0d1ea1a014f21f8260..11b794a10cad88fb34e2c7af429d18fa7264177c 100644 (file)
--- a/watch.1
+++ b/watch.1
@@ -1,4 +1,4 @@
-.TH WATCH 1 "2018-03-03" "procps-ng" "User Commands"
+.TH WATCH 1 "2020-05-12" "procps-ng" "User Commands"
 .SH NAME
 watch \- execute a program periodically, showing output fullscreen
 .SH SYNOPSIS
@@ -101,6 +101,16 @@ failed, or command exited up on error.
 .TP
 .B other
 The watch will propagate command exit status as child exit status.
+.SH ENVIRONMENT
+The behaviour of
+.B watch
+is affected by the following environment variables.
+
+.TP
+.B WATCH_INTERVAL
+Update interval, follows the same rules as the
+.B \-\-interval
+command line option.
 .SH NOTES
 POSIX option processing is used (i.e., option processing stops at
 the first non\-option argument).  This means that flags after
diff --git a/watch.c b/watch.c
index 8f290f506bd1bcac0fd4a306ba1ca897b55ab0a4..057243b68ad33dabe5de33af84979ae3dd35ab22 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -706,7 +706,7 @@ int main(int argc, char *argv[])
        atexit(close_stdout);
 
        interval_string = getenv("WATCH_INTERVAL");
-       if(interval_string != NULL) 
+       if(interval_string != NULL)
                interval = strtod_nol_or_err(interval_string, _("Could not parse interval from WATCH_INTERVAL"));
 
        while ((optc =