diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/print.c | 6 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-print.c | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 655850bb2dc..63514e342eb 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -2208,6 +2208,12 @@ PageOutput(int lines, unsigned short int pager) pagerprog = getenv("PAGER"); if (!pagerprog) pagerprog = DEFAULT_PAGER; + else + { + /* if PAGER is empty or all-white-space, don't use pager */ + if (strspn(pagerprog, " \t\r\n") == strlen(pagerprog)) + return stdout; + } #ifndef WIN32 pqsignal(SIGPIPE, SIG_IGN); #endif diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 770f23b1e23..2a85087ab61 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -166,8 +166,9 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) screen_size.ws_col = 80; #endif pagerenv = getenv("PAGER"); + /* if PAGER is unset, empty or all-white-space, don't use pager */ if (pagerenv != NULL && - pagerenv[0] != '\0' && + strspn(pagerenv, " \t\r\n") != strlen(pagerenv) && !po->html3 && ((po->expanded && nTups * (nFields + 1) >= screen_size.ws_row) || |