1. 03 Mar, 2018 1 commit
    • Craig Small's avatar
      watch: use sysconf() for hostname length · d4a9a1e5
      Craig Small authored
      Hurd doesn't have HOST_NAME_MAX, neither does Solaris.
      An early fix just checked for this value and used 64 instead.
      This change uses sysconf which is the correct method, possibly until
      this compiles on some mis-behaving OS which doesn't have this value.
      
      References:
       commit e564ddcb
       #54
      d4a9a1e5
  2. 20 Dec, 2017 1 commit
  3. 22 May, 2017 1 commit
    • jim warner's avatar
      misc: eliminate all those remaining gcc -Wall warnings · 629fa81b
      jim warner authored
      Reference(s):
      proc/readproc.c: In function 'statm2proc'
      proc/readproc.c:627:9: warning: variable 'num' set but not used [-Wunused-but-set-variable]
      
      ps/output.c: In function 'pr_context':
      ps/output.c:1273:14: warning: unused variable 'tried_load' [-Wunused-variable]
      ps/output.c:1272:16: warning: unused variable 'ps_is_selinux_enabled' [-Wunused-variable]
      ps/output.c:1272:16: warning: 'ps_is_selinux_enabled' defined but not used [-Wunused-variable]
      ps/output.c:1273:14: warning: 'tried_load' defined but not used [-Wunused-variable]
      ps/output.c:1837:18: warning: 'shortsort_array_count' defined but not used [-Wunused-const-variable=]
      ps/output.c:1803:18: warning: 'aix_array_count' defined but not used [-Wunused-const-variable=]
      
      ps/parser.c: In function 'arg_type':
      ps/parser.c:1098:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      ps/parser.c:1099:34: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
      
      ps/sortformat.c: In function 'format_parse':
      ps/sortformat.c:241:1: warning: label 'out' defined but not used [-Wunused-label]
      
      ps/stacktrace.c:176:13: warning: 'stack_trace_sigsegv' defined but not used [-Wunused-function]
      
      watch.c: In function 'process_ansi':
      watch.c:234:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
      watch.c:237:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
      Signed-off-by: jim warner's avatarJim Warner <james.warner@comcast.net>
      629fa81b
  4. 07 Aug, 2016 1 commit
  5. 10 Jul, 2016 1 commit
    • Craig Small's avatar
      watch: define HOST_NAME_MAX · e564ddcb
      Craig Small authored
      Those infernal arches of kfreebsd-i386 (not -amd64) don't define
      HOST_NAME_MAX. This patch is a work-around for those systems with
      lacking include files.
      e564ddcb
  6. 09 Jul, 2016 6 commits
    • Craig Small's avatar
      watch: fix process_ansi typo · 9115ad76
      Craig Small authored
      When I had to apply Josh's ansi fix a few commits below I put the
      return before the setattr
      
      References:
       commit 261c571a
      9115ad76
    • Craig Small's avatar
      watch: Remove second [m check · 2f5e0da5
      Craig Small authored
      With the previous watch fixes, there is no need for the second
      [m check as these are covered in previous checks.
      2f5e0da5
    • Josh Triplett's avatar
      watch: Don't attempt to ungetc parts of unknown ANSI escape sequences · 0236d278
      Josh Triplett authored
      If process_ansi encountered an unknown character when processing an ANSI
      escape sequence, it would ungetc all the characters read so far, except
      for the character just read, and the opening '\033['.  ungetting the
      middle of the escape sequence does not produce useful results, and also
      relies on the unportable assumption that ungetc works on multiple
      characters (which glibc does not support).  Discard the characters
      instead.
      Signed-off-by: Josh Triplett's avatarJosh Triplett <josh@joshtriplett.org>
      0236d278
    • Josh Triplett's avatar
      watch: Fix ANSI escape sequence termination · f9a4fef6
      Josh Triplett authored
      process_ansi stopped processing an ANSI escape sequence if
      (c < '0' && c > '9' && c != ';'), which will never happen.  Fix the
      range check to use || instead.
      Signed-off-by: Josh Triplett's avatarJosh Triplett <josh@joshtriplett.org>
      f9a4fef6
    • Josh Triplett's avatar
      watch: Don't process additional numbers in unknown ANSI color escapes · 261c571a
      Josh Triplett authored
      process_ansi assumed all numbers in a color control sequence correspond
      to colors or attributes, which breaks badly if it encounters a
      ISO-8613-3 escape sequence (such as for truecolor RGB).  For instance,
      the sequence "\x1b[38;2;10;20;30m" sets the foreground color to
      rgb(10,20,30), but watch will interpret all five numbers in the sequence
      as colors or attributes themselves.
      
      Stop processing the entire escape sequence if watch encounters any
      number it doesn't understand, as that number may change the meaning of
      the rest of the sequence.
      261c571a
    • Craig Small's avatar
      watch: fix 8bit regression · 3ead0207
      Craig Small authored
      As part of the fix to truncate the command in non-8bit, watch had
      the function for output_header changed (much for scope cleanliness
      and cohesiveness than anything; so I'm going to blame Meyer)...
      
      Anyhow the 8bit enabled version did not have that update which
      meant watch failed to compile. Thanks to @asavah for issue #37
      and the patch.
      
      References:
       commit 5a40c797
      3ead0207
  7. 03 Jul, 2016 1 commit
  8. 02 Jul, 2016 2 commits
  9. 18 Nov, 2015 1 commit
    • Craig Small's avatar
      watch: interpret esc[m sequence · 6fcb6900
      Craig Small authored
      Commit 99fa7f removed watch crashing from having the null ANSI
      sequence. However it just ignored that sequence instead of fixing it.
      
      This change correctly checks buf (not undefined endptr) and sends
      the reset attribute if found.
      
      Closes: #12
      6fcb6900
  10. 01 Sep, 2015 1 commit
  11. 05 Jul, 2015 1 commit
  12. 25 Feb, 2015 1 commit
    • Jaromir Capik's avatar
      watch: treat <ESC>[m as <ESC>[0m · a5937e4e
      Jaromir Capik authored
      Known terminals call reset in case of empty ANSI sequence.
      We should do the same, even when this is not defined by the
      ANSI standard.
      a5937e4e
  13. 08 Sep, 2014 3 commits
  14. 06 Sep, 2014 2 commits
  15. 20 Aug, 2014 2 commits
  16. 04 Feb, 2014 1 commit
    • Josh Stone's avatar
      watch: Don't leak extra fds to the child · 835b6294
      Josh Stone authored
      Once the write side of the pipe has been duped to stdout for the child,
      the original pipefd is no longer needed, so it can be closed to avoid
      leaking to the child.
      
      The leak can easily be seen with "watch ls -l /proc/self/fd", but I
      found this due to "watch lvs" diagnosing itself:
      
          File descriptor 4 (pipe:[3163616]) leaked on lvs invocation.
      Signed-off-by: 's avatarJosh Stone <jistone@redhat.com>
      835b6294
  17. 27 Dec, 2013 1 commit
  18. 25 Aug, 2013 1 commit
    • Craig Small's avatar
      Increase watch interval. · 764e27a4
      Craig Small authored
      watch would only use an interval of up to 4294 seconds and silently
      change to this limit. The 4294 seconds is 2^32/10^6 or how many
      microseconds fit into unsigned int.
      
      This change increases the limit to 2^32 seconds which is
      approximately 136 years. This should be ok for now. Anything above
      the old limit now uses sleep() instead of usleep() which only uses
      integers (so 9999.123 seconds will be 9999 seconds)
      
      This bug was first reported in 2006 and included a patch by
      Stephen Kratzer. The patch was updated to fit the current source.
      
      Bug-Debian: http://bugs.debian.org/720445
      References: http://sourceforge.net/mailarchive/message.php?msg_id=4335929Signed-off-by: Craig Small's avatarCraig Small <csmall@enc.com.au>
      764e27a4
  19. 20 Mar, 2013 2 commits
    • Rainer Müller's avatar
      watch: Remove unused header · 538bd978
      Rainer Müller authored
      No declaration from proc/procps.h is actually used for watch.
      538bd978
    • Rainer Müller's avatar
      configure: check for program_invocation_name · 042776e0
      Rainer Müller authored
      For portabiliy, check for program_invocation_name during configure and
      define HAVE_PROGRAM_INVOCATION_NAME accordingly. Use of this symbol is
      now enclosed with the appropriate #ifdef block.
      
      The symbol program_invocation_name is only used for error message
      handling using error(), so it's safe to omit this if it is not
      available.
      042776e0
  20. 06 Nov, 2012 1 commit
    • Sami Kerola's avatar
      watch: fix compiler warnings · 58713dbc
      Sami Kerola authored
      watch.c:255:14: warning: no previous declaration for 'get_time_usec' [-Wmissing-declarations]
      watch.c:303:6: warning: no previous declaration for 'output_header' [-Wmissing-declarations]
      watch.c:364:5: warning: no previous declaration for 'run_command' [-Wmissing-declarations]
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      58713dbc
  21. 30 May, 2012 1 commit
  22. 20 May, 2012 1 commit
  23. 23 Mar, 2012 1 commit
    • Sami Kerola's avatar
      all: check stdout and stderr status at exit · 52269d22
      Sami Kerola authored
      If stream status is not checked at the end of execution below problem
      would not report error, or non-zero exit code.  The uptime is just an
      example same was true with all commands of the project.
      
      $ uptime >&- ; echo $?
      uptime: write error: Bad file descriptor
      1
      $ uptime >/dev/full ; echo $?
      uptime: write error: No space left on device
      1
      Signed-off-by: 's avatarSami Kerola <kerolasa@iki.fi>
      52269d22
  24. 17 Mar, 2012 1 commit
    • Craig Small's avatar
      watch -g exits early · ce82c3ea
      Craig Small authored
      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.
      ce82c3ea
  25. 16 Mar, 2012 3 commits
  26. 11 Mar, 2012 2 commits
    • Kent R. Spillner's avatar
      Don't check if output changed on first screen. · ddfc4028
      Kent R. Spillner authored
      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.
      ddfc4028
    • Kent R. Spillner's avatar
      watch: exit cleanly when falling through main loop. · f5a3afdc
      Kent R. Spillner authored
      Revert commit ffe5e0b0.  Restores
      clean exit when falling through main loop.
      
      Previously, watch only exited when there was an error or when
      interrupted by the user.  Commit 81f64657
      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.
      f5a3afdc