home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / morefs23.zoo / more.doc next >
Encoding:
Text File  |  1989-08-31  |  22.6 KB  |  595 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                          MORE
  8.                                              
  9.                                A Unix-like file browser
  10.                                           by
  11.                                      Fred C. Smith
  12.                
  13.                
  14.                HISTORY
  15.                In late 1984 Dr. Dobbs Journal published Alan Holub's
  16.             version of GREP. I ported Mr. Holub's version of GREP to run
  17.             on the micro-based workstation that was the environment in
  18.             which I was currently working, and quickly found it to be
  19.             indispensable.
  20.                That, of course, just whetted my appetite for more useful
  21.             programs. I was particularly interested in having a program
  22.             like Unix's MORE, which is sort of a super file browser. The
  23.             workstation I was using had a tool called TYPE (aren't they
  24.             all?), which while much better than nothing, just wasn't as
  25.             good as MORE. It did nothing more than display on the
  26.             terminal one screenfull at a time of text.
  27.                I kept waiting, hoping in vain that Dr. Dobbs would
  28.             publish a follow-up article after GREP, giving me a version
  29.             of MORE. Before too long, however, anticipation got the
  30.             better of me and I decided to write my own.
  31.                
  32.                DESCRIPTION
  33.                Although my version of more has been ported to several
  34.             different environments, this document describes only the
  35.             version for MS-DOS/PC-DOS.
  36.                More is a file browser with a number of interesting and
  37.             useful features. Besides simply displaying a file a
  38.             screenfull at a time, MORE allows scrolling in half
  39.             screenfulls, and a line at a time. It will display an entire
  40.             list of files, one at a time, and can skip forward to the
  41.             next file on the list (without completing the current file,
  42.             if you choose), jump back to the beginning of the current
  43.             file, the beginning of the previous file, skip a specified
  44.             number of screenfulls of the current file, search through
  45.             each file in the list for a specified text string.
  46.                The version of MORE given here is not an exact functional
  47.             copy of the Unix version. There are a couple of reasons for
  48.             that. First, there is more than one version of MORE on Unix,
  49.             depending on which flavor of Unix you have. Second, I did
  50.             not have access to a Unix manual or a Unix system for
  51.             reference at the time I was writing this program. As a
  52.             consequence I first put in those features that I had found
  53.             most useful in the past, then added any others that I could
  54.             remember. However, most of the features found in Unix
  55.             versions of more are here, as well as a few not found on
  56.             Unix.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.    MORE.DOC (V 2.3G)                                                 PAGE 1
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                As in the Unix versions of MORE, this version will search
  74.             for a line containing a match for a specified regular
  75.             expression (for details on regular expressions, see Figure
  76.             1). This allows searching for sequences of text that match
  77.             some specified pattern, rather than a particular character
  78.             sequence.
  79.                A variance from the Unix `standard' version of MORE (that
  80.             relates to searching) is that in the Unix versions that I
  81.             have used, when using the 'n' command to repeat the previous
  82.             search, the search begins at the first line off the bottom
  83.             of the screen. In this version, the search begins at the
  84.             line immediately following the line which contained the
  85.             preceding match, assuming that no other operations have
  86.             occurred since the search. Otherwise, the search begins at
  87.             the first line off the bottom of the screen.
  88.                This version of MORE has another interesting feature not
  89.             seen on most Unix versions, and that is the ability to move
  90.             backwards through a file a screenfull at a time.
  91.                As in the Unix versions, this version pauses at the end
  92.             of each window with a prompt like:
  93.                
  94.                --More--(79%)
  95.                
  96.                The percentage given is the percentage of the current
  97.             input file that has so far been read. If displaying input
  98.             from a pipe, the percentage figure is not displayed.
  99.                This version also contains a help facility. The command
  100.             "h", "H" or "?" causes MORE to print a terse help message on
  101.             the screen, and then return to the prompt.
  102.                Table 1 describes the command line options available in
  103.             MORE. Table 2 gives a detailed explanation of each of the
  104.             commands that are accepted by MORE when it is paused at the
  105.             prompt.
  106.                
  107.                COPYRIGHT INFORMATION
  108.                The regular expression parser in this program is
  109.             excerpted with only minor changes from the GREP distributed
  110.             by DECUS (DEC Users Society). The DECUS code is copyrighted
  111.             by DECUS and may be freely distributed for noncommercial
  112.             purposes only. Some of the low-level routines which access
  113.             the video BIOS are derived from code published in Dr. Dobbs
  114.             Journal by Allen Holub and Jeff Duntemann. The code which
  115.             tests the executable file for corruption (possibly by a
  116.             virus) is derived from code presented in the August 1989 PC
  117.             Magazine "Languages" column. The remainder of the code which
  118.             constitutes this program, as well as the program itself (and
  119.             this documentation), is copyrighted (C) 1986, 1987, 1988,
  120.             1989 by Fred C. Smith. The source is not available, but the
  121.             executable may be freely distributed as long as it is not in
  122.             any way modified and no fee is charged either for the
  123.             program or in connection with its distribution. In plain
  124.             English, I intend for anyone who wants to use my program to
  125.             be able to do so, and I will permit no one to charge any fee
  126.             whatsoever for using or distributing it. My copyright
  127.  
  128.  
  129.  
  130.    MORE.DOC (V 2.3G)                                                 PAGE 2
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.             banner, and all other messages (including this document)
  140.             must remain as I have made them, without change.
  141.                You may distribute more freely (within the constraints
  142.             outlined in the preceding paragraph), but when you
  143.             distribute it you MUST distribute all the files in the
  144.             original package. Those files are: more.doc (this file),
  145.             more.exe, and any readme files which may be in a particular
  146.             release. All files must remain unmodified.
  147.                
  148.                IMPLEMENTATION
  149.                This version of more is a new implementation, independent
  150.             of any versions offered on any variety of Unix system (or,
  151.             for that matter, any other offering). There is no source
  152.             code in common between this and the Unix versions. The only
  153.             commonality is the name and most of the functionality.
  154.                
  155.                USAGE
  156.                more [switches] [file names]
  157.                
  158.                See Table 1 for description of the switches. One or more
  159.             filenames may be given, and DOS wildcards may be used. If no
  160.             files are specified, more will look to standard input for
  161.             data to display. This allows more to handle the output of a
  162.             pipe, for example:
  163.                
  164.                      grep "^void +.+(.*)[^;]*" *.c | more
  165.                
  166.                In which grep will output all lines beginning with a void
  167.             function definition. This output will in turn be piped into
  168.             more for display one page at a time.
  169.                
  170.                INSTALLATION
  171.                The more distribution contains two files (it may also
  172.             contain one or more readme files), as mentioned above in the
  173.             COPYRIGHT section.
  174.                To install more on your system, you should copy more.exe
  175.             into your \bin directory (or into whatever directory you
  176.             keep executables of utility programs -- this directory
  177.             should be mentioned in your PATH environment variable, so
  178.             that DOS can find more for you), and MORE.DOC to the
  179.             location where you keep program documentation.
  180.                
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.    MORE.DOC (V 2.3G)                                                 PAGE 3
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                ENVIRONMENT VARIABLES
  206.                This version of more utilizes the following list of DOS
  207.             environment variables to help it determine its behavior:
  208.             
  209.             TABSIZE -- number of spaces represented by tabs. Default, if
  210.                      not set, is 8.
  211.             MOREMONO -- If this variable exists and contains the string
  212.                      "MONO" (without the quotes) more will always use
  213.                      monochrome display attributes for the prompt
  214.                      (rather than the bright-white-on-blue which it
  215.                      would normally use on a color tube). The default
  216.                      action, if not set as described, is to perform a
  217.                      series of BIOS calls to determine the display
  218.                      adapter/CRT combination in use and to use color or
  219.                      monochrome attributes as is appropriate.
  220.             
  221.                CAVEATS
  222.                This version of more was compiled using Microsoft C5.1
  223.             running on PC-DOS 3.3, and requires MS/PC-DOS version 2.0 or
  224.             higher. I have not been able to test the current version on
  225.             DOS prior to 3.0, but I am not aware of any DOS functions
  226.             being used which would compromise this compatibility.
  227.                The only hardware dependency that I know of is the BEEP
  228.             sound which occurs when illegal commands are given -- this
  229.             beep is produced by direct control of the output ports which
  230.             control the speaker on IBM compatible hardware.
  231.                More does make a number of BIOS calls for things such as
  232.             keyboard input and video output. As long as you are running
  233.             on a machine which is compatible at the BIOS level it should
  234.             work for you (with the exception of the beep sound). I have,
  235.             however, not had the opportunity to try it on non-IBM-
  236.             compatible hardware, so caveat user!
  237.                
  238.                BUGS
  239.                - More assumes it is running on an 80 column by 25 line
  240.             display. In most cases it would be expected to work
  241.             acceptably on a display with more lines or columns, but
  242.             would still scroll in 20-line increments and limit the lines
  243.             to 80 characters in length. In the event that it is run on a
  244.             display with, say, 132X50 columns/lines, it will not display
  245.             correctly those lines which contain exactly 80 characters.
  246.             The line following will be placed immediately following with
  247.             no intervening linefeed.
  248.                
  249.                SUGGESTIONS
  250.                If you have any suggestions for improvement, or find bugs
  251.             which need attention please write to me (or send electronic
  252.             mail) at the address below. Be sure to describe in detail
  253.             how to re-create any bugs, including the full version number
  254.             and compilation date of the more you are using (type 'v' at
  255.             the prompt to see this information), type of machine,
  256.             version of DOS, any TSR's present on the system, etc.
  257.             Remember that more is not my full-time job, so I cannot
  258.  
  259.  
  260.  
  261.  
  262.    MORE.DOC (V 2.3G)                                                 PAGE 4
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.             promise instant attention, but I DO want to know about
  272.             problems so that I can correct them.
  273.                I do not have the time or facilities to get into the
  274.             business of mailing out diskettes, but when significant new
  275.             features or bug fixes occur I will release them through
  276.             bulletin boards and usenet, in the same manner as this
  277.             release.
  278.                My mail address is:
  279.                
  280.                               Fred C. Smith
  281.                               20 Whipple Ave.
  282.                               Stoneham, MA 02180
  283.                Via usenet:
  284.                               ulowell!cg-atla!fredex
  285.                        or:    ginosko!cg-atla!fredex
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.    MORE.DOC (V 2.3G)                                                 PAGE 5
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.             Regular Expressions
  338.             ------------------------------------------------------------
  339.             The regular_expression defines the pattern to search for.
  340.             Upper- and lower-case are distinct. Blank lines never match.
  341.             The expression should be quoted to prevent file-name
  342.             translation.
  343.             
  344.             x        An ordinary character (not mentioned below)
  345.                      matches that character.
  346.             
  347.             '\'      The backslash quotes any character. "\$" matches a
  348.                      dollar-sign.
  349.             
  350.             '^'      A circumflex at the beginning of an expression
  351.                      matches the beginning of a line.
  352.             
  353.             '$'      A dollar-sign at the end of an expression matches
  354.                      the end of a line.
  355.             
  356.             '.'      A period matches any character except "new-line".
  357.  
  358.             ':a', ':d', ':n', ': '
  359.                      A colon matches a class of characters described
  360.                      by the following character. ":a" matches any
  361.                      alphabetic, ":d" matches digits, ":n" matches
  362.                      alphanumerics, ": " matches spaces, tabs, and other
  363.                      control characters, such as new-line.
  364.             
  365.             '*'      An expression followed by an asterisk matches zero
  366.                      or more occurrences of that expression: "fo*"
  367.                      matches "f", "fo" "foo", etc.
  368.             
  369.             '+'      An expression followed by a plus sign matches one
  370.                      or more occurrences of that expression: "fo+"
  371.                      matches "fo", etc.
  372.             
  373.             '-'      An expression followed by a minus sign optionally
  374.                      matches the expression.
  375.             
  376.             '[]'     A string enclosed in square brackets matches any
  377.                      character in that string, but no others. If the
  378.                      first character in the string is a circumflex, the
  379.                      expression matches any character except "newline"
  380.                      and the characters in the string. For example,
  381.                      "[xyz]" matches "xx" and "zyx", while "[^xyz]"
  382.                      matches "abc" but not "axb". A range of characters
  383.                      may be specified by two characters separated by
  384.                      "-". Note that, [a-z] matches alphabetics, while
  385.                      [z-a] never matches.
  386.             
  387.             The concatenation of regular expressions is a regular
  388.             expression. Two regular expressions separated by a | match
  389.             either a match of the first or a match of the second.
  390.  
  391.  
  392.  
  393.  
  394.    MORE.DOC (V 2.3G) -- Figure 1 -- Regular Expressions              PAGE 6
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.             
  404.             Command Line Options
  405.             ------------------------------------------------------------
  406.             -s(Regular Expression)
  407.                  The -s option specifies a regular expression to be used
  408.                  as a search target beginning immediately upon entry to
  409.                  MORE. Like specifying a search function from within
  410.                  MORE except that the text in the first window is also
  411.                  searched.
  412.                  
  413.             -t(tabsize)
  414.                  Defines the width to which tabs are to be expanded when
  415.                  a file is being displayed. By default more uses a value
  416.                  of 8. See also the section on environment variables.
  417.             
  418.             -v
  419.                  This option causes more to execute an internal
  420.                  consistency check before displaying any files. The
  421.                  purpose of this check is to see if the executable file
  422.                  has been modified.If it has the possibility exists that
  423.                  it was modified by a virus program. If any modification
  424.                  is found more prints a warning message and exits. This
  425.                  check is based on a 32-bit CRC, so it should be highly
  426.                  reliable. (It is not, of course, proof against
  427.                  intentional tampering, as a tamperer could easily patch
  428.                  around the virus checking code and distribute the
  429.                  hacked version as a trojan horse of some kind.)
  430.             
  431.             -w(decimal number)
  432.                  Used to specify the window size if a size other than
  433.                  the default of 20 lines is desired.
  434.             ------------------------------------------------------------
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.    MORE.DOC (V 2.3G) -- TABLE 1 -- COMMAND LINE OPTIONS              PAGE 7
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.             
  470.             Commands recognized at `--MORE--' prompt
  471.             ------------------------------------------------------------
  472.             
  473.             return   Causes the display to scroll one line.
  474.             
  475.             d or D   Causes the display to scroll 1/2 the window size,
  476.                      either 10 lines, if the window default of 20 lines
  477.                      is used, or 1/2 the value specified in the        -
  478.                      w<number> command line option switch.
  479.             
  480.             space    Causes the display to scroll 20 lines if the
  481.                      default window size of 20 is used, or the value
  482.                      specified in the -w<number> command line option
  483.                      switch.
  484.             
  485.             /(Regular Expression)
  486.                      Causes MORE to begin searching for a line
  487.                      containing a matching Regular Expression. The
  488.                      search begins at the first line off the bottom of
  489.                      the display. The line containing the target, if
  490.                      found, is positioned near the center of the screen
  491.                      and is displayed with the bright attribute set. (If
  492.                      your screen is already set to some attribute other
  493.                      than white on black, this line may be displayed
  494.                      with some contrasting attribute other than bright
  495.                      white on black, so that it will be easily visible.)
  496.                      Pressing ESC aborts a search in progress.
  497.             
  498.             n or N   Causes MORE to resume the previously specified
  499.                      search. If the search was the last operation
  500.                      performed, searching begins at the first line
  501.                      following the line containing the last match found.
  502.             
  503.             :f or :F Causes MORE to print the current filename at the
  504.                      bottom of the screen.
  505.             
  506.             :n or :N Causes more to abandon the current file, and skip
  507.                      to the beginning of the next file specified in the
  508.                      command line. Exits if the current file is the last
  509.                      file.
  510.             
  511.             :p or :P Causes MORE to jump back to the top of the current
  512.                      file. If already at top of the current file, causes
  513.                      MORE to skip to the top of the preceding file
  514.                      specified in the command line. If there is no
  515.                      preceding file, MORE will go to the top of the
  516.                      current file and display the first window full.
  517.             
  518.             :q or :Q
  519.             q or Q   Causes an immediate exit from MORE.
  520.             
  521.             f or F   Causes MORE to skip (without displaying) one
  522.                      window full. A window is either the default of 20
  523.  
  524.  
  525.  
  526.    MORE.DOC (V2.3G) -- TABLE 2 -- COMMANDS RECOGNIZED AT PROMPT      PAGE 8
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                      lines, or the value used in the -w<number> command
  536.                      line option switch.
  537.             
  538.             h, H, ?  Causes MORE to display a help message which
  539.                      briefly describes all these commands.
  540.             
  541.             e or E   Causes MORE to prompt for a file list. If a list
  542.                      is entered MORE will display those files in the
  543.                      same way as if they had been specified on the
  544.                      command line. Wildcards are accepted. If a null
  545.                      list is entered, MORE will revert to the original
  546.                      list entered on the command line.
  547.             
  548.             t or T   Causes more to prompt for a number which
  549.                      represents the number of spaces to use when
  550.                      expanding tab characters on the screen. Also see
  551.                      the section on environment variables.
  552.             
  553.             !        Execute a command in a subshell (if followed by a
  554.                      command), or provide a prompt in a subshell (if no
  555.                      command is specified). The environment variable
  556.                      COMSPEC is used to determine the path of the shell
  557.                      to exec. The current DOS switch character is used
  558.                      in the command-line passed to that shell.
  559.             
  560.             counts   Commands b, B, f, F, d, D, <return>, and
  561.                      <spacebar> accept a preceding count, i.e., the
  562.                      command '3f' causes 3 windows-full to be skipped.
  563.             
  564.             other input
  565.                      All other input is in error and causes the
  566.                      terminal to beep.
  567.             
  568.             
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.    MORE.DOC (V2.3G) -- TABLE 2 -- COMMANDS RECOGNIZED AT PROMPT      PAGE 9
  593.  
  594.  
  595.