INSTALL
=======
Execute the following commands (for a more detailed description see below):

  ./configure
  cp lesspipe.sh sxw2txt code2color /usr/local/bin

or if you prefer make:

  make
  make test
  make install

Then do set the environment variable LESSOPEN:

  LESSOPEN="|/usr/local/bin/lesspipe.sh %s"; export LESSOPEN  #(sh like shells)
  setenv LESSOPEN "|/usr/local/bin/lesspipe.sh %s"            #(csh, tcsh)

  DO NOT OMIT THE VERTICAL BAR AS FIRST CHARACTER, IT IS ESSENTIAL !!!

Detailed description
====================

Prerequisites:
--------------
For a detailed discussion consult the file README starting with the section
'Required programs'. For best results up to date versions of 'file' (4.17 or
later), tar, gzip, bzip2 and the programs antiword, html2text and o3tohtml are
highly recommended.

Step 1: recreate lesspipe.sh and Makefile (optional)
----------------------------------------------------
To verify a working system and to customize lesspipe.sh to your needs
recreate lesspipe.sh from lesspipe.sh.in (and Makefile) by the command

 ./configure [--help] [--ask|--default|--fixed|--yes] [--prefix=<path>] [--shell=<file>]

For an explanation of the options do execute
  ./configure --help
To create a lesspipe.sh assuming all helper applications are in place do execute
  ./configure --yes
To accept the defaults searching the helper apps in $PATH please use
  ./configure --default
To use preconfigured defaults (last lines in configure) for answering the
questions (no matter whether helper applications are installed) do execute
  ./configure --fixed
To create a Makefile that does ask questions by default do use
  ./configure --ask
To install lesspipe.sh and code2color in <path>/bin (with make install) use
  ./configure --prefix=<path>
To create lesspipe.sh for a specific shell ((k)sh like shells only) do say
  ./configure --shell=<file>

The recreation of lesspipe.sh can also be achieved by using the supplied or
regenerated Makefile with the command

  make [MODE=--ask|--default|--fixed|--yes] [PREFIX=<path>]

where the optional parameters MODE and PREFIX correspond to the configure
options described above. Forcing the use of a specific shell is not possible.

##  Please note that the activation of syntax highlighting does slow down
##  the display of files noticeably. I do therefore recommend not using it.
##  You can watch the difference when running the test suite (make test)
##  with and without syntax highlighting.

Step 2: verify that lesspipe.sh is working correctly (optional)
---------------------------------------------------------------
A test suite has been added that does cover complicated use cases of less
where bugs have been fixed recently. Attempts are made to add normal use
cases as well. If the test suite reports "NOT ok" lines then lesspipe.sh
is probably not fully functional in your environment. If the message is
"NOT ok (ignored)" it is usually an indication that some helper programs are
not installed. To execute the test suite the command

  make test
or
  ./test.pl [-d]

can be used. The option -d is for debugging. In case of errors please read
the file testok/README. Make sure your file command is sufficiently recent.
Otherwise not all file formats will be recognized correctly.

To get support for newer file types an additional magic file (e.g. ~/.magic,
for use in the file command) might have to be created. In that case the
environment variable MAGIC has to be set and has to contain both the system
magic file and your personal one. Example:

  MAGIC='/usr/share/file/magic:/Users/myaccount/.magic'
  export MAGIC

Step 3: install lesspipe.sh, code2color and sxw2txt
---------------------------------------------------
You can copy lesspipe.sh to any appropriate place.
Suggested location: /usr/local/bin/lesspipe.sh
For syntax highlighting to work you have to copy the perl script code2color
to the same directory. The program sxw2txt is required for decoding Openoffice
and OpenDocument (OASIS) documents, if o3tohtml is not installed.

  cp lesspipe.sh code2color sxw2txt /usr/local/bin

This can be achieved also with make:

  make install [PREFIX=<path>]  # that copies the scripts to <path>/bin

Step 4: activate lesspipe.sh
----------------------------
To make use of the installed lesspipe.sh set the environment variable LESSOPEN:
I recommend to use the fully qualified path to avoid problems with other
scripts of the same name or with a changed search PATH:

  LESSOPEN="|/usr/local/bin/lesspipe.sh %s"; export LESSOPEN  #(sh like shells)
  setenv LESSOPEN "|/usr/local/bin/lesspipe.sh %s"	    #(csh, tcsh)

If syntax highlighting is activated in the script then to actually see
highlighted or colored code less has to be called with option -r or -R!

If lesspipe.sh was generated respecting the ENV var LESS_ADVANCED_PREPROCESSOR
then html, ps, rtf, nroff files as well as files with foreign charsets get
only preprocessed if that variable is set to yes. This way the user can
control the amount of file filtering himself.

Generated lesspipe.sh and Makefile in the package
=================================================
the supplied files were generated with the settings from configure
(after the __END__ line), that is everything enabled except synyax highlighting
and no support for the LESS_ADVANCED_PREPROCESSOR variable.

  ./configure --fixed
