When invoked with the --chgexit/-g options wait until we have at
least one screen of output before checking if the output changed.
Otherwise, we're comparing the initial screen of output to all
spaces, which usually isn't what we want.
Revert commit ffe5e0b08e. Restores
clean exit when falling through main loop.
Previously, watch only exited when there was an error or when
interrupted by the user. Commit 81f64657ba
added another exit condition when the watched command's output
changes, causing execution to fall out of the main loop.
With this change, watch correctly restores the terminal and returns
an exit code indicating success when invoked with the --chgexit/-g
options.
The -d, --differences switch(s) can use optional argument that was
not documented earlier.
Reported-By: Marian Sigler <m@qjym.de>
Bug-Debian: http://bugs.debian.org/597021
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Add new flags to watch (-g/--chgexit) so that it exits when the
output changes. This is useful in builds and shell scripts, for
example when deploying webapps to block the remainder of the
deployment steps until after the webapp starts.
e.g. watch --chgexit curl http://foo/bar
Fixes build warning:
watch.c:682:3: warning: implicit declaration of
function 'waitpid' [-Wimplicit-function-declaration]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Strings with lower caps & no trailing dots have greater change to
have multiple occurences, meaning less effort for translators, than
strings with them.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This change allows user to see what was the last message before exit
on error, and when where the last update.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The -e option would print a confusing error message. This is because
most error messages in watch are one word. This fix makes a more
sensible message about what went wrong.
The -x option exited before the endwin() function was called, so if the
child process died the terminal was left in a funky state. endwin is now
called just before the exit(8) for the -x option.
err and warn are BSD format but they are not recommended by library
developers. However their consiseness is useful!
The solution is to use some macros that create xerr etc which then
just map to the error() function. The next problem is error() uses
program_invocation_name so we set this to program_invovation_short_name
This is a global set but seems to be the convention (or at least errors
are on the short name only) used everywhere else.
Add the following three functions to most of the commands.
setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
A patch from Debian.
Bug-Debian: http://bugs.debian.org/183486
Reviewed-by: Craig Small <csmall@debian.org>
Backported-by: Sami Kerola <kerolasa@iki.fi>
Print same style version string as other procps utilities. Also
the number makes now more sense, when it's coming from autotools
config.h
Signed-off-by: Sami Kerola <kerolasa@iki.fi>