summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 21:50:55 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 21:50:55 -0600
commitcf9ba0191735a811b64d05f163ba275dd1d327d1 (patch)
tree6929c120151cd3d6c69f925b7c28a3220734dc51 /src
parent1724a442e6f984278923dd56b3ee68e743eebee4 (diff)
downloadztop-fix/default-tui.tar.gz
ztop: start the full-screen view for a bare run on a terminalfix/default-tui
`ztop` with no arguments printed the one-shot CSA report even on a tty, which is not what a person expects from a monitor. Now a terminal and no report option means the TUI; -a, -s, -j, -x and a pipe keep the text.
Diffstat (limited to 'src')
-rw-r--r--src/ztop.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ztop.c b/src/ztop.c
index 1d32e6d..9078739 100644
--- a/src/ztop.c
+++ b/src/ztop.c
@@ -573,7 +573,7 @@ static void usage(FILE *f) {
" -s system name, host, release and address-space count\n"
" -j one line per address space\n"
" -x dump the VSMLIST work and data areas (one-shot only)\n"
- " -d interactive view, refreshed every 2 seconds by default\n"
+ " -d force the interactive view (the default on a terminal)\n"
" -h this text\n");
}
@@ -775,6 +775,12 @@ int main(int argc, char **argv) {
}
}
+ /* A bare `ztop` on a terminal is the full-screen view; anything that
+ * selects a report, or a pipe, keeps the one-shot output. */
+ if (!interactive && !dump && !want_sys && !want_jobs && mask == 0 &&
+ isatty(STDOUT_FILENO))
+ interactive = true;
+
if (interactive) {
if (dump)
(void)fprintf(stderr, "ztop: -x is ignored with -d\n");