From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-AUG-1989 02:15
To:	MRGATE::"ARISIA::EVERHART"
Subj:	VMS MORE 3 OF 7

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 18 AUG 89 22:11:43 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Fri, 18 Aug 89 21:54:42 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA29191; Fri, 18 Aug 89 21:50:09 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 19 Aug 89 03:57:03 GMT
From: gem.mps.ohio-state.edu!ginosko!aplcen!jhunix!jhuvms.bitnet@tut.cis.ohio-state.edu  (Xuning Shan)
Organization: Dept. of Chemical Engineering, The Johns Hopkins University
Subject: VMS MORE 3 OF 7
Message-Id: <2322@jhunix.HCF.JHU.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

-+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+
X                        putchar('\n');
X`009`009`009if(!narrow) narrow_width();
X                        exit();
X`009`009case '\032':
X`009`009`009exit();
X`009`009`009break;   /*for clarity */
X                case '=':
X`009`009`009cursor(Screen_Height,Screen_Width/2);
X`009`009`009standout();
X`009`009`009printf("%d",line_pt-1);
X`009`009`009standend();
X                        break;
X`009`009case 'E':
X`009`009case 'e':
X`009`009`009`123  char *ptr,*cmd;
X`009`009`009   cmd=malloc(80);
X`009`009`009   ptr=getenv("MOREEDIT");
X`009`009`009   if(ptr!=NULL)`123  /*use this editor */
X`009`009`009`009strcat(cmd, ptr);
X`009`009`009`009strcat(cmd, "  ");
X`009   `009`009   `125
X`009`009`009else `123
X#ifdef VMSV5  `032
X    sprintf(cmd,"edit/tpu/start=(%d)  ",line_pt-Screen_Height+1);
X#else
X`009`009`009     strcat(cmd,"edit/tpu  ");
X#endif VMSV5
X`009`009`009     `125
X`009`009`009   strcat(cmd, nargv`091curfile`093);
X`009`009`009   putchar('\r');ClrEOL();;
X`009`009`009   printf("Spawning editing process....");
X`009`009`009   lib$do_command(descr(cmd));
X`009`009`009`125
X`009`009`009line_pt=line_pt-(Screen_Height-1);
X`009`009`009clrs();
X                        if (prwindow(Screen_Height - 1)==NULL)
X                                if(eof_check(fname))return;
X
X`009`009`009break;
X/* : commands*/ case ':':
X                        ch=tolower(getkey());
X                        if(ch=='p') return (112);/*ACCII p previous file */
X                        if(ch=='n') return(110);/*ASCII n next file*/
X`009`009`009if(ch=='f') `123
X`009`009`009`009ClrEOL();printf(":f");
X`009`009`009`009ithfile=getint();
X`009`009`009`009if(ithfile>nargc)`123
X`009`009`009`009`009standout();
X`009`009`009`009`009printf("\007No such file!");
X`009`009`009`009`009standend();
X`009`009`009`009`009getkey();
X`009`009`009`009`125
X`009`009`009`009else return(100); /*will check the actuall #*/
X`009`009`009`125
X                `009break;
X`009`009`009
X                default:
X                        putchar('\007');
X                        break;
X                `125
X        `125
X`125  /* more */
X
$ CALL UNPACK MORE.C;1 338820408
$ create/nolog 'f'
Xdefine verb MORE
X   image dua0:`091whatever.path`093more
X   parameter P1 , prompt="File"
X      value (required)
$ CALL UNPACK MORE.CLD;2 1685412636
$ create/nolog 'f'
XVMS MORE Documentation and Modification history:`032
X
XDocumentation  and modification history:
X
XMore is a utility for VMS emulation of the "more/less" function on`032
XUNIX systems. Certain UNIX functions, such as starting VI at the`032
Xcurrent line are not applicable to VMS systems, though an approximate
Xequivalent is available if VMS 5.x is being used. Other options are
Xspecific to VMS ; namely the "list files" feature and the "exit on
XCTRL/Z"  etc.`032
X `032
XMORE provides an enhanced version of the VMS TYPE/PAGE command ; the`032
Xcurrent version of MORE (1.5) supports the use of the commands listed`032
Xbelow. There are several options in MORE that can ( and should ) be`032
Xcustomized to suit individual sites/preferences. Some of these are
Xlisted  here ; these can be changed permanently by editing MORE.C or
Xfor the duration  of a MORE session using the "c" option from within
XMORE.`032
X
XThe string search can be made case-sensitive if desired ; the default
Xvalue is non-case-sensitive. To change this alter the value of`032
X"case_sensitive" at the top of the file MORE.C from "false" to "true".
X`032
XThe behavior of MORE when the end-of-file marker is reached can be
Xchanged  by setting the value of the flag eof_exit, the default value
Xof which is true.  This implies that when the user scrolls past the
Xend-of-file, MORE will quit  the file ( as in TYPE). To change this,
Xset the value of "eof_exit" flag to false.`032
X
XEditing the file from MORE :
X
XThere are several variations possible for using this option. The
Xfirst one  is the choice of editor. By defining the logical name
XMOREEDIT to be your  favorite editor ( eg. ASSIGN/NOLOG EDIT MOREEDIT)`032
Xwill cause MORE to use  the default editor on your system, EDT in
X(too) many cases. With this  editor, one can not start editor at
Xcurrent position. If this logical  name is not defined , the default
Xeditor is EDIT/TPU if  the VMSV5 option  is not used while compiling
XMORE.C and is EDIT/TPU/START=(current_position)  if the VMSV5 option
Xis used. The MOREEDIT feature cannot be used along with  the starting
Xposition capability.`032
X
XThe default behavior of MORE is to spawn a  editor to edit the
Xfile.  It will not return to more.`032
X
XTerminal specific features :
X
XIn general MORE adjusts the size of the screen to utilize the full
Xwindow  available; this assumes that your VMS recognizes the terminal.
XThe default size of the window is 24 lines ; if MORE is to be used`032
Xwith a larger window on non-DEC terminals such as the TEK4014 emulator
Xin VWS  the default should be changed in MORE.H ; the variable name is
XScreen_Height.  To use  CTRL/W for toggling the width of terminals,
Xyour terminal  should have such capability.`032
X
XMORE responds to some of the VT2xx and 3xx keys not found on VT1xx
Xand earlier  terminals. Specifically the next-screen (E6) and the
Xprev-screen (E5) perform  the corresponding tasks.`032
X
XInvoking MORE :
X
XMORE should be defined as a foreign command, or as a command verb
Xusing  the file MORE.CLD.  For example MORE :==
X"$dua0:`091path.to.more_directory`093more" will perform the  foreign command
Xdefinition.`032
X
XTo invoke MORE to operate on a set of files ; use the standard VMS
Xwildcard  features ; for example MORE MORE.* will use all files in the
Xcurrent directory  whose file name is MORE. Unlike EDIT/TPU MORE will
Xuse the first matching file  it finds rather than prompting for the
Xfiletype. MORE works on files in  another directory ; just include
Xthe directory name in the file specification.`032
X
XAnother feature of MORE is to use "more -c" or "more/c" for VMSer;
Xthis will home the cursor and  clear the screen before each subsequent
Xscreen display.`032
X
XKnown bugs : `032
X
XLine counting function is bad.   This results the number of lines`032
Xdisplayed by MORE is not necessary to be Screen_Height-1, especially
Xif the line length is around 79 and 80.`032
X
X   Commands (and their equivalents):
X
X   <SPACE>, f , ctrl-v, next-screen  ==> print next screen`032
X   <CR>  j, +, down arrow, ctrl-n    ==> print next line.`032
X    b, prev-screen                   ==> print previous screen.
X    k, -, ctrl-p, up arrow           ==> go up one line.
X   `032
X    d         ==> go down half a screen.
X    s         ==> skip over next screen.
X                  If prefixed by an integer i, it will skip i screens forwar
Vd.
X    t         ==> top of the file (also g )
X    b         ==> skip backward.
X                  If prefixed by an integer i, it will skip i screens back.
X    h,?       ==> help message.
X    #,:n      ==> go to next file (if more than one specified at start).
X    q,ctrl-z  ==> quit.
X    !         ==> spawn subprocess.
X    /string   ==> search forward for string. `032
X    ?string   ==> search backward for string ( null string produces help).
X    n         ==> next occurrence of last search string( forward or backward
Vs).
X    .         ==> repeat last command except for searching
X    =         ==> print current line number.
X    :p        ==> previous file.
X    :n        ==> next file.
X    :f#       ==> go to ith file.
X    g#        ==> go to # line, default is top of file.
X    c         ==> configure MORE menu.
X    m         ==> places a mark at current line (bottom of the screen)
X    ctrl-g, ' ==> go to marked line
X    ctrl-l    ==> refreshes the screen.
X    ctrl-w    ==> toggles the terminal width between 80 and 132 columns.
X    e         ==> starts editor at current position. If your editor
X`009          is EDT, it starts at the beginning of the file.
X    l         ==> lists the files in the buffer available for browsing.    `
V032
X    %n        ==> goes to position n% of the file.
X
X=========Modification history===============================
X   Author:`032
X   Xuning Shan
X   ins_bxs@jhuvms.BITNET
X   Dept. of Chem. Engr, Johns Hopkins University  18/11/87
X
X   Modification history:
X    `032
X   Modified by Robert Drabek
X   Computer Science Department
X   University of Arizona, Tucson
X    `032
X   December 1987:
X   Added wild-card file searching.
X   Added screen routines using SMG.
X   Added raw key input.
X   Fixed window counting.
X   Fixed string search.
X   Fixed a multitude of other bugs and styled it up a bit.
X   Made it more like the Unix version.
X   Added #, N, and D commands.
X    `032
X   Modified by M. Warner Losh
X   System Manager HydroVAX
X   New Mexico Tech, Socorro NM.
X   ...!lanl!unm-la!unmvax!warner%hydrovax
X    `032
X   December 1987
X    `032
X   Fixed both t and b commands so that when they are at the top of the
X   file, they don't do anything
X   Fixed the spawn command so that it only spawns one job, instead of
X   spawning a spawn.
X   If no files are found, then it says no files were found.
X
X   Modified by Aaron Leonard
X   System Manager UACCIT VAXcluster
X   University of Arizona
X   leonard@rvax.ccit.arizona.edu
X   July 1988
X    `032
X   Unsupported use of fseek() and ftell() in module MORE broke with VMS
X   V5.0 VAXC Run-Time Library.  Fixed by replacing with call to
X   fstat().  Also refrained from exiting on FALSE status returned from
X   Terminal_Open, so as to work on UNKNOWN type terminals.
X    `032
X   Modified by Jan Trumbo
X   University of Arizona system programmer
X   trumbo@rvax.ccit.arizona.edu
X   November 1988
X    `032
X   Retrain from exiting if search string not found.
X   Mapped control characters to '.'
X   Fix the long line problem.
X    `032
X
X   Modified by M. Warner Losh
X   April 1989
X    `032
X   Merge changes posted to the net to make this program work on VMS 5.0.
X   Add some code to emulate some common UNIX file names.
X    `032
X   May 1989
X    `032
X   Added changes from Shan Xuning for factor and improved them for multiple
X   digits.  His changes cover only the s command.
X   Fix small bug in prline so that form feed stop messing with my terminal.
X   Added small fix to the 'b' command to reflect the factor code as well.
X
X   Modified by X. Shan
X   ins_bxs@jhuvms.BITNET
X
X   June 1989
X   added -c option to home cursor and clear screen before
X`009displaying each screen.
X   added . , =, :p, and :n commands
X   commands <cr>, j, +, s, b can be prefixed with an integer.  `032
X
X
XJuly/August 1989.
X
XMost of the features of the MORE  written by Jonathan Corbet
Xof the National Center for Atmospheric Research, (available for
Xanonymous FTP from STOUT.UCAR.EDU) were merged into this version.
XAdded features include file editing, width toggling, list files,
Xmarker placement, backward search, refresh screen, end_of_file and
Xcase-sensitivity toggling    This was done by Xuning Shan, with
Xaid/hindrance from Raj Viruru (Virginia Tech), Mark Boyd
X(UNC-Asheville) and Art Stine ( Clarkson University). The
Xdocumentation and help file were written by  Raj.`032
$ CALL UNPACK MORE.DOC;2 1129520966
$ create/nolog 'f'
X/* include files and global variables  */
X#include stdio
X#include ctype
X#include string
X#include descrip
X#include stat
X`032
X#define TRUE  1
X#define FALSE 0
X#define BELL '\007'    `032
X#define EOS '\0'
X`032
X#define MAXNAME    254
X#define MAXWINDOWS 200
X#define MAXFILES   200
X#define MAXLINES   10000
X`032
Xchar Terminal_Open();
Xvoid clrs();
Xvoid cursor();
Xvoid narrow_width();
Xint  set_width();
Xint  getkey();
Xvoid ClrEOL();
Xint  scroll_r();
Xvoid standend();
Xvoid descriptor();
Xstruct dsc$descriptor_s *descr();
Xvoid standout();
Xint  getint();
X#ifdef UNIX_TO_VMS
Xchar *convert_unix_to_vms();
X#endif UNIX_TO_VMS
X
Xchar *malloc();
Xint more();
Xchar *prwindow();
Xchar *prline();
Xvoid lower_str();
Xvoid conv_nonprt();
Xvoid config();
Xvoid message();
Xint  listfile();
Xint  str_lines();
Xint  search=FALSE;
Xint  Screen_Height = 24; /* may be changed below */
Xint  Screen_Width  = 80;
X
Xextern char *nargv`091MAXFILES+1`093;
Xextern int line_pt,line_end,curfile,ithfile,narrow,flag,nargc;
Xint    line_pt_save,line_mark=0;
Xchar   *fgetline(),*bgetline(),*dgetline();
Xint   no_clrs=FALSE,end_file=FALSE;
$ CALL UNPACK MORE.H;1 1444418021
$ create/nolog 'f'
X1 MORE
X    `032
XMORE is a utility for VMS emulation of the "more/less" function on UNIX
Xsystems. Certain UNIX functions, such as starting VI at the current line
Xare not applicable to VMS systems, though an approximate equivalent is
Xavailable if VMS 5.x is being used. Some other options are specific to
XVMS ; namely the  "list files" feature and the "exit on ctrl-z" etc.
X    `032
XMORE is a file browser ; it allows the user to examine a file ( or a set
Xof files ) without formally invoking an editor.
X    `032
X2 Invoking MORE
X    `032
XMORE can be defined as a foreign command, or as a command verb using the
Xfile MORE.CLD. For example MORE :== "$dua0:`091path.to.more_directory`093MOR
VE"
Xwill perform the foreign command definition.
X    `032
XTo invoke MORE to operate on a set of files ; use the standard VMS
Xwildcard features ; for example MORE MORE.* will use all files in the
Xcurrent directory whose filename is MORE. Unlike EDIT/TPU MORE will
Xuse the first matching file it finds rather than prompting for the
Xfiletype. MORE will work on files in another directory ; just include
Xthe directory name in the file specification.`032
X    `032
XAnother feature of MORE is to use "MORE -c" or "MORE/c"; this will
Xhome the cursor and clear the screen before each subsequent screen
Xdisplay.`032
X    `032
X2 Commands
X    `032
XCommands (and their equivalents):
X    `032
X <SPACE>, f , ctrl-v, next-screen  ==> print next screen
X <CR>  j, +, down arrow, ctrl-n    ==> print next line.
X b, prev-screen                    ==> print previous screen.
X k, -,ctrl-p, up arrow             ==> go up one line.
X d         ==> go down half a screen.
X s         ==> skip over next screen.
X               If prefixed by an integer i, it will skip i screens forward.
X t         ==> top of the file (also g )
X b         ==> skip backward.
X               If prefixed by an integer i, it will skip i screens back.
+-+-+-+-+-+-+-+-  END  OF PART 3 +-+-+-+-+-+-+-+-

