Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!amdcad!pyramid!ctnews!unix386!mark From: mark@unix386.Convergent.COM (Mark Nudelman) Newsgroups: alt.sources Subject: less beta release (part 2 of 5) Message-ID: <530@unix386.Convergent.COM> Date: 14 Sep 89 22:23:33 GMT Distribution: usa Organization: Convergent Technologies, San Jose, CA Lines: 1898 #! /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 \"linstall\" sed "s/^X//" >'linstall' <<'END_OF_FILE' X#! /bin/sh X# Installation script for less. X# This script prompts the operator for various information X# and constructs a makefile. X Xecho "This script will build a makefile for less." Xecho "If you already have a file called \"makefile\" it will be overwritten." Xecho "Press RETURN to continue." Xread ans X Xecho "I will ask you some questions about your system." Xecho "If you do not know the answer to any question," Xecho "just press RETURN and I will choose a default for you." Xecho "Press RETURN now." Xread ans X XECHO=./vecho Xif [ ! -f $ECHO ] Xthen X echo "One moment..." X cc -o $ECHO vecho.c X echo "" Xfi X X$ECHO "Most Unix systems are derived from either System V" X$ECHO "or Berkeley BSD 4.1, 4.2, 4.3, etc." X$ECHO "" X$ECHO "Is your system closest to:" X$ECHO " 1. System V" X$ECHO " 2. BSD 4.1" X$ECHO " 3. BSD 4.2 or later" X$ECHO " 4. Xenix" X$ECHO "Enter a number, or just RETURN if you don't know: \c" Xread ans Xxenix=0 Xcase "X$ans" in XX1) sys=sys5; sysname="System V" ;; XX2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;; XX3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;; XX4) sys=sys5; xenix=1; sysname="Xenix" ;; X*) sys=unknown ;; Xesac X$ECHO "" X XDATE=`date` Xcat >makefile <>makefile <<"EOF" X# X# Invoked as: X# make all X# or make install X# Plain "make" is equivalent to "make all". X# X# If you add or delete functions, remake funcs.h by doing: X# make newfuncs X# This depends on the coding convention of function headers looking like: X# " \t public \n ( ... ) " X# X# Also provided: X# make lint # Runs "lint" on all the sources. X# make clean # Removes "less" and the .o files. X# make clobber # Pretty much the same as make "clean". X XSHELL = /bin/sh X XEOF X Xcat >defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>defines.h <>makefile <>makefile <>makefile <>makefile <<"EOF" X# OPTIM is passed to the compiler and the loader. X# It is normally "-O" but may be, for example, "-g". XOPTIM = -O X XCFLAGS = $(OPTIM) X X X X########################################################################## X# Files X########################################################################## X XSRC1 = ch.c command.c decode.c help.c input.c line.c XSRC2 = linenum.c main.c option.c optfunc.c opttbl.c os.c output.c position.c handle.c XSRC3 = prim1.c prim2.c prompt.c screen.c signal.c tags.c ttyin.c version.c X XSRC = $(SRC1) $(SRC2) $(SRC3) X XOBJ = ch.o command.o decode.o help.o input.o line.o linenum.o main.o \ X option.o optfunc.o opttbl.o os.o output.o position.o prim1.o prim2.o \ X handle.o prompt.o screen.o signal.o tags.o ttyin.o version.o X X X########################################################################## X# Rules for building stuff X########################################################################## X XEOF X Xif [ "$USERFILE" = "1" ] Xthen X cat >>makefile <<"EOF" Xall: less lesskey Xinstall: install_less install_help install_key install_lman install_kman XEOF Xelse X cat >>makefile <<"EOF" Xall: less Xinstall: install_less install_help install_lman XEOF Xfi X Xcat >>makefile <<"EOF" X Xless: $(OBJ) X $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS) $(LDLIBS) X Xlesskey: lesskey.o X $(CC) $(LDFLAGS) $(OPTIM) -o lesskey lesskey.o $(LDLIBS) X X# help.o depends on makefile for the definition of HELPFILE Xhelp.o: makefile X $(CC) $(CFLAGS) -c -DHELPFILE=\"$(HELPFILE)\" help.c X Xinstall_less: less X for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done X touch install_less X Xinstall_key: lesskey X for f in $(INSTALL_KEY); do rm -f $$f; cp lesskey $$f; done X touch install_key X Xinstall_help: less.help X for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done X touch install_help X Xinstall_lman: $(LESS_MANUAL) X for f in $(INSTALL_LESSMAN); do rm -f $$f; cp $(LESS_MANUAL) $$f; done X touch install_lman X Xinstall_kman: $(KEY_MANUAL) X for f in $(INSTALL_KEYMAN); do rm -f $$f; cp $(KEY_MANUAL) $$f; done X touch install_kman X X########################################################################## X# Maintenance X########################################################################## X Xlint: X lint -hp $(SRC) X Xnewfuncs funcs.h: X if [ -f funcs.h ]; then mv funcs.h funcs.h.OLD; fi X awk -f mkfuncs.awk $(SRC) >funcs.h X Xclean: X rm -f $(OBJ) lesskey.o less lesskey vecho X Xclobber: X rm -f *.o less lesskey vecho install_less install_key \ X install_help install_lman install_kman X Xshar: X shar -v README CHANGES less.nro lesskey.nro \ X vecho.c mkfuncs.awk less.help \ X less.h position.h funcs.h cmd.h option.h \ X lesskey.c > less1.shr X shar -v linstall less.man lesskey.man > less2.shr X shar -v $(SRC1) > less3.shr X shar -v $(SRC2) > less4.shr X shar -v $(SRC3) > less5.shr X X X########################################################################## X# Dependencies X########################################################################## X X$(OBJ): less.h funcs.h defines.h position.h Xcommand.o decode.o: cmd.h Xoption.o opttbl.o optfunc.o: option.h X Xlesskey.o: less.h funcs.h defines.h cmd.h X XEOF X$ECHO "" X X$ECHO "The makefile has been built." X$ECHO "You should check it to make sure everything is as you want it to be." X$ECHO "When you are satisfied with the makefile, just type \"make\"" X$ECHO "and \"less\" will be built." END_OF_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 [[[[----[[[[++++]]]]aaaaAAAABBBBccccCCCCddddeeeeEEEEffffggggiiiimmmmMMMMnnnnNNNNqqqqQQQQrrrruuuuUUUUsssswwww]]]] [[[[----bbbb_N]]]] [[[[----hhhh_N]]]] [[[[----xxxx_N]]]] [[[[----[[[[zzzz]]]]_N]]]] X [[[[----PPPP[[[[mmmmMMMM====]]]]_s_t_r_i_n_g]]]] [[[[----[[[[llllLLLL]]]]_l_o_g_f_i_l_e]]]] [[[[----kkkk_k_e_y_f_i_l_e]]]] X [[[[++++_c_m_d]]]] [[[[----tttt_t_a_g]]]] [[[[_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 backwards 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 9/14/89) 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 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 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 % If a bracket appears in the top line displayed on the X screen, the % command will go to the matching bracket. X A "bracket" is one of the characters "{ } [ ] ( )". 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. If there is more than X one left curly bracket on the top line, a number N may X X X X Page 2 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X be used to specify the N-th bracket on the line. X X } If a right curly bracket appears in the top line X displayed on the screen, the } command will go to the X matching left curly bracket. If there is more than one X right curly bracket on the top line, a number N may be X used to specify the N-th 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 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. Marks are preserved X when a new file is examined, so the ' command can be X 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 X option, which changes this). 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 ESC-/pattern X Search the entire file for the N-th line containing the X pattern. The search starts at the first line in the X file, regardless of what is displayed or the setting of X the -a option. X X /!pattern X X X X Page 3 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X Like /, but the search is for the N-th line which does X NOT contain the pattern. X X ?!pattern X Like ?, but the search is for the N-th line which does X NOT contain the pattern. X X ESC-/!pattern X Like ESC-/, but the search is for the N-th line which X does NOT contain the pattern. X X n Repeat previous search, for N-th line containing the X last pattern (or NOT containing the last pattern, if X the previous search was /! or ?!). X X ESC-n X Repeat previous search, but in the reverse direction. 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. X X ^X^V or :e X Same as E. Warning: some systems use ^V as a special X literalization character. X X N or :n X Examine the next file (from the list of files given in X the command line). If a number N is specified (not to X be confused with the command N), the N-th next file is X examined. X X P or :p X Examine the previous file. If a number N is specified, X the N-th previous file is 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 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 X X X Page 4 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X or a string value (such as -P or -t), a new value may X be entered after the option letter. 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 X Exits _l_e_s_s. X X The following two 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 EDITPROTO under the section on PROMPTS X below. X X ! shell-command 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 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 X X X Page 5 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X 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 Normally, forward searches start just after the top X displayed line (that is, at the second displayed line). X Thus, forward searches include the currently displayed X screen. The -a option causes forward searches to start X just after the bottom line displayed, thus skipping the X currently displayed screen. X X -A The -A option causes searches to start at the second X SCREEN line displayed, as opposed to the default which X is to start at the second REAL line displayed. For X example, suppose a long real line occupies the first X three screen lines. The default search will start at X the second real line (the fourth screen line), while X the -A option will cause the search to start at the X second screen line (in the midst of the first real X line). (This option is rarely useful.) X X -b The -b_n option tells _l_e_s_s to use a non-standard number X of buffers. Buffers are 1K, and normally 10 buffers X are used (except if data in coming from standard input; X see the -B option). The number _n specifies a different X number of buffers to use. X X -B Normally, when data is coming from standard input, X buffers are allocated automatically as needed, to avoid X loss of data. The -B option disables this feature, so X that only the default number of buffers are used. If X more data is read than will fit in the buffers, the X oldest data is discarded. X X -c Normally, _l_e_s_s will repaint the screen by scrolling X from the bottom of the screen. If the -c option is X set, when _l_e_s_s needs to change the entire display, it X will paint from the top line down. X X -C The -C option is like -c, but the screen is cleared X X X X Page 6 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X before it is repainted. X X -d Normally, _l_e_s_s will complain if the terminal is dumb; X that is, lacks some important capability, such as the X ability to clear the screen or scroll backwards. The X -d option suppresses this complaint (but does not X otherwise change the behavior of the program on a dumb X terminal). X X -e Normally the only way to exit _l_e_s_s is via the "q" X command. The -e option tells _l_e_s_s to automatically X exit the second time it reaches end-of-file. X X -E The -E flag causes _l_e_s_s to exit the first time it X reaches end-of-file. X X -f Normally, _l_e_s_s will refuse to open a non-regular file X (that is, a file which is a directory or a device X special file). The -f flag forces _l_e_s_s to open such X files. X X -g Force input characters to 7 bits (that is, mask off the X high order bit). The default is to use full 8 bit X characters. X X -h Normally, _l_e_s_s will scroll backwards when backwards X movement is necessary. The -h option specifies a X maximum number of lines to scroll backwards. If it is X necessary to move backwards more than this many lines, X the screen is repainted in a forward direction. (If X the terminal does not have the ability to scroll X backwards, -h0 is implied.) X X -i The -i option causes searches to ignore case; that is, X uppercase and lowercase are considered identical. X Also, text which is overstruck or underlined can be X searched for. X X -k The -k option, followed immediately by a filename, will X cause _l_e_s_s to open and interpret the file as a _l_e_s_s_k_e_y X (1) file. Multiple -k options may be specified. If a X file called .less exists in the user's home directory, X this file is also used as a _l_e_s_s_k_e_y file. X X -l The -l option, followed immediately by a filename, will X cause _l_e_s_s to copy its input to the named file as it is X being viewed. This applies only when the input file is X 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 -L The -L option is like -l, but it will overwrite an X X X X Page 7 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X existing file without asking for confirmation. X X If no log file has been specified, the -l and -L 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 -l from within _l_e_s_s. X X -m Normally, _l_e_s_s prompts with a colon. The -m option X causes _l_e_s_s to prompt verbosely (like _m_o_r_e), with the X percent into the file. X X -M The -M option causes _l_e_s_s to prompt even more verbosely X than _m_o_r_e. X X -n The -n flag suppresses line numbers. The default (to X use line numbers) may cause _l_e_s_s to run more slowly in X some 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 EDITPROTO in PROMPTS below). X X -N The -N flag causes a line number to be displayed at the X beginning of each line in the display. X X -P The -P option provides a way to tailor the three prompt X styles to your own preference. You would normally put X this option in your LESS environment variable, rather X than type it in with each _l_e_s_s command. Such an option X must either be the last option in the LESS variable, or X be terminated by a dollar sign. -P followed by a X string changes the default (short) prompt to that X string. -Pm changes the medium (-m) prompt to the X string, and -PM changes the long (-M) prompt. Also, X -P= changes the message printed by the = command to the X given string. All prompt strings consist of a sequence X of letters and special escape sequences. See the X section on PROMPTS for more details. X X -q Normally, if an attempt is made to scroll past the end X of the file or before the beginning of the file, the X terminal bell is rung to indicate this fact. The -q X option tells _l_e_s_s not to ring the bell at such times. X If the terminal has a "visual bell", it is used X instead. X X -Q Even if -q is given, _l_e_s_s will ring the bell on certain X other errors, such as typing an invalid character. The X -Q option tells _l_e_s_s to be quiet all the time; that is, X X X X Page 8 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X never ring the terminal bell. If the terminal has a X "visual bell", it is used instead. X X -r Normally, control character are displayed using a carat X and the equivalent non-control character. For example, X a control-A (octal 001) is displayed as "^A". If the X -r flag is set, "raw" control characters are displayed, X without this translation. Warning: when this flag is X used, _l_e_s_s cannot keep track of the actual appearance X of the screen (since this depends on how the screen X responds to each type of control character). Thus, X various display problems may result, such as long lines X being split in the wrong place. X X -s The -s option causes consecutive blank lines to be X squeezed into a single blank line. This is useful when X viewing _n_r_o_f_f output. X X -t 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 For _v_i compatibility, the command ":ta" is equivalent X to specifying -t from within _l_e_s_s. X X -u If the -u option is given, backspaces are treated as X printable characters; that is, they are sent to the X terminal when they appear in the input. X X -U If the -U option is given, backspaces are printed as X the two character sequence "^H". X X If neither -u nor -U is given, backspaces which appear X adjacent to an underscore character are treated X specially: the underlined text is displayed using the X terminal's hardware underlining capability. Also, X 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. X X -w Normally, _l_e_s_s uses a tilde character to represent X lines past the end of the file. The -w option causes X blank lines to be used instead. X X -x The -x_n option sets tab stops every _n positions. The X default for _n is 8. X X -[z] When given a backwards or forwards window command, _l_e_s_s X X X X Page 9 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X will by default scroll backwards or forwards one X screenful of lines. The -z_n option changes the default X scrolling window size to _n lines. The z and w commands X can also be used to change the window size. Note that X the "z" in "-z_n" is optional for compatibility with X _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, + acts like +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 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 %bX 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 means use the middle line, a "b" means use the bottom X line, and a "B" means use the line just after the X bottom line. X X %E Replaced by the name of the editor (from the EDITOR X X X X Page 10 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X environment variable). See the discussion of the X EDITPROTO 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 %lX 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 %pX 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 Replaced by the size of the current input file. 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 ?a True if any characters have been included in the prompt X so far. X X ?bX True if the byte offset of the specified line is known. X X ?e True if at end-of-file. X X X X X Page 11 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X X ?f True if there is an input filename (that is, if input X is not a pipe). X X ?lX 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 ?pX True if the percent into the current input file of the X specified line is known. X X ?s True if the size of current input file is known. 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 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 X X X Page 12 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X 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 EDITPROTO is defined, it X is used as the command to be executed when the v command is X invoked. The EDITPROTO string is expanded in the same way X as the prompt strings. The default value for EDITPROTO is: X %E ?lm+%lm. %f 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 EDITPROTO X variable can be changed to modify this default. X X X EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT VVVVAAAARRRRIIIIAAAABBBBLLLLEEEESSSS X EDITOR X The name of the editor (used for the v command). X X EDITPROTO X Editor prototype string (used for the v command). See X discussion under PROMPTS. 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 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 X X X Page 13 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSS((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSS((((1111)))) X X X 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 X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Page 14 (printed 9/14/89) 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 action 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 A special case is the "toggle-option" action. This action X may be followed by a single letter indicating the option to X be toggled. See the ":ta" command in the example below. X X As an example, the following input file describes the set of X default command keys used by less: X X k back-line X y back-line X ^K back-line X ^Y back-line X ^P back-line X b back-screen X ^B back-screen X \33v back-screen X u back-scroll X ^U back-scroll X ? back-search X w back-window X { bracket-{ X X X X Page 1 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) X X X X } bracket-} X ( bracket-( X ) bracket-) X [ bracket-[ X ] bracket-] X % bracket-any X E examine X :e examine X ^X^V examine X \33/ file-search X + first-cmd X e forw-line X j forw-line X ^E forw-line X ^J forw-line X ^M forw-line X ^N forw-line X f forw-screen X ^F forw-screen X \40 forw-screen X ^V forw-screen X d forw-scroll X ^D forw-scroll X / forw-search X z forw-window X G goto-end X > goto-end X \33> goto-end X g goto-line X < goto-line X \33< goto-line X ' goto-mark X ^X^X goto-mark X h help X H help X N next-file X :n next-file X p percent X P prev-file X :p prev-file X q quit X :q quit X :Q quit X ZZ quit X ^L repaint X ^R repaint X r repaint X R flush-repaint X n repeat-search X \33n reverse-search X m set-mark X ! shell X X X X Page 2 (printed 9/14/89) X X X X X X X LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) UUUUNNNNIIIIXXXX 5555....0000 LLLLEEEESSSSSSSSKKKKEEEEYYYY((((1111)))) X X X X = status X ^G status X :f status X - toggle-option X :ta toggle-option t X s toggle-option l X _ display-option X V version X v visual X 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 X X X X X X X X X X X X X X X X X X X X X Page 3 (printed 9/14/89) X X X END_OF_FILE