home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / more241.zoo / more.doc < prev    next >
Encoding:
Text File  |  1990-03-27  |  26.9 KB  |  661 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 Allen 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.4.1)                                                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.4.1)                                                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, more.cnf, and any readme files which may be in a
  146.             particular release. All files must remain unmodified. You
  147.             may, of course, modify more.cnf for your own use, but when
  148.             re-distributing more, please use only the original
  149.             unmodified files.
  150.                
  151.                IMPLEMENTATION
  152.                This version of more is a new implementation, independent
  153.             of any versions offered on any variety of Unix system (or,
  154.             for that matter, any other offering). There is no source
  155.             code in common between this and the Unix versions. The only
  156.             commonality is the name and most of the functionality.
  157.                
  158.                USAGE
  159.                more [switches] [file names]
  160.                
  161.                See Table 1 for description of the switches. One or more
  162.             filenames may be given, and DOS wildcards may be used. If no
  163.             files are specified, more will look to standard input for
  164.             data to display. This allows more to handle the output of a
  165.             pipe, for example:
  166.                
  167.                       grep "^void +.+(.*)[^;]*" *.c | more
  168.                
  169.                In which grep will output all lines beginning with a void
  170.             function definition. This output will in turn be piped into
  171.             more for display one page at a time.
  172.                
  173.                INSTALLATION
  174.                The more distribution contains three files (it may also
  175.             contain one or more readme files), as mentioned above in the
  176.             COPYRIGHT section.
  177.                To install more on your system, you should copy more.exe
  178.             into your \bin directory (or into whatever directory you
  179.             keep executables of utility programs -- this directory
  180.             should be mentioned in your PATH environment variable, so
  181.             that DOS can find more for you), more.cnf to your \bin
  182.             directory (or other directory which is mentioned in your
  183.             PATH environment variable), and MORE.DOC to the location
  184.             where you keep program documentation. You should read the
  185.             readme file, if it exists in this release, to learn about
  186.             the enhancements or bug fixes in this release.
  187.                
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.    MORE.DOC (V 2.4.1)                                                PAGE 3
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                CONFIGURATION FILE
  206.                At version 2.4 of more a configuration file has been
  207.             added. This file supersedes the use of DOS environment
  208.             variables for configuring the behavior of more. Those
  209.             environment variables which were utilized by previous
  210.             versions are no longer used, and you should modify your
  211.             environment accordingly.
  212.                The configuration file in this release is named more.cnf.
  213.             It may be placed in any directory which is mentioned in the
  214.             PATH environment variable, as more will search through all
  215.             the directories in that variable until it finds more.cnf or
  216.             until it fails. If it fails it will tell you so, and will
  217.             use a reasonable set of default parameters.
  218.                The contents of this file are ordinary ASCII characters.
  219.             At this release there are six parameters which may be
  220.             specified in more.cnf. They are:
  221.                       windowsize=xx
  222.                       screenwidth=xx
  223.                       tabsize=xx
  224.                       moremono=x
  225.                       use_asm=x
  226.                       pause_at_end=x
  227.                where 'xx' represents a one or more digit decimal number,
  228.             and 'x' represents a single digit value of either '1' to
  229.             enable the switch, or '0' to disable it.
  230.                Blank lines are acceptable, and are ignored. Any line
  231.             whose first character is a '#' character is considered to be
  232.             a comment, and is ignored.
  233.                The meaning of each of these parameters is as follows:
  234.                Windowsize=xx tells more that it is to use a value of
  235.             'xx' as the size of the default scroll (i.e., when the
  236.             'space' command is given). The default value is 20.
  237.                Screenwidth=xx tells more that the maximum line length on
  238.             your display is xx characters. The default is 80. This
  239.             parameter should not be set to any value other than the
  240.             actual screen width, as the rightmost character position is
  241.             handled specially.
  242.                Tabsize=xx tells more that it is to assume that each tab
  243.             character in any file it processes represents tab columns
  244.             each of which is 'x' characters in width. The value given in
  245.             the default more.cnf is 4, while the program defaults (if no
  246.             value is given in more.cnf) to 8.
  247.                Moremono=x tells more how to choose video attributes for
  248.             the --MORE-- prompt. If the value given here is a one, more
  249.             will use the attributes that it normally uses only on
  250.             monochrome displays, even if it is running on a color
  251.             monitor. If the value given is a zero, then more will choose
  252.             the video attributes based on whether or not you have a
  253.             color monitor. In the case of a color monitor more chooses
  254.             bright white on blue as the prompt. The default value is
  255.             zero.
  256.                Use_asm=x tells more whether or not to use the new
  257.             assembly language interface to the video BIOS. A value of
  258.  
  259.  
  260.  
  261.  
  262.    MORE.DOC (V 2.4.1)                                                PAGE 4
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.             '1' tells more to do so, while a value of '0' tells more to
  272.             use the old C language interface. The default value is 1.
  273.                Pause_at_end=x tells more whether or not to pause when it
  274.             encounters the end of the last file in the file list. When
  275.             this parameter is set to 1 more will print a diagnostic and
  276.             return to the --MORE-- prompt when it reaches the end of the
  277.             last file. When set to 0 the behavior will be as in previous
  278.             versions, i.e., more will simply exit after displaying the
  279.             end of the last file. The default value is 1.
  280.                
  281.                CAVEATS
  282.                This version of more was compiled using Microsoft C5.1
  283.             and Microsoft QuickC 2.0 running on PC-DOS 3.3, and requires
  284.             MS/PC-DOS version 2.0 or higher. I have not been able to
  285.             test the current version on DOS prior to 3.0, but I am not
  286.             aware of any DOS functions being used which would compromise
  287.             this compatibility.
  288.                The only hardware dependency that I know of is the BEEP
  289.             sound which occurs when illegal commands are given -- this
  290.             beep is produced by direct control of the output ports which
  291.             control the speaker on IBM compatible hardware.
  292.                More does make a number of BIOS calls for things such as
  293.             keyboard input and video output. As long as you are running
  294.             on a machine which is compatible at the BIOS level it should
  295.             work for you (with the exception of the beep sound). I have,
  296.             however, not had the opportunity to try it on non-IBM-
  297.             compatible hardware, so caveat user!
  298.                
  299.                BUGS
  300.                More is known not to work properly when nnansi.sys is
  301.             installed as your ANSI console driver. Nnansi.sys is a
  302.             variant of nansi.sys, a public domain (??) ANSI.SYS
  303.             replacement, which was modified by Tom Almy for use
  304.             specifically on EGA and VGA displays. Nnansi.sys takes over
  305.             INT 10 (video BIOS functions), as well as doing some other
  306.             things in non-standard ways, and thereby causes several
  307.             problems with programs such as more which assume a totally
  308.             standard set of video BIOS functions. (Microsoft's CodeView
  309.             debugger also does not work properly with nnansi.sys
  310.             installed.)
  311.                If you insist on using nnansi.sys you can work around its
  312.             problems by rebuilding it with the following flag settings
  313.             (in nnansi_d.asm):
  314.                
  315.                takeBIOS=FALSE
  316.                fast=FALSE
  317.                
  318.                SUGGESTIONS
  319.                If you have any suggestions for improvement, or find bugs
  320.             which need attention please write to me (or send electronic
  321.             mail) at the address below. Be sure to describe in detail
  322.             how to re-create any bugs, including the full version number
  323.             and compilation date of the more you are using (type 'v' at
  324.             the prompt to see this information), type of machine,
  325.  
  326.  
  327.  
  328.    MORE.DOC (V 2.4.1)                                                PAGE 5
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.             version of DOS, any TSR's present on the system, etc.
  338.             Remember that more is not my full-time job, so I cannot
  339.             promise instant attention, but I DO want to know about
  340.             problems so that I can correct them.
  341.                I do not have the time or facilities to get into the
  342.             business of mailing out diskettes, but when significant new
  343.             features or bug fixes occur I will release them through
  344.             bulletin boards and usenet, in the same manner as this
  345.             release.
  346.                My mail address is:
  347.                                 Fred C. Smith
  348.                                 20 Whipple Ave.
  349.                                 Stoneham, MA 02180
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.    MORE.DOC (V 2.4.1)                                                PAGE 6
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.             Regular Expressions
  404.             ------------------------------------------------------------
  405.             The regular_expression defines the pattern to search for.
  406.             Upper- and lower-case are distinct. Blank lines never match.
  407.             The expression should be quoted to prevent file-name
  408.             translation.
  409.             
  410.             x         An ordinary character (not mentioned below)
  411.                      matches that character.
  412.             
  413.             '\'       The backslash quotes any character. "\$" matches a
  414.                      dollar-sign.
  415.             
  416.             '^'       A circumflex at the beginning of an expression
  417.                      matches the beginning of a line.
  418.             
  419.             '$'       A dollar-sign at the end of an expression matches
  420.                      the end of a line.
  421.             
  422.             '.'       A period matches any character except "new-line".
  423.  
  424.             ':a', ':d', ':n', ': '
  425.                       A colon matches a class of characters described
  426.                      by the following character. ":a" matches any
  427.                      alphabetic, ":d" matches digits, ":n" matches
  428.                      alphanumerics, ": " matches spaces, tabs, and other
  429.                      control characters, such as new-line.
  430.             
  431.             '*'       An expression followed by an asterisk matches zero
  432.                      or more occurrences of that expression: "fo*"
  433.                      matches "f", "fo" "foo", etc.
  434.             
  435.             '+'       An expression followed by a plus sign matches one
  436.                      or more occurrences of that expression: "fo+"
  437.                      matches "fo", etc.
  438.             
  439.             '-'       An expression followed by a minus sign optionally
  440.                      matches the expression.
  441.             
  442.             '[]'      A string enclosed in square brackets matches any
  443.                      character in that string, but no others. If the
  444.                      first character in the string is a circumflex, the
  445.                      expression matches any character except "newline"
  446.                      and the characters in the string. For example,
  447.                      "[xyz]" matches "xx" and "zyx", while "[^xyz]"
  448.                      matches "abc" but not "axb". A range of characters
  449.                      may be specified by two characters separated by
  450.                      "-". Note that, [a-z] matches alphabetics, while
  451.                      [z-a] never matches.
  452.             
  453.             The concatenation of regular expressions is a regular
  454.             expression. Two regular expressions separated by a | match
  455.             either a match of the first or a match of the second.
  456.  
  457.  
  458.  
  459.  
  460.    MORE.DOC (V 2.4.1) -- Figure 1 -- Regular Expressions             PAGE 7
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.             
  470.             Command Line Options
  471.             ------------------------------------------------------------
  472.             -s(Regular Expression)
  473.                  The -s option specifies a regular expression to be used
  474.                  as a search target beginning immediately upon entry to
  475.                  MORE. Like specifying a search function from within
  476.                  MORE except that the text in the first window is also
  477.                  searched.
  478.                  
  479.             -t(tabsize)
  480.                  Defines the width to which tabs are to be expanded when
  481.                  a file is being displayed. See the section describing
  482.                  the configuration file for information on the default
  483.                  value.
  484.             
  485.             -v
  486.                  This option causes more to execute an internal
  487.                  consistency check before displaying any files. The
  488.                  purpose of this check is to see if the executable file
  489.                  has been modified.If it has the possibility exists that
  490.                  it was modified by a virus program. If any modification
  491.                  is found more prints a warning message and exits. This
  492.                  check is based on a 32-bit CRC, so it should be highly
  493.                  reliable. (It is not, of course, proof against
  494.                  intentional tampering, as a tamperer could easily patch
  495.                  around the virus checking code and distribute the
  496.                  hacked version as a trojan horse of some kind.)
  497.             
  498.             -w(decimal number)
  499.                  Used to specify the window size if a size other than
  500.                  the default of 20 lines is desired. See the section
  501.                  describing the configuration file for information on
  502.                  the default value.
  503.                  
  504.             ------------------------------------------------------------
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.    MORE.DOC (V 2.4.1) -- TABLE 1 -- COMMAND LINE OPTIONS             PAGE 8
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.             
  536.             Commands recognized at `--MORE--' prompt
  537.             ------------------------------------------------------------
  538.             
  539.             return    Causes the display to scroll one line.
  540.             
  541.             d or D    Causes the display to scroll 1/2 the window size,
  542.                      either 10 lines, if the window default of 20 lines
  543.                      is used, or 1/2 the value specified in the        -
  544.                      w<number> command line option switch.
  545.             
  546.             space     Causes the display to scroll 20 lines if the
  547.                      default window size of 20 is used, or the value
  548.                      specified in the -w<number> command line option
  549.                      switch.
  550.             
  551.             /(Regular Expression)
  552.                       Causes MORE to begin searching for a line
  553.                      containing a matching Regular Expression. The
  554.                      search begins at the first line off the bottom of
  555.                      the display. The line containing the target, if
  556.                      found, is positioned near the center of the screen
  557.                      and is displayed with the bright attribute set. (If
  558.                      your screen is already set to some attribute other
  559.                      than white on black, this line may be displayed
  560.                      with some contrasting attribute other than bright
  561.                      white on black, so that it will be easily visible.)
  562.                      Pressing ESC aborts a search in progress.
  563.             
  564.             n or N    Causes MORE to resume the previously specified
  565.                      search. If the search was the last operation
  566.                      performed, searching begins at the first line
  567.                      following the line containing the last match found.
  568.             
  569.             :e or :E  Causes MORE to prompt for a file list. If a list
  570.                      is entered MORE will display those files in the
  571.                      same way as if they had been specified on the
  572.                      command line. Wildcards are accepted. If a null
  573.                      list is entered, MORE will revert to the original
  574.                      list entered on the command line.
  575.             
  576.             :f or :F  Causes MORE to print the current filename at the
  577.                      bottom of the screen.
  578.             
  579.             :n or :N  Causes more to abandon the current file, and skip
  580.                      to the beginning of the next file specified in the
  581.                      command line. Exits if the current file is the last
  582.                      file.
  583.             
  584.             :p or :P  Causes MORE to jump back to the top of the current
  585.                      file. If already at top of the current file, causes
  586.                      MORE to skip to the top of the preceding file
  587.                      specified in the command line. If there is no
  588.  
  589.  
  590.  
  591.  
  592.    MORE.DOC (V2.4.1) -- TABLE 2 -- COMMANDS RECOGNIZED AT PROMPT     PAGE 9
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.                      preceding file, MORE will go to the top of the
  602.                      current file and display the first window full.
  603.             
  604.             :q or :Q
  605.             q or Q    Causes an immediate exit from MORE.
  606.             
  607.             f or F    Causes MORE to skip (without displaying) one
  608.                      window full. A window is either the default of 20
  609.                      lines, or the value used in the -w<number> command
  610.                      line option switch.
  611.             
  612.             h, H, ?   Causes MORE to display a help message which
  613.                      briefly describes all these commands.
  614.             
  615.             e or E    Causes more to skip forward to the end of the
  616.                      current file. More will display the last screenful
  617.                      of the file, and the prompt will show a percentage
  618.                      value of 100%.
  619.             
  620.             t or T    Causes more to prompt for a number which
  621.                      represents the number of spaces to use when
  622.                      expanding tab characters on the screen. The prompt
  623.                      shows the current value. Acceptable values are non-
  624.                      negative and non-zero. Also see the section
  625.                      describing the configuration file.
  626.             
  627.             !         Execute a command in a subshell (if followed by a
  628.                      command), or provide a prompt in a subshell (if no
  629.                      command is specified). The environment variable
  630.                      COMSPEC is used to determine the path of the shell
  631.                      to exec. The current DOS switch character is used
  632.                      in the command-line passed to that shell.
  633.             
  634.             counts    Commands b, B, f, F, d, D, <return>, and
  635.                      <spacebar> accept a preceding count, i.e., the
  636.                      command '3f' causes 3 windows-full to be skipped.
  637.             
  638.             other input
  639.                       All other input is in error and causes the
  640.                      terminal to beep.
  641.             
  642.             
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.    MORE.DOC (V2.4.1) -- TABLE 2 -- COMMANDS RECOGNIZED AT PROMPT    PAGE 10
  659.  
  660.  
  661.