From: hirai@cc.swarthmore.edu (Eiji Hirai)
Subject: unofficial Unix gopher 1.01 patch (Re: Is Less Really More?)
Organization: Swarthmore College Computing Center, Swarthmore, PA, USA
Date: Thu, 23 Jul 1992 21:34:31 GMT

chrisl@mirc00.ncms.org (Chris Lang) writes:
> However, while that will fix 'less' for use with Gopher, I second the
> suggestion of adding a GOPHER_PAGER variable, particularly since I don't
> want to leave 'r' and 'f' in my global LESS variable.

Here's the patch.  I hope Paul will incorporate it in the next release.

Here's the precedence:
(1) use the "Pagercmd: " setting in ~/.gopherrc
(2) use the GOPHER_PAGER environment variable
(3) use the PAGER environment variable
(4) use the compiled-in PAGER_COMMAND setting from conf.h.

I reordered the precedence in gopher.c so that .gopherrc takes precedence
over environment variables - this now makes more logical sense.

--
Eiji Hirai <hirai@cc.swarthmore.edu>    :     :    :   :  : :: ::: :::: :::::
Unix Hacker for Swarthmore College      :     :    :   :  : :: ::: :::: :::::
Computing Center, Swarthmore, PA, USA.  Copyright 1992 by Eiji Hirai.
I don't speak for Swarthmore College.   All Rights Reserved.


*** gopher.c.old	Mon Jun 22 12:17:30 1992
--- gopher.c	Thu Jul 23 17:12:21 1992
***************
*** 599,606 ****
       /** get defaults from the rc file **/
  
       set_defs();
-      read_rc();
       read_env();
  
  
       /*** Set up the curses environment ***/
--- 600,607 ----
       /** get defaults from the rc file **/
  
       set_defs();
       read_env();
+      read_rc();
  
  
       /*** Set up the curses environment ***/
*** gopherrc.c.old	Thu Jun 11 20:19:41 1992
--- gopherrc.c	Thu Jul 23 17:25:09 1992
***************
*** 62,67 ****
--- 62,70 ----
  	       
  	       GDsetTitle(BookmarkDir, "Bookmarks");
  	  }
+ 	  else if (strncasecmp(inputline, "Pagercmd: ", 10) == 0) {
+ 	       STRset(PagerCommand, inputline + 10);
+ 	  }
  	  else if (strncasecmp(inputline, "Printercmd: ", 12) == 0) {
  	       STRset(PrinterCommand, inputline + 12);
  	  }
***************
*** 89,94 ****
--- 92,98 ----
  void
  set_defs()
  {
+      STRset(PagerCommand, PAGER_COMMAND);
       STRset(MailCommand, MAIL_COMMAND);
       STRset(PrinterCommand, PRINTER_COMMAND);
       STRset(TelnetCommand, TELNET_COMMAND);
***************
*** 103,111 ****
  {
       /** Get the pager command **/
       
!      if (getenv("PAGER") == NULL)
! 	  STRset(PagerCommand, PAGER_COMMAND);
!      else
  	  STRset(PagerCommand, getenv("PAGER"));
  
       if (getenv("EDITOR") == NULL)
--- 107,115 ----
  {
       /** Get the pager command **/
       
!      if (getenv("GOPHER_PAGER") != NULL)
! 	  STRset(PagerCommand, getenv("GOPHER_PAGER"));
!      else if (getenv("PAGER") != NULL)
  	  STRset(PagerCommand, getenv("PAGER"));
  
       if (getenv("EDITOR") == NULL)
***************
*** 174,180 ****
  	  return;    
       }
  
!      writestring(rcfile, "Printercmd: ");
       writestring(rcfile, STRget(PrinterCommand));
       writestring(rcfile, "\nTelnetcmd: ");
       writestring(rcfile, STRget(TelnetCommand));
--- 178,186 ----
  	  return;    
       }
  
!      writestring(rcfile, "Pagercmd: ");
!      writestring(rcfile, STRget(PagerCommand));
!      writestring(rcfile, "\nPrintercmd: ");
       writestring(rcfile, STRget(PrinterCommand));
       writestring(rcfile, "\nTelnetcmd: ");
       writestring(rcfile, STRget(TelnetCommand));
***************
*** 192,197 ****
--- 198,204 ----
  	  GDtoLink(BookmarkDir, rcfile);
       }
  
+      writestring (rcfile, "\n");
       close(rcfile);
  }
*** gopher.hlp.old	Thu May 21 11:04:44 1992
--- gopher.hlp	Thu Jul 23 17:42:15 1992
***************
*** 28,34 ****
  q : Quit with prompt
  Q : Quit unconditionally.
  = : Display Technical information about current item.
! o : change options
  
  
  The Gopher development team hopes that you find this software useful.
--- 28,34 ----
  q : Quit with prompt
  Q : Quit unconditionally.
  = : Display Technical information about current item.
! O : change options
  
  
  The Gopher development team hopes that you find this software useful.