summaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
diff options
context:
space:
mode:
authorThomas Munro2021-07-12 23:13:48 +0000
committerThomas Munro2021-07-12 23:43:21 +0000
commit7c09d2797ecdf779e5dc3289497be85675f3d134 (patch)
tree4b223d030bc675e57ae1afde13b0a9217a17e136 /src/bin/psql/help.c
parentf014b1b9bb8eda4e82c1805969dbae2b07b7d54d (diff)
Add PSQL_WATCH_PAGER for psql's \watch command.
Allow a pager to be used by the \watch command. This works but isn't very useful with traditional pagers like "less", so use a different environment variable. The popular open source tool "pspg" (also by Pavel) knows how to display the output if you set PSQL_WATCH_PAGER="pspg --stream". To make \watch react quickly when the user quits the pager or presses ^C, and also to increase the accuracy of its timing and decrease the rate of useless context switches, change the main loop of the \watch command to use sigwait() rather than a sleeping/polling loop, on Unix. Supported on Unix only for now (like pspg). Author: Pavel Stehule <[email protected]> Author: Thomas Munro <[email protected]> Discussion: https://postgr.es/m/CAFj8pRBfzUUPz-3gN5oAzto9SDuRSq-TQPfXU_P6h0L7hO%2BEhg%40mail.gmail.com
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r--src/bin/psql/help.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 3c250d11cff..d3fda67edd3 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -347,7 +347,7 @@ helpVariables(unsigned short int pager)
* Windows builds currently print one more line than non-Windows builds.
* Using the larger number is fine.
*/
- output = PageOutput(158, pager ? &(pset.popt.topt) : NULL);
+ output = PageOutput(160, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("List of specially treated variables\n\n"));
@@ -505,6 +505,10 @@ helpVariables(unsigned short int pager)
" alternative location for the command history file\n"));
fprintf(output, _(" PSQL_PAGER, PAGER\n"
" name of external pager program\n"));
+#ifndef WIN32
+ fprintf(output, _(" PSQL_WATCH_PAGER\n"
+ " name of external pager program used for \\watch\n"));
+#endif
fprintf(output, _(" PSQLRC\n"
" alternative location for the user's .psqlrc file\n"));
fprintf(output, _(" SHELL\n"