
EVpath - short documentation
============================

 Written by Giuseppe Ghibò
 © 1994 by Giuseppe Ghibò <ghibo@galileo.polito.it>


-----------
Description
-----------

1) Environment variables may have any length.
   ------------------------------------------

   The environment variable used to specify a path may have
   any length (according to the size of the memory specified into
   Alloc_EnvPath()).

   Of course if we specify the environment variable with the
   AmigaDOS command SetEnv, the length of the var is truncated to 255 chars,
   but we can set the Environment variable using for instance an Editor; in
   such case we may have variables of arbitrary length.

2) Recursively path searching.
   ---------------------------

   If we append a * or a ** after a path element name, then such name
   is searched recursively for sub-directories. The char * is for
   one-level directory searching, while the ** is for searching into all
   the sub-dirs. Note that ** allow only a maximum of 10 level
   subdirectories (should be enough, but it can be modified changing
   the macro MAX_RECURS_DIR into the file EVPaths.c).

   Searching of subdirectories is executed when the function
   Init_EnvPath() is called and it is performed only _ONCE_ for every time
   we run the program, so if we append the ** to a directory which contains
   many (note `many' not `a few') non-reorganized sub-dirs, this can
   _slightly_ slow down the startup of the program. Of course isn't a good
   idea   to use path such as:

	.,dh0:**,dh1:**,dh2:**

   although this could give an idea of how much time is needed to scan
   all the sub-directories of the whole hard disk (you can try this path
   using TeXWhereIs).

   For instance suppose to have the following path:

	TeX:texinputs**,TeX:macros*

   In such example, then the path list will became, for instance

	TeX:texinputs
	TeX:texinputs/one
	TeX:texinputs/one/one
	TeX:texinputs/one/one/two
	TeX:texinputs/one/one/two/three
	TeX:texinputs/one/one/two/three/four
	.
	.
	.
	TeX:texinputs/two
	TeX:texinputs/two/one
	TeX:texinputs/two/one/two
	.
	.
	.
	TeX:texinputs/macro
	TeX:texinputs/macro/one
	TeX:texinputs/macro/two
	TeX:texinputs/macro
	
One of the most advantage of using the chars * and ** is that we don't have
to change the var contents every time we install a new macro package. Since
there are many macro packages for TeX, it is a good idea to keep
each macro package into his own directory. For instance the LaTeX 2e
macro packages contains also many sub-tools, and is a good idea to
keep each tool into his own directory (easy to update) rather than to
put thousands of files into TeX:texinputs/. For instance with

	TeX:texinputs/LaTeX2e*

we match

	TeX:texinputs/LaTeX2e
	TeX:texinputs/LaTeX2e/tools
	TeX:texinputs/LaTeX2e/graphics
	TeX:texinputs/LaTeX2e/babel

and so on.

Note that there is also some synonymous for * and **:

	---------------------------------
	| Char |       searching        |
	---------------------------------
	|  *   | one-level directories  |
	| **   | all sub-directories    |
	| #?   | one-level directories  |
	| #?>  | all sub-directories    |
	| *>   | all sub-directories    |
	---------------------------------

Note also that chars * and ** (or synonymous) don't specifies wildcards;
e.g. specifying TeX:macro/ltx*my we don't include every directory
which matches the string `ltx*my'.

Specifing TeX:texinputs** or TeX:texinputs/** is exactly the same thing, as
well TeX:texinputs or TeX:texinputs/.

3) Recursively environment variable searching
   ------------------------------------------

   In the path of an environment variables, we may also specify
   the name of another environment variable. For instance specifying the
   following path

	.,TeX:texinputs,$MYPATH,TeX:macros

   then the contents of the environment variable MYPATH will be added
   to the path list. Note that MYPATH could cointain another environment
   variable and so on. Up to 5 level of environment variables recursion are
   allowed (should be enough, but this value can also be changed changing
   the macro MAX_RECURS_VAR in EVpaths.c).
   Closed loop and duplicated entries are ignored. For instance

	setenv VARONE   one,"$"VARTWO
	setenv VARTWO   two,"$"VARTHREE
	setenv VARTHREE three,"$"VARFOUR
	setenv VARFOUR  four,"$"VARFIVE
	setenv VARFIVE  five,"$"VARSIX
	setenv VARSIX   six,"$"SEVEN
	setenv SEVEN    seven

   In such case if we use the variable VARONE, then we obtain the following
   path list
		one
		two
		three
		four
		five

   i.e. since recursive searching of environment variables is limited to 5,
   the two other variables `VARSIX' and `VARSEVEN' are simply ignored.
   Note that enclosing of $ between quotes is needed because otherwise the
   Shell expand the env variable (if it exists). This mean that quotes aren't
   needed if we use an editor to set the argument of an environment
   variable.
   Closed loop are also ignored, for instance if we consider

	setenv TEXINPUTS .,tex:texinputs,"$"MFINPUTS
	setenv MFINPUTS  .,mf:mfinputs,"$"TEXINPUTS

   if we use TEXINPUTS then the path list will contain

	tex:texinputs
	mf:mfinputs

   otherwise if we use MFINPUTS the path list will contain

	mf:mfinputs
	tex:texinputs

   What we can do with a such features? We may specify path
   using TWO environment variables. For instance suppose that
   the variable TEXINPUTS contains:

	.,$MYPATH,TeX:texinputs,TeX:LaTeX,TeX:LaTeX2e*

   then we may set for instance the env var MYPATH to `mymacro' and then run
   TeX or MF. Suppose now we want to use the files contained into the
   directory `mymacro2'. In such case we have just to change the var
   MYPATH without to change the whole contents of TEXINPUTS.

4) Path separators
   ---------------

   Path separators recognized are

	, ; SPACES TABs LFs FFs

   or any combinations of them. For instance we may have the following
   path

	TeX:texinputs,		TeX:macros**
	TeX:latex2e*;     CWeb:macros
	MF:inputs*
	^L^L

	MyTeX:mymacros

   and so on.

5) Names containing , ; or SPACES or TABS
   --------------------------------------

   If a path name contains a space or , or ; we must to enclose such
   name into quotes. For instance:

	"The LaTeX", "this,,  ,,,,dirs"
	"Another;;;;;;;one"

   Note that if a quote is leaved open then the path is taken as a
   whole path until a LF or FF is encountered.

6) Current dir.
   ------------

   To include the current dir into the path we may use one of the
   following symbols:

	.	""	"."

   Note that Unix like syntax such as:

	./mypath        -> directory `mypath' in the current dir

   and

	../mypath	-> directory `mymath' in the parent dir.

   are supported too.

7) Default path.
   -------------

   If the path of the environment variable superseed the default path
   we may include the default path at an arbitrary position. For
   instance:

	default path = "MF:inputs,MF:ams/fonts/symbols"

        MFINPUTS = .,MF:mfinputs,?,CTAN:mfinputs

   then the resulting path list will be:

	`'	(current dir)
	`MF:mfinputs'
	`MF:inputs'		(from default path)
	`MF:ams/fonts/symbols'	(from default path)
	`CTAN:mfinputs'

8) Duplicated entries are ignored. For instance using the following path

	.,".","",TeX:inputs,MF:inputs,TeX:inputs,MF:inputs
	
   the path list will contain only the following entries:

	`'	(current)
	TeX:inputs
	MF:inputs

   this means that a file isn't searched into the current dir
   or in the directory TeX:inputs or MF:inputs only _ONCE_. Note that
   although TeX:inputs/ and TeX:inputs are treated in the same way,
   they aren't recognized as same for the purpose to avoid duplicated
   entries.

9) Compatibility with OS 1.3.
   --------------------------

   EVPaths routines are fully compatible with OS 1.3. Since
   many TeX related programs still works with OS 1.3 it was a pity to
   loose the OS 1.3 compatibility only for the presence of the
   EVPaths routines...
