less (part 2 of 6)
Mark Nudelman
mark at unix386.Convergent.COM
Wed Mar 6 10:13:08 AEST 1991
#! /bin/sh
# This is a shell archive.
# Remove anything before this line, then unpack it
# by saving it into a file and typing "sh file".
echo shar: Extracting \"less.man\"
sed "s/^X//" >'less.man' <<'END_OF_FILE'
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X NNNNAAAAMMMMEEEE
X less - opposite of more
X
X SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
X lllleeeessssssss ----????
X lllleeeessssssss [[[[----[[[[++++]]]]aaaaAAAABBBBccccCCCCddddeeeeEEEEffffiiiimmmmMMMMnnnnNNNNqqqqQQQQrrrrssssSSSSuuuuUUUUwwww]]]] [[[[----bbbb_N]]]] [[[[----xxxx_N]]]] [[[[----[[[[zzzz]]]]_N]]]]
X [[[[----hhhh_N]]]] [[[[----yyyy_N]]]] [[[[----PPPP[[[[mmmmMMMM====]]]]_s_t_r_i_n_g]]]] [[[[----[[[[ooooOOOO]]]]_l_o_g_f_i_l_e]]]] [[[[----kkkk_k_e_y_f_i_l_e]]]]
X [[[[----tttt_t_a_g]]]] [[[[----TTTT_t_a_g_s_f_i_l_e]]]] [[[[++++_c_m_d]]]] [[[[_f_i_l_e_n_a_m_e]]]]............
X
X
X DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
X _L_e_s_s is a program similar to _m_o_r_e (1), but which allows
X backward movement in the file as well as forward movement.
X Also, _l_e_s_s does not have to read the entire input file
X before starting, so with large input files it starts up
X faster than text editors like _v_i (1). _L_e_s_s uses termcap (or
X terminfo on some systems), so it can run on a variety of
X terminals. There is even limited support for hardcopy
X terminals. (On a hardcopy terminal, lines which should be
X printed at the top of the screen are prefixed with an up-
X arrow.)
X
X Commands are based on both _m_o_r_e and _v_i. Commands may be
X preceded by a decimal number, called N in the descriptions
X below. The number is used by some commands, as indicated.
X
X
X CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS
X In the following descriptions, ^X means control-X. ESC
X stands for the ESCAPE key; for example ESC-v means the two
X character sequence "ESCAPE", then "v".
X
X h or H
X Help: display a summary of these commands. If you
X forget all the other commands, remember this one.
X
X SPACE or ^V or f or ^F
X Scroll forward N lines, default one window (see option
X -z below). If N is more than the screen size, only the
X final screenful is displayed. Warning: some systems
X use ^V as a special literalization character.
X
X z Like SPACE, but if N is specified, it becomes the new
X window size.
X
X RETURN or ^N or e or ^E or j or ^J
X Scroll forward N lines, default 1. The entire N lines
X are displayed, even if N is more than the screen size.
X
X d or ^D
X Scroll forward N lines, default one half of the screen
X size. If N is specified, it becomes the new default
X
X
X
X Page 1 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X for subsequent d and u commands.
X
X b or ^B or ESC-v
X Scroll backward N lines, default one window (see option
X -z below). If N is more than the screen size, only the
X final screenful is displayed.
X
X w Like ESC-v, but if N is specified, it becomes the new
X window size.
X
X y or ^Y or ^P or k or ^K
X Scroll backward N lines, default 1. The entire N lines
X are displayed, even if N is more than the screen size.
X Warning: some systems use ^Y as a special job control
X character.
X
X u or ^U
X Scroll backward N lines, default one half of the screen
X size. If N is specified, it becomes the new default
X for subsequent d and u commands.
X
X r or ^R or ^L
X Repaint the screen.
X
X R Repaint the screen, discarding any buffered input.
X Useful if the file is changing while it is being
X viewed.
X
X F Scroll forward, and keep trying to read when the end of
X file is reached. Normally this command would be used
X when already at the end of the file. It is a way to
X monitor the tail of a file which is growing while it is
X being viewed. (The behavior is similar to the "tail
X -f" command.)
X
X g or < or ESC-<
X Go to line N in the file, default 1 (beginning of
X file). (Warning: this may be slow if N is large.)
X
X G or > or ESC->
X Go to line N in the file, default the end of the file.
X (Warning: this may be slow if N is large, or if N is
X not specified and standard input, rather than a file,
X is being read.)
X
X p or %
X Go to a position N percent into the file. N should be
X between 0 and 100. (This works if standard input is
X being read, but only if _l_e_s_s has already read to the
X end of the file. It is always fast, but not always
X useful.)
X
X
X
X
X Page 2 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X { If a left curly bracket appears in the top line
X displayed on the screen, the { command will go to the
X matching right curly bracket. The matching right curly
X bracket is positioned on the bottom line of the screen.
X If there is more than one left curly bracket on the top
X line, a number N may be used to specify the N-th
X bracket on the line.
X
X } If a right curly bracket appears in the bottom line
X displayed on the screen, the } command will go to the
X matching left curly bracket. The matching left curly
X bracket is positioned on the top line of the screen.
X If there is more than one right curly bracket on the
X top line, a number N may be used to specify the N-th
X bracket on the line.
X
X ( Like {, but applies to parentheses rather than curly
X brackets.
X
X ) Like }, but applies to parentheses rather than curly
X brackets.
X
X [ Like {, but applies to square brackets rather than
X curly brackets.
X
X ] Like }, but applies to square brackets rather than
X curly brackets.
X
X ESC-^F
X Followed by two characters, acts like {, but uses the
X two characters as open and close brackets,
X respectively. For example, "ESC ^F < >" could be used
X to go forward to the > which matches the < in the top
X displayed line.
X
X ESC-^B
X Followed by two characters, acts like }, but uses the
X two characters as open and close brackets,
X respectively. For example, "ESC ^B < >" could be used
X to go backward to the < which matches the > in the
X bottom displayed line.
X
X m Followed by any lowercase letter, marks the current
X position with that letter.
X
X ' (Single quote.) Followed by any lowercase letter,
X returns to the position which was previously marked
X with that letter. Followed by another single quote,
X returns to the position at which the last "large"
X movement command was executed. Followed by a ^ or $,
X jumps to the beginning or end of the file respectively.
X Marks are preserved when a new file is examined, so the
X
X
X
X Page 3 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X ' command can be used to switch between input files.
X
X ^X^X Same as single quote.
X
X /pattern
X Search forward in the file for the N-th line containing
X the pattern. N defaults to 1. The pattern is a
X regular expression, as recognized by _e_d. The search
X starts at the second line displayed (but see the -a and
X -j options, which change this).
X
X Certain characters are special if entered at the
X beginning of the pattern; they modify the type of
X search rather than become part of the pattern:
X
X ! Search for lines which do NOT match the pattern.
X
X * Search multiple files. That is, if the search
X reaches the end of the current file without
X finding a match, the search continues in the next
X file in the command line list.
X
X @ Begin the search at the first line of the first
X file in the command line list, regardless of what
X is currently displayed on the screen or the
X settings of the -a or -j options.
X
X ?pattern
X Search backward in the file for the N-th line
X containing the pattern. The search starts at the line
X immediately before the top line displayed.
X
X Certain characters are special as in the / command:
X
X ! Search for lines which do NOT match the pattern.
X
X * Search multiple files. That is, if the search
X reaches the beginning of the current file without
X finding a match, the search continues in the
X previous file in the command line list.
X
X @ Begin the search at the last line of the last file
X in the command line list, regardless of what is
X currently displayed on the screen or the settings
X of the -a or -j options.
X
X ESC-/pattern
X Same as "/*".
X
X ESC-?pattern
X Same as "?*".
X
X
X
X
X Page 4 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X n Repeat previous search, for N-th line containing the
X last pattern. If the previous search was modified by
X !, the search is made for the N-th line NOT containing
X the pattern. If the previous search was modified by *,
X the search continues in the next (or previous) file if
X not satisfied in the current file. There is no effect
X if the previous search was modified by @.
X
X N Repeat previous search, but in the reverse direction.
X
X ESC-n
X Repeat previous search, but crossing file boundaries.
X The effect is as if the previous search were modified
X by *.
X
X ESC-N
X Repeat previous search, but in the reverse direction
X and crossing file boundaries.
X
X :e [filename]
X Examine a new file. If the filename is missing, the
X "current" file (see the :n and :p commands below) from
X the list of files in the command line is re-examined.
X A percent sign (%) in the filename is replaced by the
X name of the current file. A pound sign (#) is replaced
X by the name of the previously examined file. The
X filename is inserted into the command line list of
X files so that it can be seen by subsequent :n and :p
X commands. If the filename consists of several files,
X they are all inserted into the list of files and the
X first one is examined.
X
X ^X^V or E
X Same as :e. Warning: some systems use ^V as a special
X literalization character.
X
X :n Examine the next file (from the list of files given in
X the command line). If a number N is specified, the N-
X th next file is examined.
X
X :p Examine the previous file in the command line list. If
X a number N is specified, the N-th previous file is
X examined.
X
X :x Examine the first file in the command line list. If a
X number N is specified, the N-th file in the list is
X examined.
X
X = or ^G or :f
X Prints some information about the file being viewed,
X including its name and the line number and byte offset
X of the bottom line being displayed. If possible, it
X
X
X
X Page 5 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X also prints the length of the file, the number of lines
X in the file and the percent of the file above the last
X displayed line.
X
X - Followed by one of the command line option letters (see
X below), this will change the setting of that option and
X print a message describing the new setting. If the
X option letter has a numeric value (such as -b or -h),
X or a string value (such as -P or -t), a new value may
X be entered after the option letter. If no new value is
X entered, a message describing the current setting is
X printed and nothing is changed.
X
X -+ Followed by one of the command line option letters (see
X below), this will reset the option to its default
X setting and print a message describing the new setting.
X (The "-+_X" command does the same thing as "-+_X" on the
X command line.) This does not work for string-valued
X options.
X
X -- Followed by one of the command line option letters (see
X below), this will reset the option to the "opposite" of
X its default setting and print a message describing the
X new setting. (The "--_X" command does the same thing as
X "-_X" on the command line.) This does not work for
X numeric or string-valued options.
X
X _ (Underscore.) Followed by one of the command line
X option letters (see below), this will print a message
X describing the current setting of that option. The
X setting of the option is not changed.
X
X +cmd Causes the specified cmd to be executed each time a new
X file is examined. For example, +G causes _l_e_s_s to
X initially display each file starting at the end rather
X than the beginning.
X
X V Prints the version number of _l_e_s_s being run.
X
X q or :q or :Q or ZZ or ESC ESC
X Exits _l_e_s_s.
X
X The following three commands may or may not be valid,
X depending on your particular installation.
X
X v Invokes an editor to edit the current file being
X viewed. The editor is taken from the environment
X variable EDITOR, or defaults to "vi". See also the
X discussion of LESSEDIT under the section on PROMPTS
X below.
X
X ! shell-command
X
X
X
X Page 6 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X Invokes a shell to run the shell-command given. A
X percent sign (%) in the command is replaced by the name
X of the current file. A pound sign (#) is replaced by
X the name of the previously examined file. "!!" repeats
X the last shell command. "!" with no shell command
X simply invokes a shell. In all cases, the shell is
X taken from the environment variable SHELL, or defaults
X to "sh".
X
X | <m> shell-command
X <m> represents any mark letter. Pipes a section of the
X input file to the given shell command. The section of
X the file to be piped is between the current position
X and the position marked by the letter. <m> may also be
X ^ or $ to indicate beginning or end of file
X respectively. If <m> is . or newline, the current
X screen is piped. The current screen is the minimum
X amount piped in any case.
X
X OOOOPPPPTTTTIIIIOOOONNNNSSSS
X Command line options are described below. Most options may
X be changed while _l_e_s_s is running, via the "-" command.
X
X Options are also taken from the environment variable "LESS".
X For example, to avoid typing "less -options ..." each time
X _l_e_s_s is invoked, you might tell _c_s_h:
X
X setenv LESS "-options"
X
X or if you use _s_h:
X
X LESS="-options"; export LESS
X
X The environment variable is parsed before the command line,
X so command line options override the LESS environment
X variable. If an option appears in the LESS variable, it can
X be reset to its default on the command line by beginning the
X command line option with "-+".
X
X A dollar sign ($) may be used to signal the end of an option
X string. This is important only for options like -P which
X take a following string.
X
X -? This option displays a summary of the commands accepted
X by _l_e_s_s (the same as the h command). If this option is
X given, all other options are ignored, and _l_e_s_s exits
X after the help screen is viewed. (Depending on how
X your shell interprets the question mark, it may be
X necessary to quote the question mark, thus: "-\?".)
X
X -a Causes searches to start after the last line displayed
X on the screen, thus skipping all lines displayed on the
X
X
X
X Page 7 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X screen. By default, searches start at the second line
X on the screen (or after the last found line; see the -j
X option).
X
X -b_n Causes _l_e_s_s to use a non-standard number of buffers.
X Buffers are 1K, and by default 10 buffers are used
X (except if data in coming from standard input; see the
X -B option). The number _n specifies a different number
X of buffers to use.
X
X -B Disables automatic allocation of buffers, so that only
X the default number of buffers are used. If more data
X is read than will fit in the buffers, the oldest data
X is discarded. By default, when data is coming from
X standard input, buffers are allocated automatically as
X needed to avoid loss of data.
X
X -c Causes full screen repaints to be painted from the top
X line down. By default, full screen repaints are done
X by scrolling from the bottom of the screen.
X
X -C The -C option is like -c, but the screen is cleared
X before it is repainted.
X
X -d The -d option suppresses the error message normally
X displayed if the terminal is dumb; that is, lacks some
X important capability, such as the ability to clear the
X screen or scroll backward. The -d option does not
X otherwise change the behavior of _l_e_s_s on a dumb
X terminal).
X
X -e Causes _l_e_s_s to automatically exit the second time it
X reaches end-of-file. By default, the only way to exit
X _l_e_s_s is via the "q" command.
X
X -E Causes _l_e_s_s to automatically exit the first time it
X reaches end-of-file.
X
X -f Forces non-regular files to be opened. (A non-regular
X file is a directory or a device special file.) Also
X suppresses the warning message when a binary file is
X opened. By default, _l_e_s_s will refuse to open non-
X regular files.
X
X -h_n Specifies a maximum number of lines to scroll backward.
X If it is necessary to scroll backward more than _n
X lines, the screen is repainted in a forward direction
X instead. (If the terminal does not have the ability to
X scroll backward, -h0 is implied.)
X
X -i Causes searches to ignore case; that is, uppercase and
X lowercase are considered identical. Also, text which
X
X
X
X Page 8 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X is overstruck or underlined can be searched for. This
X option is ignored if any uppercase letters appear in
X the search pattern.
X
X -j_n Specifies a line on the screen where "target" lines are
X to be positioned. Target lines are the object of text
X searches, tag searches, jumps to a line number, jumps
X to a file percentage, and jumps to a marked position.
X The screen line is specified by a number: the top line
X on the screen is 1, the next is 2, and so on. The
X number may be negative to specify a line relative to
X the bottom of the screen: the bottom line on the screen
X is -1, the second to the bottom is -2, and so on. If
X the -j option is used, searches begin at the line
X immediately after the target line. For example, if "-
X j4" is used, the target line is the fourth line on the
X screen, so searches begin at the fifth line on the
X screen.
X
X -k_f_i_l_e_n_a_m_e
X Causes _l_e_s_s to open and interpret the named file as a
X _l_e_s_s_k_e_y (1) file. Multiple -k options may be
X specified. If a file called .less exists in the user's
X home directory, this file is also used as a _l_e_s_s_k_e_y
X file.
X
X -m Causes _l_e_s_s to prompt verbosely (like _m_o_r_e), with the
X percent into the file. By default, _l_e_s_s prompts with a
X colon.
X
X -M Causes _l_e_s_s to prompt even more verbosely than _m_o_r_e.
X
X -n Suppresses line numbers. The default (to use line
X numbers) may cause _l_e_s_s to run more slowly in some
X cases, especially with a very large input file.
X Suppressing line numbers with the -n flag will avoid
X this problem. Using line numbers means: the line
X number will be displayed in the verbose prompt and in
X the = command, and the v command will pass the current
X line number to the editor (see also the discussion of
X LESSEDIT in PROMPTS below).
X
X -N Causes a line number to be displayed at the beginning
X of each line in the display.
X
X -o_f_i_l_e_n_a_m_e
X Causes _l_e_s_s to copy its input to the named file as it
X is being viewed. This applies only when the input file
X is a pipe, not an ordinary file. If the file already
X exists, _l_e_s_s will ask for confirmation before
X overwriting it.
X
X
X
X
X Page 9 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X -O_f_i_l_e_n_a_m_e
X The -O option is like -o, but it will overwrite an
X existing file without asking for confirmation.
X
X If no log file has been specified, the -o and -O
X options can be used from within _l_e_s_s to specify a log
X file. Without a file name, they will simply report the
X name of the log file. The "s" command is equivalent to
X specifying -o from within _l_e_s_s.
X
X -p_p_a_t_t_e_r_n
X The -p option on the command line is equivalent to
X specifying +/_p_a_t_t_e_r_n; that is, it tells _l_e_s_s to start
X at the first occurence of _p_a_t_t_e_r_n in the file.
X
X -P_p_r_o_m_p_t
X Provides a way to tailor the three prompt styles to
X your own preference. This option would normally be put
X in the LESS environment variable, rather than being
X typed in with each _l_e_s_s command. Such an option must
X either be the last option in the LESS variable, or be
X terminated by a dollar sign. -P followed by a string
X changes the default (short) prompt to that string. -Pm
X changes the medium (-m) prompt to the string, and -PM
X changes the long (-M) prompt. Also, -P= changes the
X message printed by the = command to the given string.
X All prompt strings consist of a sequence of letters and
X special escape sequences. See the section on PROMPTS
X for more details.
X
X -q Causes moderately "quiet" operation: the terminal bell
X is not rung if an attempt is made to scroll past the
X end of the file or before the beginning of the file.
X If the terminal has a "visual bell", it is used
X instead. The bell will be rung on certain other
X errors, such as typing an invalid character. The
X default is to ring the terminal bell in all such cases.
X
X -Q Causes totally "quiet" operation: the terminal bell is
X never rung.
X
X -r Causes "raw" control characters to be displayed. The
X default is to display control characters using the
X caret notation; for example, a control-A (octal 001) is
X displayed as "^A". Warning: when the -r flag is used,
X _l_e_s_s cannot keep track of the actual appearance of the
X screen (since this depends on how the screen responds
X to each type of control character). Thus, various
X display problems may result, such as long lines being
X split in the wrong place.
X
X -s Causes consecutive blank lines to be squeezed into a
X
X
X
X Page 10 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X single blank line. This is useful when viewing _n_r_o_f_f
X output.
X
X -S Causes lines longer than the screen width to be chopped
X rather than folded. That is, the remainder of a long
X line is simply discarded. The default is to fold long
X lines; that is, display the remainder on the next line.
X
X -t_t_a_g
X The -t option, followed immediately by a TAG, will edit
X the file containing that tag. For this to work, there
X must be a file called "tags" in the current directory,
X which was previously built by the _c_t_a_g_s (1) command.
X This option may also be specified from within _l_e_s_s
X (using the - command) as a way of examining a new file.
X The command ":t" is equivalent to specifying -t from
X within _l_e_s_s.
X
X -T_t_a_g_s_f_i_l_e
X Specifies a tags file to be used instead of "tags".
X
X -u Causes backspaces and carriage returns to be treated as
X printable characters; that is, they are sent to the
X terminal when they appear in the input.
X
X -U Causes backspaces and carriage returns to be treated as
X control characters; that is, they are handled as
X specified by the -r option.
X
X By default, if neither -u nor -U is given, backspaces
X which appear adjacent to an underscore character are
X treated specially: the underlined text is displayed
X using the terminal's hardware underlining capability.
X Also, backspaces which appear between two identical
X characters are treated specially: the overstruck text
X is printed using the terminal's hardware boldface
X capability. Other backspaces are deleted, along with
X the preceding character. Carriage returns immediately
X followed by a newline are deleted. Other carriage
X returns are handled as specified by the -r option.
X
X -w Causes blank lines to be used to represent lines past
X the end of the file. By default, a tilde character is
X used.
X
X -x_n Sets tab stops every _n positions. The default for _n is
X 8.
X
X -y_n Specifies a maximum number of lines to scroll forward.
X If it is necessary to scroll forward more than _n lines,
X the screen is repainted instead. The -c or -C option
X may be used to repaint from the top of the screen if
X
X
X
X Page 11 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X desired. By default, any forward movement causes
X scrolling.
X
X -[z]_n
X Changes the default scrolling window size to _n lines.
X The default is one screenful. The z and w commands can
X also be used to change the window size. The "z" may be
X omitted, as in "-_n" for compatibility with _m_o_r_e.
X
X + If a command line option begins with ++++, the remainder
X of that option is taken to be an initial command to
X _l_e_s_s. For example, +G tells _l_e_s_s to start at the end of
X the file rather than the beginning, and +/xyz tells it
X to start at the first occurrence of "xyz" in the file.
X As a special case, +<number> acts like +<number>g; that
X is, it starts the display at the specified line number
X (however, see the caveat under the "g" command above).
X If the option starts with ++, the initial command
X applies to every file being viewed, not just the first
X one. The + command described previously may also be
X used to set (or change) an initial command for every
X file.
X
X
X KKKKEEEEYYYY BBBBIIIINNNNDDDDIIIINNNNGGGGSSSS
X You may define your own _l_e_s_s commands by using the program
X _l_e_s_s_k_e_y (1) to create a file called ".less" in your home
X directory. This file specifies a set of command keys and an
X action associated with each key. See the _l_e_s_s_k_e_y manual
X page for more details.
X
X
X NNNNAAAATTTTIIIIOOOONNNNAAAALLLL CCCCHHHHAAAARRRRAAAACCCCTTTTEEEERRRR SSSSEEEETTTTSSSS
X There are three types of characters in the input file:
X
X normal characters
X can be displayed directly to the screen.
X
X control characters
X should not be displayed directly, but are expected to
X be found in ordinary text files (such as backspace and
X tab).
X
X binary characters
X cannot be displayed directly and are not expected to be
X found in text files.
X
X By default, _l_e_s_s uses the ASCII character set. In the ASCII
X character set, characters with values between 128 and 255
X are treated as binary. The LESSCHARSET environment variable
X may be used to select another character set. If it is set
X to the value "latin1", the ISO 8859/1 character set is
X
X
X
X Page 12 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X assumed. Latin-1 is the same as ASCII, except characters
X between 128 and 255 are treated as normal characters. The
X only valid values for LESSCHARSET currently are "ascii" and
X "latin1".
X
X In special cases, it may be desired to tailor _l_e_s_s to use a
X character set other than the ones definable by LESSCHARSET.
X In this case, the environment variable LESSCHARDEF can be
X used to define a character set. It should be set to a
X string where each character in the string represents one
X character in the character set. The character "." is used
X for a normal character, "c" for control, and "b" for binary.
X A decimal number may be used for repetition. For example,
X "bccc4b." would mean character 0 is binary, 1, 2 and 3 are
X control, 4, 5, 6 and 7 are binary, and 8 is normal. All
X characters after the last are taken to be the same as the
X last, so characters 9 through 255 would be normal. (This is
X an example, and does not necessarily represent any real
X character set.)
X
X Setting LESSCHARDEF to "8bcccbcc18b95.b" is the same as
X setting LESSCHARSET to "ascii". Setting LESSCHARDEF to
X "8bcccbcc18b95.33b." is the same as setting LESSCHARSET to
X "latin1".
X
X Control and binary characters are displayed in blinking
X mode. Each such character is displayed in caret notation if
X possible (e.g. ^A for control-A). Caret notation is used
X only if inverting the 0100 bit results in a normal printable
X character. Otherwise, the character is displayed as an
X octal number preceded by a backslash. This octal format can
X be changed by setting the LESSBINFMT environment variable to
X a printf-style format string; the default is '\%o'.
X
X
X PPPPRRRROOOOMMMMPPPPTTTTSSSS
X The -P option allows you to tailor the prompt to your
X preference. The string given to the -P option replaces the
X specified prompt string. Certain characters in the string
X are interpreted specially. The prompt mechanism is rather
X complicated to provide flexibility, but the ordinary user
X need not understand the details of constructing personalized
X prompt strings.
X
X A percent sign followed by a single character is expanded
X according to what the following character is:
X
X %b_X Replaced by the byte offset into the current input
X file. The b is followed by a single character (shown
X as _X above) which specifies the line whose byte offset
X is to be used. If the character is a "t", the byte
X offset of the top line in the display is used, an "m"
X
X
X
X Page 13 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X means use the middle line, a "b" means use the bottom
X line, a "B" means use the line just after the bottom
X line, and a "j" means use the "target" line, as
X specified by the -j option.
X
X %B Replaced by the size of the current input file.
X
X %E Replaced by the name of the editor (from the EDITOR
X environment variable). See the discussion of the
X LESSEDIT feature below.
X
X %f Replaced by the name of the current input file.
X
X %i Replaced by the index of the current file in the list
X of input files.
X
X %l_X Replaced by the line number of a line in the input
X file. The line to be used is determined by the _X, as
X with the %b option.
X
X %L Replaced by the line number of the last line in the
X input file.
X
X %m Replaced by the total number of input files.
X
X %p_X Replaced by the percent into the current input file.
X The line used is determined by the _X as with the %b
X option.
X
X %s Same as %B.
X
X %t Causes any trailing spaces to be removed. Usually used
X at the end of the string, but may appear anywhere.
X
X %x Replaced by the name of the next input file in the
X list.
X
X If any item is unknown (for example, the file size if input
X is a pipe), a question mark is printed instead.
X
X The format of the prompt string can be changed depending on
X certain conditions. A question mark followed by a single
X character acts like an "IF": depending on the following
X character, a condition is evaluated. If the condition is
X true, any characters following the question mark and
X condition character, up to a period, are included in the
X prompt. If the condition is false, such characters are not
X included. A colon appearing between the question mark and
X the period can be used to establish an "ELSE": any
X characters between the colon and the period are included in
X the string if and only if the IF condition is false.
X Condition characters (which follow a question mark) may be:
X
X
X
X Page 14 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X ?a True if any characters have been included in the prompt
X so far.
X
X ?b_X True if the byte offset of the specified line is known.
X
X ?B True if the size of current input file is known.
X
X ?e True if at end-of-file.
X
X ?f True if there is an input filename (that is, if input
X is not a pipe).
X
X ?l_X True if the line number of the specified line is known.
X
X ?L True if the line number of the last line in the file is
X known.
X
X ?m True if there is more than one input file.
X
X ?n True if this is the first prompt in a new input file.
X
X ?p_X True if the percent into the current input file of the
X specified line is known.
X
X ?s Same as "?B".
X
X ?x True if there is a next input file (that is, if the
X current input file is not the last one).
X
X Any characters other than the special ones (question mark,
X colon, period, percent, and backslash) become literally part
X of the prompt. Any of the special characters may be
X included in the prompt literally by preceding it with a
X backslash.
X
X Some examples:
X
X ?f%f:Standard input.
X
X This prompt prints the filename, if known; otherwise the
X string "Standard input".
X
X ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
X
X This prompt would print the filename, if known. The
X filename is followed by the line number, if known, otherwise
X the percent if known, otherwise the byte offset if known.
X Otherwise, a dash is printed. Notice how each question mark
X has a matching period, and how the % after the %pt is
X included literally by escaping it with a backslash.
X
X ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
X
X
X
X Page 15 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X This prints the filename if this is the first prompt in a
X file, followed by the "file N of N" message if there is more
X than one input file. Then, if we are at end-of-file, the
X string "(END)" is printed followed by the name of the next
X file, if there is one. Finally, any trailing spaces are
X truncated. This is the default prompt. For reference, here
X are the defaults for the other two prompts (-m and -M
X respectively). Each is broken into two lines here for
X readability only.
X
X ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
X ?pB%pB\%:byte %bB?s/%s...%t
X
X ?f%f .?n?m(file %i of %m) ..?ltline %lt?L/%L. :byte %bB?s/%s. .
X ?e(END) ?x- Next\: %x.:?pB%pB\%..%t
X
X And here is the default message produced by the = command:
X
X ?f%f .?m(file %i of %m) .?ltline %lt?L/%L. .
X byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
X
X The prompt expansion features are also used for another
X purpose: if an environment variable LESSEDIT is defined, it
X is used as the command to be executed when the v command is
X invoked. The LESSEDIT string is expanded in the same way as
X the prompt strings. The default value for LESSEDIT is:
X
X %E ?lm+%lm. %f
X
X Note that this expands to the editor name, followed by a +
X and the line number, followed by the file name. If your
X editor does not accept the "+linenumber" syntax, or has
X other differences in invocation syntax, the LESSEDIT
X variable can be changed to modify this default.
X
X
X EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS
X COLUMNS
X Sets the number of columns on the screen. Takes
X precedence over the number of columns specified by the
X TERM variable.
X
X EDITOR
X The name of the editor (used for the v command).
X
X HOME Name of the user's home directory (used to find a .less
X file).
X
X LESS Flags which are passed to _l_e_s_s automatically.
X
X LESSBINFMT
X Format for displaying non-printable, non-control
X
X
X
X Page 16 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111))))
X
X
X
X characters.
X
X LESSCHARDEF
X Defines a character set.
X
X LESSCHARSET
X Selects a predefined character set.
X
X LESSEDIT
X Editor prototype string (used for the v command). See
X discussion under PROMPTS.
X
X LINES
X Sets the number of lines on the screen. Takes
X precedence over the number of lines specified by the
X TERM variable.
X
X SHELL
X The shell used to execute the ! command, as well as to
X expand filenames.
X
X TERM The type of terminal on which _l_e_s_s is being run.
X
X
X SSSSEEEEEEEE AAAALLLLSSSSOOOO
X lesskey(1)
X
X
X WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
X The = command and prompts (unless changed by -P) report the
X line number of the line at the top of the screen, but the
X byte and percent of the line at the bottom of the screen.
X
X If the :e command is used to name more than one file, and
X one of the named files has been viewed previously, the new
X files may be entered into the list in an unexpected order.
X
X The handling of national character sets is nonstandard as
X well as insufficient for multibyte characters. It will
X probably change in a later release.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X Page 17 (printed 3/2/91)
X
X
X
END_OF_FILE
echo shar: Extracting \"lesskey.man\"
sed "s/^X//" >'lesskey.man' <<'END_OF_FILE'
X
X
X
X LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111))))
X
X
X
X NNNNAAAAMMMMEEEE
X lesskey - specify key bindings for less
X
X SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
X lllleeeesssssssskkkkeeeeyyyy [[[[----oooo oooouuuuttttppppuuuutttt]]]] [[[[iiiinnnnppppuuuutttt]]]]
X
X DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
X _L_e_s_s_k_e_y is used to specify a set of key bindings to be used
X by _l_e_s_s. The input file is a text file which describes the
X key bindings, and the output file is a binary file which is
X used by _l_e_s_s. If no input file is specified, standard input
X is used. If no output file is specified, $HOME/.less is
X used.
X
X The input file consists of lines of the form:
X
X string <whitespace> action [extra-string] <newline>
X
X Whitespace is any sequence of one or more spaces and/or
X tabs. The "string" is the command key(s) which invoke the
X action. The string may be a single command key, or a
X sequence of up to 15 keys. The "action" is the name of the
X less action, from the list below. The characters in the
X "string" may appear literally, or be prefixed by a carat to
X indicate a control key. A backslash may be used to cause
X the following character to be taken literally. Characters
X which must be preceded by backslash include carat, space,
X tab and the backslash itself. A backslash followed by one
X to three octal digits may be used to specify a character by
X its octal value. Blank lines and lines which start with a
X pound sign (#) are ignored.
X
X An action may be followed by an extra string. This string
X is parsed after the command is entered, just as if it were
X entered on the command line. This feature can be used in
X certain cases to extend the functionality of a command. For
X example, these entries would create a pair of commands to
X turn on/off line numbers using _v_i syntax:
X
X :set\ nu toggle-option -N
X :set\ nonu toggle-option +N
X
X See also the ":ta" command in the example below.
X
X
X EEEEXXXXAAAAMMMMPPPPLLLLEEEE
X The following input file describes the set of default
X command keys used by less:
X
X r forw-line
X n forw-line
X e forw-line
X
X
X
X Page 1 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111))))
X
X
X
X j forw-line
X ^E forw-line
X ^N forw-line
X k back-line
X y back-line
X ^Y back-line
X ^K back-line
X ^P back-line
X J forw-line-force
X K back-line-force
X Y back-line-force
X d forw-scroll
X ^D forw-scroll
X u back-scroll
X ^U back-scroll
X ' back-scroll
X \40 forw-screen
X f forw-screen
X ^F forw-screen
X ^V forw-screen
X b back-screen
X ^B back-screen
X \33v back-screen
X z forw-window
X w back-window
X F forw-forever
X R repaint-flush
X r repaint
X ^R repaint
X ^L repaint
X g goto-line
X < goto-line
X \33< goto-line
X p percent
X % percent
X { forw-bracket {}
X } back-bracket {}
X ( forw-bracket ()
X ) back-bracket ()
X [ forw-bracket []
X ] back-bracket []
X \33^F forw-bracket
X \33^B back-bracket
X G goto-end
X \33> goto-end
X > goto-end
X P goto-end
X = status
X ^G status
X :f status
X / forw-search
X ? back-search
X
X
X
X Page 2 (printed 3/2/91)
X
X
X
X
X
X
X LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111))))
X
X
X
X \33/ forw-search *
X \33? back-search *
X n repeat-search
X \33n repeat-search-all
X N reverse-search
X \33N reverse-search-all
X m set-mark
X ' goto-mark
X ^X^X goto-mark
X E examine
X :e examine
X ^X^V examine
X :n next-file
X :p prev-file
X :x index-file
X - toggle-option
X :t toggle-option t
X s toggle-option o
X _ display-option
X | pipe
X v visual
X ! shell
X + firstcmd
X H help
X h help
X V version
X q quit
X :q quit
X :Q quit
X ZZ quit
X \33\33 quit
X
X Commands specified by _l_e_s_s_k_e_y take precedence over the
X default commands. A default command key may be disabled by
X including it in the key file with the action "invalid".
X
X
X SSSSEEEEEEEE AAAALLLLSSSSOOOO
X less(1)
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X Page 3 (printed 3/2/91)
X
X
X
END_OF_FILE
echo shar: Extracting \"less.h\"
sed "s/^X//" >'less.h' <<'END_OF_FILE'
X/*
X * Standard include file for "less".
X */
X
X/*
X * Include the file of compile-time options.
X */
X#include "defines.h"
X
X/*
X * Language details.
X */
X#if !VOID
X#define void int
X#endif
X#define public /* PUBLIC FUNCTION */
X
X/*
X * Special types and constants.
X */
Xtypedef long POSITION;
X/*
X * {{ Warning: if POSITION is changed to other than "long",
X * you may have to change some of the printfs which use "%ld"
X * to print a variable of type POSITION. }}
X */
X
X#define NULL_POSITION ((POSITION)(-1))
X
X/*
X * The type of an interrupt handler.
X */
X#define HANDLER void
X
X/*
X * An IFILE represents an input file.
X */
X#define IFILE VOID_POINTER
X#define NULL_IFILE ((IFILE)NULL)
X
X/*
X * The structure used to represent a "screen position".
X * This consists of a file position, and a screen line number.
X * The meaning is that the line starting at the given file
X * position is displayed on the ln-th line of the screen.
X * (Screen lines before ln are empty.)
X */
Xstruct scrpos
X{
X POSITION pos;
X int ln;
X};
X
Xtypedef union parg
X{
X char *p_string;
X int p_int;
X} PARG;
X
X#define NULL_PARG ((PARG *)NULL)
X
X#define EOI (-1)
X
X#ifndef NULL
X#define NULL (0)
X#endif
X
X#define READ_INTR (-2)
X
X/* How quiet should we be? */
X#define NOT_QUIET 0 /* Ring bell at eof and for errors */
X#define LITTLE_QUIET 1 /* Ring bell only for errors */
X#define VERY_QUIET 2 /* Never ring bell */
X
X/* How should we prompt? */
X#define PR_SHORT 0 /* Prompt with colon */
X#define PR_MEDIUM 1 /* Prompt with message */
X#define PR_LONG 2 /* Prompt with longer message */
X
X/* How should we handle backspaces? */
X#define BS_SPECIAL 0 /* Do special things for underlining and bold */
X#define BS_NORMAL 1 /* \b treated as normal char; actually output */
X#define BS_CONTROL 2 /* \b treated as control char; prints as ^H */
X
X/* How should we search? */
X#define SRCH_FORW 0 /* Search forward from current position */
X#define SRCH_BACK 1 /* Search backward from current position */
X#define SRCH_NOMATCH 0100 /* Search for non-matching lines */
X#define SRCH_PAST_EOF 0200 /* Search past end-of-file, into next file */
X#define SRCH_FIRST_FILE 0400 /* Search starting at the first file */
X
X#define SRCH_DIR(t) ((t) & 077)
X#define SRCH_FLAG(t) ((t) & 07700)
X
X/* Special chars used to tell put_line() to do something special */
X#define NORMAL (0)
X#define UNDERLINE (1)
X#define BOLD (2)
X#define BLINK (3)
X#define INVIS (4)
X
X#define CONTROL(c) ((c)&037)
X#define ESC CONTROL('[')
X
X#define SIGNAL(sig,func) signal(sig,func)
X
X/* Library function declarations */
Xoffset_t lseek();
X#define BAD_LSEEK ((offset_t)-1)
XVOID_POINTER calloc();
X
X#define ch_zero() ((POSITION)0)
X#include "funcs.h"
END_OF_FILE
echo shar: Extracting \"position.h\"
sed "s/^X//" >'position.h' <<'END_OF_FILE'
X/*
X * Include file for interfacing to position.c modules.
X */
X#define TOP (0)
X#define TOP_PLUS_ONE (1)
X#define BOTTOM (-1)
X#define BOTTOM_PLUS_ONE (-2)
X#define MIDDLE (-3)
END_OF_FILE
echo shar: Extracting \"cmd.h\"
sed "s/^X//" >'cmd.h' <<'END_OF_FILE'
X#define MAX_USERCMD 500
X#define MAX_CMDLEN 16
X
X#define A_B_LINE 2
X#define A_B_SCREEN 3
X#define A_B_SCROLL 4
X#define A_B_SEARCH 5
X#define A_DIGIT 6
X#define A_DISP_OPTION 7
X#define A_DEBUG 8
X#define A_EXAMINE 9
X#define A_FIRSTCMD 10
X#define A_FREPAINT 11
X#define A_F_LINE 12
X#define A_F_SCREEN 13
X#define A_F_SCROLL 14
X#define A_F_SEARCH 15
X#define A_GOEND 16
X#define A_GOLINE 17
X#define A_GOMARK 18
X#define A_HELP 19
X#define A_NEXT_FILE 20
X#define A_PERCENT 21
X#define A_PREFIX 22
X#define A_PREV_FILE 23
X#define A_QUIT 24
X#define A_REPAINT 25
X#define A_SETMARK 26
X#define A_SHELL 27
X#define A_STAT 28
X#define A_FF_LINE 29
X#define A_BF_LINE 30
X#define A_VERSION 31
X#define A_VISUAL 32
X#define A_F_WINDOW 33
X#define A_B_WINDOW 34
X#define A_F_BRACKET 35
X#define A_B_BRACKET 36
X#define A_PIPE 37
X#define A_INDEX_FILE 38
X
X
X
X
X#define A_AGAIN_SEARCH 43
X#define A_T_AGAIN_SEARCH 44
X#define A_REVERSE_SEARCH 45
X#define A_T_REVERSE_SEARCH 46
X#define A_OPT_TOGGLE 47
X#define A_OPT_SET 48
X#define A_OPT_UNSET 49
X#define A_F_FOREVER 50
X#define A_GOPOS 51
X
X#define A_INVALID 100
X#define A_NOACTION 101
X#define A_UINVALID 102
X
X#define A_EXTRA 0200
END_OF_FILE
echo shar: Extracting \"option.h\"
sed "s/^X//" >'option.h' <<'END_OF_FILE'
X#define END_OPTION_STRING ('$')
X
X/*
X * Types of options.
X */
X#define BOOL 01 /* Boolean option: 0 or 1 */
X#define TRIPLE 02 /* Triple-valued option: 0, 1 or 2 */
X#define NUMBER 04 /* Numeric option */
X#define STRING 010 /* String-valued option */
X#define NOVAR 020 /* No associated variable */
X#define REPAINT 040 /* Repaint screen after toggling option */
X#define NO_TOGGLE 0100 /* Option cannot be toggled with "-" cmd */
X
X#define OTYPE (BOOL|TRIPLE|NUMBER|STRING|NOVAR)
X
X/*
X * Argument to a handling function tells what type of activity:
X */
X#define INIT 0 /* Initialization (from command line) */
X#define QUERY 1 /* Query (from _ or - command) */
X#define TOGGLE 2 /* Change value (from - command) */
X
X/* Flag to toggle_option to specify how to "toggle" */
X#define OPT_NO_TOGGLE 0
X#define OPT_TOGGLE 1
X#define OPT_UNSET 2
X#define OPT_SET 3
X
Xstruct option
X{
X char oletter; /* The controlling letter (a-z) */
X char otype; /* Type of the option */
X int odefault; /* Default value */
X int *ovar; /* Pointer to the associated variable */
X void (*ofunc)(); /* Pointer to special handling function */
X char *odesc[3]; /* Description of each value */
X};
X
END_OF_FILE
More information about the Alt.sources
mailing list