Merge branch 'awesomeclaw/procps-master'
References: procps-ng/procps!62 Signed-off-by: Craig Small <csmall@dropbear.xyz>
This commit is contained in:
1
NEWS
1
NEWS
@ -10,6 +10,7 @@ procps-ng NEXT
|
|||||||
* top: ensure config file backward compatibility Debian #951335
|
* top: ensure config file backward compatibility Debian #951335
|
||||||
* top: add command line 'e' for symmetry with 'E' issue #165
|
* top: add command line 'e' for symmetry with 'E' issue #165
|
||||||
* vmstat: Wide mode gives wider proc columns merge #48
|
* vmstat: Wide mode gives wider proc columns merge #48
|
||||||
|
* watch: Add environment variable for interval merge #62
|
||||||
|
|
||||||
procps-ng-3.3.16
|
procps-ng-3.3.16
|
||||||
----------------
|
----------------
|
||||||
|
15
watch.1
15
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
|
.SH NAME
|
||||||
watch \- execute a program periodically, showing output fullscreen
|
watch \- execute a program periodically, showing output fullscreen
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -21,7 +21,8 @@ has changed at least once since first iteration.
|
|||||||
\fB\-n\fR, \fB\-\-interval\fR \fIseconds\fR
|
\fB\-n\fR, \fB\-\-interval\fR \fIseconds\fR
|
||||||
Specify update interval. The command will not allow quicker than 0.1 second
|
Specify update interval. The command will not allow quicker than 0.1 second
|
||||||
interval, in which the smaller values are converted. Both '.' and ',' work
|
interval, in which the smaller values are converted. Both '.' and ',' work
|
||||||
for any locales.
|
for any locales. The WATCH_INTERVAL environment can be used to persistently
|
||||||
|
set a non-default interval (following the same rules and formatting).
|
||||||
.TP
|
.TP
|
||||||
\fB\-p\fR, \fB\-\-precise\fR
|
\fB\-p\fR, \fB\-\-precise\fR
|
||||||
Make
|
Make
|
||||||
@ -100,6 +101,16 @@ failed, or command exited up on error.
|
|||||||
.TP
|
.TP
|
||||||
.B other
|
.B other
|
||||||
The watch will propagate command exit status as child exit status.
|
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
|
.SH NOTES
|
||||||
POSIX option processing is used (i.e., option processing stops at
|
POSIX option processing is used (i.e., option processing stops at
|
||||||
the first non\-option argument). This means that flags after
|
the first non\-option argument). This means that flags after
|
||||||
|
14
watch.c
14
watch.c
@ -668,6 +668,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int optc;
|
int optc;
|
||||||
double interval = 2;
|
double interval = 2;
|
||||||
|
char *interval_string;
|
||||||
char *command;
|
char *command;
|
||||||
char **command_argv;
|
char **command_argv;
|
||||||
int command_length = 0; /* not including final \0 */
|
int command_length = 0; /* not including final \0 */
|
||||||
@ -701,6 +702,10 @@ int main(int argc, char *argv[])
|
|||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
atexit(close_stdout);
|
atexit(close_stdout);
|
||||||
|
|
||||||
|
interval_string = getenv("WATCH_INTERVAL");
|
||||||
|
if(interval_string != NULL)
|
||||||
|
interval = strtod_nol_or_err(interval_string, _("Could not parse interval from WATCH_INTERVAL"));
|
||||||
|
|
||||||
while ((optc =
|
while ((optc =
|
||||||
getopt_long(argc, argv, "+bced::ghn:pvtx", longopts, (int *)0))
|
getopt_long(argc, argv, "+bced::ghn:pvtx", longopts, (int *)0))
|
||||||
!= EOF) {
|
!= EOF) {
|
||||||
@ -730,10 +735,6 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
interval = strtod_nol_or_err(optarg, _("failed to parse argument"));
|
interval = strtod_nol_or_err(optarg, _("failed to parse argument"));
|
||||||
if (interval < 0.1)
|
|
||||||
interval = 0.1;
|
|
||||||
if (interval > UINT_MAX)
|
|
||||||
interval = UINT_MAX;
|
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
precise_timekeeping = 1;
|
precise_timekeeping = 1;
|
||||||
@ -750,6 +751,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interval < 0.1)
|
||||||
|
interval = 0.1;
|
||||||
|
if (interval > UINT_MAX)
|
||||||
|
interval = UINT_MAX;
|
||||||
|
|
||||||
if (optind >= argc)
|
if (optind >= argc)
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user