>Description:
        If one doesn't provide a default pager to the monitor using --pager,
        and gives the monitor a \P command with no pager specified, the default
        pager is set to stdout, even if the PAGER environment variable is set.
        To my thinking, a bare \P is the user saying "just give me a pager,"
        and if PAGER is set, he has an obvious preference.  Hence, PAGER should
        be used if available.  Your opinion may vary.
>How-To-Repeat:
        grotum:/tmp$ mysql.orig --version
        mysql.orig  Ver 11.12 Distrib 3.23.32, for pc-linux-gnu (i686)
        grotum:/tmp$ export PAGER=less
        grotum:/tmp$ mysql.orig -s
        mysql> \P
        Default pager wasn't set, using stdout.
        mysql> quit
        grotum:/tmp$
>Fix:
--- mysql.cc    Sat Feb  3 19:05:05 2001
+++ mysql.useenvpager.cc        Sat Feb  3 19:03:59 2001
@@ -1764,7 +1764,7 @@
 static int
 com_pager(String *buffer, char *line __attribute__((unused)))
 {
-  char pager_name[FN_REFLEN], *end, *param;
+  char pager_name[FN_REFLEN], *end, *param, *envpager;

   if (status.batch)
     return 0;
@@ -1775,11 +1775,15 @@
   {
     if (!strlen(default_pager))
     {
-      tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
-      opt_nopager=1;
-      strmov(pager, "stdout");
-      PAGER= stdout;
-      return 0;
+      if (! (envpager=(char*) getenv("PAGER")))
+      {
+        tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
+        opt_nopager=1;
+        strmov(pager, "stdout");
+        PAGER= stdout;
+        return 0;
+      }
+      strmov(default_pager, envpager);
     }
     strmov(pager, default_pager);
   }
[end patch]

        I tried the possibilities, and all looks well.  The short result:

        grotum:/tmp$ mysql.useenvpager -s
        mysql> \P
        PAGER set to less
        mysql> quit
        grotum:/tmp$

        Basically, a bare \P will now behave as if --pager had been provided, 
        which makes sense to me, since both show that the user wants a pager.

>Submitter-Id: Brian Robison again?
>Originator: ditto?
>Organization:
>MySQL support: none
>Synopsis:      \P with --pager not specified doesn't use PAGER if set
>Severity:      non-critical
>Priority:      low
>Category:      mysql
>Class:         change-request
>Release:       mysql-3.23.32 (Source distribution)
>Server: /usr/local/mysql/bin/mysqladmin  Ver 8.14 Distrib 3.23.32, for pc-linux-gnu 
>on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.32
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 21 min 55 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 6  Flush tables: 1  Open tables: 0 
Queries per second avg: 0.003
>Environment:
System: Linux grotum 2.2.16 #3 Mon Jul 31 23:15:18 PDT 2000 i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
LIBC: 
lrwxrwxrwx   1 root     root           13 Jun 16  2000 /lib/libc.so.6 -> libc-2.1.2.so
-rwxr-xr-x   1 root     root      1008844 Sep  9  1999 /lib/libc-2.1.2.so
-rw-r--r--   1 root     root     20019674 Sep 15  1999 /usr/lib/libc.a
-rw-r--r--   1 root     root          178 Sep 15  1999 /usr/lib/libc.so
Configure command: ./configure  --prefix=/usr/local/mysql


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to