aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2003-03-18 22:15:44 +0000
committerPeter Eisentraut <peter_e@gmx.net>2003-03-18 22:15:44 +0000
commitcf1cf8964925cd36dc7bf034a968a4e44ede382a (patch)
treef80bcdd31d3af6f1783ea382e277130db22d6093 /src/bin/psql/common.c
parent9384dc6e597baf53d3aa07343163ec7011e6181a (diff)
downloadpostgresql-cf1cf8964925cd36dc7bf034a968a4e44ede382a.tar.gz
postgresql-cf1cf8964925cd36dc7bf034a968a4e44ede382a.zip
Make the printing code somewhat more independent by not relying on
functions and global variables from the rest of psql. Also clean up some data type mismatches created by the last pager patch.
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 0caaf1ef640..5d7180f9939 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.56 2003/03/10 22:28:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.57 2003/03/18 22:15:44 petere Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -24,14 +24,6 @@
#include <sys/timeb.h> /* for _ftime() */
#endif
-#ifndef WIN32
-#include <sys/ioctl.h> /* for ioctl() */
-#endif
-
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#endif
-
#include "libpq-fe.h"
#include "pqsignal.h"
@@ -522,46 +514,3 @@ SendQuery(const char *query)
return success;
}
-
-
-/*
- * PageOutput
- *
- * Tests if pager is needed and returns appropriate FILE pointer.
- */
-FILE *
-PageOutput(int lines, bool pager)
-{
- /* check whether we need / can / are supposed to use pager */
- if (pager
-#ifndef WIN32
- &&
- isatty(fileno(stdin)) &&
- isatty(fileno(stdout))
-#endif
- )
- {
- const char *pagerprog;
-
-#ifdef TIOCGWINSZ
- int result;
- struct winsize screen_size;
-
- result = ioctl(fileno(stdout), TIOCGWINSZ, &screen_size);
- if (result == -1 || lines > screen_size.ws_row || pager > 1)
- {
-#endif
- pagerprog = getenv("PAGER");
- if (!pagerprog)
- pagerprog = DEFAULT_PAGER;
-#ifndef WIN32
- pqsignal(SIGPIPE, SIG_IGN);
-#endif
- return popen(pagerprog, "w");
-#ifdef TIOCGWINSZ
- }
-#endif
- }
-
- return stdout;
-}