diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/ps.c | 4 | ||||
-rw-r--r-- | procps/watch.c | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/procps/ps.c b/procps/ps.c index 50b6a6c..5150a08 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -322,7 +322,7 @@ int ps_main(int argc, char **argv) * and such large widths */ terminal_width = MAX_WIDTH; if (isatty(1)) { - get_terminal_width_height(1, &terminal_width, NULL); + get_terminal_width_height(0, &terminal_width, NULL); if (--terminal_width > MAX_WIDTH) terminal_width = MAX_WIDTH; } @@ -364,7 +364,7 @@ int ps_main(int argc, char **argv) if (w_count) { terminal_width = (w_count==1) ? 132 : MAX_WIDTH; } else { - get_terminal_width_height(1, &terminal_width, NULL); + get_terminal_width_height(0, &terminal_width, NULL); /* Go one less... */ if (--terminal_width > MAX_WIDTH) terminal_width = MAX_WIDTH; diff --git a/procps/watch.c b/procps/watch.c index 2ad0564..b2adcd5 100644 --- a/procps/watch.c +++ b/procps/watch.c @@ -28,7 +28,7 @@ int watch_main(int argc, char **argv) { unsigned opt; unsigned period = 2; - unsigned cmdlen = 1; // 1 for terminal NUL + unsigned cmdlen; char *header = NULL; char *cmd; char *tmp; @@ -42,6 +42,7 @@ int watch_main(int argc, char **argv) argv += optind; p = argv; + cmdlen = 1; // 1 for terminal NUL while (*p) cmdlen += strlen(*p++) + 1; tmp = cmd = xmalloc(cmdlen); @@ -58,7 +59,7 @@ int watch_main(int argc, char **argv) char *thyme; time_t t; - get_terminal_width_height(STDOUT_FILENO, &width, 0); + get_terminal_width_height(STDIN_FILENO, &width, 0); header = xrealloc(header, width--); // '%-*s' pads header with spaces to the full width snprintf(header, width, "Every %ds: %-*s", period, width, cmd); |