Index: doc/src/sgml/ref/psql-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.79
diff -c -c -r1.79 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml 19 Oct 2002 00:22:14 -0000 1.79
--- doc/src/sgml/ref/psql-ref.sgml 8 Nov 2002 19:09:26 -0000
***************
*** 1456,1476 ****
pager
! Toggles the use of a pager for query and psql> help output. If the
! environment variable PAGER is set, the output
! is piped to the specified program. Otherwise a platform-dependent default (such as
more) is used.
! In any case, psql only uses the
! pager if it seems appropriate. That means among other things
! that the output is to a terminal and that the table would
! normally not fit on the screen. Because of the modular nature
! of the printing routines it is not always possible to predict
! the number of lines that will actually be printed. For that
! reason psql might not appear very
! discriminating about when to use the pager.
--- 1456,1476 ----
pager
! Controls use of a pager for query and psql>
! help output. If the environment variable PAGER
! is set, the output is piped to the specified program.
! Otherwise a platform-dependent default (such as
more) is used.
! When the pager is off, the pager is not used. When the pager
! is on, the pager is used only when appropriate, i.e. the
! output is to a terminal and will not fit on the screen.
! (psql> does not do a perfect job of estimating
! when to use the pager.) \pset pager> turns the
! pager on and off. Pager can also be set to always>,
! which causes the pager to be always used.
Index: src/bin/psql/command.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/command.c,v
retrieving revision 1.84
diff -c -c -r1.84 command.c
*** src/bin/psql/command.c 23 Oct 2002 19:23:56 -0000 1.84
--- src/bin/psql/command.c 8 Nov 2002 19:09:34 -0000
***************
*** 1873,1883 ****
/* toggle use of pager */
else if (strcmp(param, "pager") == 0)
{
! popt->topt.pager = !popt->topt.pager;
if (!quiet)
{
! if (popt->topt.pager)
puts(gettext("Using pager is on."));
else
puts(gettext("Using pager is off."));
}
--- 1873,1890 ----
/* toggle use of pager */
else if (strcmp(param, "pager") == 0)
{
! if (value && strcasecmp(value, "always") == 0)
! popt->topt.pager = 2;
! else if (popt->topt.pager == 1)
! popt->topt.pager = 0;
! else
! popt->topt.pager = 1;
if (!quiet)
{
! if (popt->topt.pager == 1)
puts(gettext("Using pager is on."));
+ else if (popt->topt.pager == 2)
+ puts(gettext("Using pager is always."));
else
puts(gettext("Using pager is off."));
}
Index: src/bin/psql/common.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/common.c,v
retrieving revision 1.51
diff -c -c -r1.51 common.c
*** src/bin/psql/common.c 29 Oct 2002 19:35:33 -0000 1.51
--- src/bin/psql/common.c 8 Nov 2002 19:09:36 -0000
***************
*** 548,554 ****
struct winsize screen_size;
result = ioctl(fileno(stdout), TIOCGWINSZ, &screen_size);
! if (result == -1 || lines > screen_size.ws_row)
{
#endif
pagerprog = getenv("PAGER");
--- 548,554 ----
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");
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.c,v
retrieving revision 1.60
diff -c -c -r1.60 help.c
*** src/bin/psql/help.c 24 Oct 2002 01:33:50 -0000 1.60
--- src/bin/psql/help.c 8 Nov 2002 19:09:38 -0000
***************
*** 159,165 ****
#endif
void
! slashUsage(bool pager)
{
FILE *output;
--- 159,165 ----
#endif
void
! slashUsage(unsigned short int pager)
{
FILE *output;
Index: src/bin/psql/help.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.h,v
retrieving revision 1.10
diff -c -c -r1.10 help.h
*** src/bin/psql/help.h 23 Oct 2002 19:23:57 -0000 1.10
--- src/bin/psql/help.h 8 Nov 2002 19:09:38 -0000
***************
*** 10,16 ****
void usage(void);
! void slashUsage(bool pager);
void helpSQL(const char *topic, bool pager);
--- 10,16 ----
void usage(void);
! void slashUsage(unsigned short int pager);
void helpSQL(const char *topic, bool pager);
Index: src/bin/psql/print.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/print.h,v
retrieving revision 1.14
diff -c -c -r1.14 print.h
*** src/bin/psql/print.h 4 Sep 2002 20:31:36 -0000 1.14
--- src/bin/psql/print.h 8 Nov 2002 19:09:39 -0000
***************
*** 26,33 ****
enum printFormat format; /* one of the above */
bool expanded; /* expanded/vertical output (if supported
* by output format) */
! bool pager; /* use pager for output (if to stdout and
! * stdout is a tty) */
bool tuples_only; /* don't output headers, row counts, etc. */
unsigned short int border; /* Print a border around the table.
* 0=none, 1=dividing lines, 2=full */
--- 26,34 ----
enum printFormat format; /* one of the above */
bool expanded; /* expanded/vertical output (if supported
* by output format) */
! unsigned short int pager; /* use pager for output (if to stdout and
! * stdout is a tty)
! * 0=off 1=on 2=always */
bool tuples_only; /* don't output headers, row counts, etc. */
unsigned short int border; /* Print a border around the table.
* 0=none, 1=dividing lines, 2=full */
Index: src/bin/psql/startup.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/startup.c,v
retrieving revision 1.68
diff -c -c -r1.68 startup.c
*** src/bin/psql/startup.c 18 Oct 2002 22:05:36 -0000 1.68
--- src/bin/psql/startup.c 8 Nov 2002 19:09:41 -0000
***************
*** 137,143 ****
pset.popt.topt.format = PRINT_ALIGNED;
pset.queryFout = stdout;
pset.popt.topt.border = 1;
! pset.popt.topt.pager = true;
pset.popt.default_footer = true;
SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
--- 137,143 ----
pset.popt.topt.format = PRINT_ALIGNED;
pset.queryFout = stdout;
pset.popt.topt.border = 1;
! pset.popt.topt.pager = 1;
pset.popt.default_footer = true;
SetVariable(pset.vars, "VERSION", PG_VERSION_STR);