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

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 18 AUG 89 22:11:52 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Fri, 18 Aug 89 21:54:51 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA29205; Fri, 18 Aug 89 21:50:26 -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:58:02 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 4 OF 7
Message-Id: <2323@jhunix.HCF.JHU.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

-+-+-+-+-+-+-+-+ START OF PART 4 -+-+-+-+-+-+-+-+
X h,?       ==> help message.
X #,:n      ==> go to next file (if more than one specified at starting).
X q,ctrl-z  ==> quit.
X !         ==> spawn subprocess.
X  /string   ==> search forward for string.
X ?string   ==> search backward for string ( null string produces help).
X n         ==> next occurrence of last search string( forward or backwards).
X .         ==> repeat last command.
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               is EDT, it starts at the beginning of the file.
X l         ==> lists the files in the buffer available for browsing.
X %n        ==> goes to position n% of the file.
X    `032
X2 Customizing MORE
X    `032
XMORE provides an enhanced version of the VMS TYPE/PAGE command ; the
Xcurrent version of MORE (1.5) supports the use of the commands listed
Xbelow. There are several options in MORE that can ( and should ) be
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    `032
XThe string search can be made case-sensitive if desired ; the default
Xvalue is non-case-sensitive. To change this alter the value of
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    `032
X2 Editing
X
XThere are several variations possible for using this option. The first
Xone is the choice of editor. By defining the logical name MOREEDIT to be
Xyour favorite editor ( eg. ASSIGN/NOLOG EDIT MOREEDIT ) will cause
XMORE to use the default editor on your system, EDT in (too) many
Xcases. If this logical name is not defined , the default editor is
XEDIT/TPU if the VMSV5 option was not used while compiling MORE.C and
Xis EDIT/TPU/START=(current_position) if the VMSV5 option was used. The
XMOREEDIT feature cannot be used along with the starting position
Xcapability.`032
X    `032
XMORE spawn a editing process to edit the file and it does NOT return
Xto MORE.
X
X2 Terminal type
X    `032
XIn general MORE adjusts the size of the screen to utilize the full
Xwindow available; this assumes that the terminal responds to the ANSI
Xcontrol sequences. The default size of the window is 24 lines ; if MORE
Xis to be used with a larger window on non-DEC terminals such as the
XTEK4014 emulator in VMS the default should be changed in MORE.H ; the
Xvariable name is Screen_Height. To use  CTRL/W for toggling the width
Xof a terminal, first your VMS should support this terminal and second
Xyour terminal should have such capability.
X    `032
XMORE responds to some of the VT2xx and 3xx keys not found on VT1xx and
Xearlier terminals. Specifically the next-screen (E6) and the prev-screen
X(E5) perform the corresponding tasks.
$ CALL UNPACK MORE.HLP;1 1061954099
$ create/nolog 'f'
X/*VMS MORE V1.5*/
X#include stdio
Xextern int Screen_Height,Screen_Width;
Xstatic *help`091`093=`123
X"<SPACE>, f, ctrl-v             next screen",
X"b                              skip backward",
X"<cr>, +, j,ctrl-n,down arrow   next line",
X"-, ctrl-p, k, up arrow         scroll up one line",
X"c                              configure more",
X"d                              half a screen",
X"e                              starting editor",
X"g#                             go to specified line",
X"h, ?                           print this message",
X"l                              list of files in buffer and select to read",
X"m                              mark current line(bottom line)",
X"n                              repeat last search",
X"q, ctrl-Z                      quit",
X"s                              skip over next screen",
X"t                              top of the file",
X".                              repeat last command",
X"=                              print current line number",
X"`094G, '                          go to marked line",
X"`094L                             redraw screen",
X"`094W                             toggle narrow/wide screen display",
X":p                             previous file",
X":n, #                          next file",
X":f#                            #th file",
X"%#                             go to # per cent of the file",
X"!                              spawn subprocess",
X"/string                        search forward",
X"?string                        search backward",
XNULL `125;
X
Xstatic int ct=0;`032
Xmore_help()
X`123
X`009int i=1;
X`009clrs();
X/*I have to put them in two screen!!!!
XOtherwise the next screen has only a few lines.*/
X`009printf("\n\n");
X`009while( i<Screen_Height-5)`123
X`009`009if( help`091ct`093!=NULL)`123
X`009`009`009puts(help`091ct++`093);
X`009`009`009i++;
X`009`009`125
X`009`009else `123
X`009`009`009printf("press any key to continue");
X`009`009`009ct=0;
X`009`009`009getkey();
X`009`009`009return;
X`009`009`125
X`009`125
X`009printf("press any key to see next help screen");
X`009getkey();
X`009more_help();
X`009`009
X`125
$ CALL UNPACK MORE_HELP.C;1 1048197291
$ create/nolog 'f'
X/*VMS MORE V1.5*/
X#define NULL   (char *)0
Xchar *prline(factor)
X`123
X`009int i=1;
X`009char str`091500`093;
X`009while(i<=factor)`123
X`009`009if(fgetline(str)!=NULL)`123
X`009`009`009printf("%s",str);
X`009`009`125
X`009`009else `123
X`009`009`009return (NULL);
X`009`009`125
X`009`009i++;
X`009`125
X`009return ((char *)1);
X`125
X
$ CALL UNPACK PRLINE.C;1 891183484
$ create/nolog 'f'
X/*VMS MORE V1.5*/
X#define NULL  (char *)0
X#define FALSE         0
X#define TRUE          1
Xextern int search,no_clrs,flag;
Xchar *prwindow(height)
Xint height;
X`123
X        int i=0;
X        char str`091240`093;
X`009
X        ClrEOL();
X        if(flag  && (!search) &&(!no_clrs) ) clrs();
X`009if(search) search=FALSE;
X        while (i < height)
X        `123
X                if (fgetline(str) != NULL)`123
X`009                conv_nonprt(str);
X        `009        printf("%s", str);
X                `009i += str_lines (str);
X`009`009`125
X`009`009else `123
X`009`009`009return((char *)0);
X`009`009`125
X        `125
X`009return ((char *)1);
X`125  /* prwindow */
X
X
X
X
$ CALL UNPACK PRWINDOW.C;1 457336582
$ create/nolog 'f'
X/*  This file was from:
X`009Gerben Jansen,
X`009SARA (Academic Computing Services),
X`009Amsterdam.
X`009Bitnet:     gerben@hasara5.bitnet   `032
X`009Surfnet:    sara5::gerben
X`009Internet:   gerben@sara.nl
X`009Pattern-match search added by Gerben Jansen.
X
X---X. Shan /*
X/*
X * regex - Regular expression pattern matching and replacement
X * By:  Ozan S. Yigit (oz) Dept. of Computer Science York University
X * These routines are the PUBLIC DOMAIN equivalents of regex routines as fou
Vnd
X * in 4.nBSD UN*X, with minor extensions.
X * These routines are derived from various implementations found in software
X * tools books, and Conroy's grep. They are NOT derived from
X * licensed/restricted software. For more interesting/academic/complicated
X * implementations, see Henry Spencer's regexp routines, or GNU Emacs patter
Vn
X * matching module.
X * Routines: re_comp:        compile a regular expression into a DFA.
X * char *re_comp(s) char *s;
X * re_exec:        execute the DFA to match a pattern.
X * int re_exec(s) char *s;
X * re_modw        change re_exec's understanding of what a "word" looks like
X * (for \< and \>) by adding into the hidden word-character table.
X * void re_modw(s) char *s;
X * re_subs:    substitute the matched portions in a new string.
X * int re_subs(src, dst) char *src; char *dst;
X * re_fail:    failure routine for re_exec.
X * void re_fail(msg, op) char *msg; char op;
X * Regular Expressions:
X * `0911`093     char    matches itself, unless it is a special character (m
Vetachar):
X * . \ `091 `093 * + `094 $
X * `0912`093     .       matches any character.
X * `0913`093     \       matches the character following it, except when fol
Vlowed by a
X * left or right round bracket, a digit 1 to 9 or a left or right angle
X * bracket. (see `0917`093, `0918`093 and `0919`093) It is used as an escape
V character for all
X * other meta-characters, and itself. When used in a set (`0914`093), it is
V treated
X * as an ordinary character.
X * `0914`093     `091set`093   matches one of the characters in the set. If
V the first
X * character in the set is "`094", it matches a character NOT in the set. A
X * shorthand S-E is used to specify a set of characters S upto E, inclusive.
X * The special characters "`093" and "-" have no special meaning if they app
Vear
X * as the first chars in the set. examples:        match:
X * `091a-z`093    any lowercase alpha
X * `091`094`093-`093    any char except `093 and -
X * `091`094A-Z`093   any char except uppercase alpha
X * `091a-zA-Z`093 any alpha
X * `0915`093     *       any regular expression form `0911`093 to `0914`093,
V followed by closure
X * char (*) matches zero or more matches of that form.
X * `0916`093     +       same as `0915`093, except it matches one or more.
X * `0917`093             a regular expression in the form `0911`093 to `0911
V0`093, enclosed as
X * \(form\) matches what form matches. The enclosure creates a set of tags,
X * used for `0918`093 and for pattern substution. The tagged forms are numbe
Vred
X * starting from 1.
X * `0918`093             a \ followed by a digit 1 to 9 matches whatever a p
Vreviously
X * tagged regular expression (`0917`093) matched.
X * `0919`093    \<    a regular expression starting with a \< construct \>
V    and/or
X * ending with a \> construct, restricts the pattern matching to the
X * beginning of a word, and/or the end of a word. A word is defined to be a
X * character string beginning and/or ending with the characters A-Z a-z 0-9
X * and _. It must also be preceded and/or followed by any character outside
X * those mentioned.
X * `09110`093            a composite regular expression xy where x and y are
V in the
X * form `0911`093 to `09110`093 matches the longest match of x followed by a
V match for y.
X * `09111`093    `094    a regular expression starting with a `094 character
V $    and/or
X * ending with a $ character, restricts the pattern matching to the beginnin
Vg
X * of the line, or the end of line. `091anchors`093 Elsewhere in the pattern
V, `094 and
X * $ are treated as ordinary characters.
X * Acknowledgements:
X * HCR's Hugh Redelmeier has been most helpful in various stages of developm
Vent.
X * He convinced me to include BOW and EOW constructs, originally invented by
X * Rob Pike at the University of Toronto.
X * References: Software tools            Kernighan & Plauger Software tools
V in
X * Pascal        Kernighan & Plauger Grep `091rsx-11 C dist`093            D
Vavid
X * Conroy ed - text editor        Un*x Programmer's Manual Advanced editing
X * on Un*x    B. W. Kernighan RegExp routines            Henry Spencer
X * Notes:
X * This implementation uses a bit-set representation for character classes f
Vor
X * speed and compactness. Each character is represented by one bit in a
X * 128-bit block. Thus, CCL or NCL always takes a constant 16 bytes in the
X * internal dfa, and re_exec does a single bit comparison to locate the
X * character in the set.
X * Examples:
X * pattern:    foo*.* compile:    CHR f CHR o CLO CHR o END CLO ANY END END
X * matches:    fo foo fooo foobar fobar foxx ...
X * pattern:    fo`091ob`093a`091rz`093 compile:    CHR f CHR o CCL 2 o b CHR
V a CCL bitset
X * END matches:    fobar fooar fobaz fooaz
X * pattern:    foo\\+ compile:    CHR f CHR o CHR o CHR \ CLO CHR \ END END
X * matches:    foo\ foo\\ foo\\\  ...
X * pattern:    \(foo\)`0911-3`093\1    (same as foo`0911-3`093foo) compile:
V    BOT 1 CHR f
X * CHR o CHR o EOT 1 CCL bitset REF 1 END matches:    foo1foo foo2foo foo3fo
Vo
X * pattern:    \(fo.*\)-\1 compile:    BOT 1 CHR f CHR o CLO ANY END EOT 1 C
VHR -
X * REF 1 END matches:    foo-foo fo-fo fob-fob foobar-foobar ...
X *
X */
X#define MAXDFA  1024
X#define MAXTAG  10
X#define OKP     1
X#define NOP     0
X#define CHR     1
X#define ANY     2
X#define CCL     3
X#define NCL     4
X#define BOL     5
X#define EOL     6
X#define BOT     7
X#define EOT     8
X#define BOW    9
X#define EOW    10
X#define REF     11
X#define CLO     12
X#define END     0
X/* * The following defines are not meant to be changeable. They are for
X * readibility only. */
X#define MAXCHR    128
X#define CHRBIT    8
X#define BITBLK    MAXCHR/CHRBIT
X#define BLKIND    0170
X#define BITIND    07
X#define ASCIIB    0177
Xtypedef /* unsigned */ char CHAR;
Xnoshare static int tagstk`091MAXTAG`093;      /* subpat tag stack.. */
Xnoshare static CHAR dfa`091MAXDFA`093;/* automaton..       */
Xnoshare static int sta = NOP;   /* status of lastpat */
Xnoshare static CHAR bittab`091BITBLK`093;     /* bit table for CCL */
Xnoshare static void
Xnoshare chset(c)
Xregister CHAR   c;
X`123
X        bittab`091((c) & BLKIND) >> 3`093 `124= 1 << ((c) & BITIND);
X`125
X    `032
X#define badpat(x)    return(*dfa = END, x)
X#define store(x)    *mp++ = x
Xchar           *re_comp(pat)
Xchar           *pat;
X`123
X        register char  *p;      /* pattern pointer   */
X        register CHAR  *mp = dfa;       /* dfa pointer       */
X        register CHAR  *lp;     /* saved pointer..   */
X        register CHAR  *sp = dfa;       /* another one..     */
X    `032
X        register int    tagi = 0;       /* tag stack index   */
X        register int    tagc = 1;       /* actual tag count  */
X    `032
X        register int    n;
X        int             c1, c2;
X    `032
X        if (!pat `124`124 !*pat)
X                if (sta)
X                        return (0);
X                else
X                        badpat("No previous regular expression");
+-+-+-+-+-+-+-+-  END  OF PART 4 +-+-+-+-+-+-+-+-

