Feb 10 1998


WCD  - Waterlander Change Directory 1.8.1
     - by Erwin Waterlander

Usage:  wcd [drive:][dir] [-h] [-s] [-a] [-e] [-q] [-Q] [-c] [-v]
            [-l] [-b] [-u <username>] [-f <treefile>]
  dir   = (partial) name of directory to change to.
          Wildcards *, ? and [SET] are supported!
  -h    = show this Help
  -s    = (re)Scan disk
  -a    = Add current directory to treedata
  -e    = add current directory to Extra treedata (Unix only)
  -q    = Quiet operation (Unix)    unQuiet operation (DOS)
  -Q    = Quieter operation
  -c    = direct CD mode
  -u    = add treefile of other User (Unix only)
  -f    = add extra treeFile
  -v    = print Version info
  -l    = aLias current dir (case sensitive)
  -b    = Ban current path

Examples:
   wcd Un -s            wcd src/wcd
   wcd *ix              wcd doe*/vhdl -u doe
   wcd w*[1-3]          wcd src -q -f /home/doe/.extra.wcd
   wcd d:games          wcd -a

======================================================================
= Contents                                                           =
======================================================================

1 Description
2 DOS/Windows installation
  - 16 bit
  - 32 bit
  - Bourne Again Shell (bash)
  - Using default options
3 Unix installation
  - Korn Shell (ksh)
  - C Shell (csh)
  - Bourne Again Shell (bash)
4 Bugs
5 Source code
6 Modification history
7 Copyright
8 Contact / Download new versions

======================================================================
= Description                                                        =
======================================================================

Powerful directory changer for DOS(-box) and Unix.
(Another NCD-clone that also works under Unix.)

This program jumps to a (sub)directory anywhere in the
directory-tree or to directories of other users if
you are on a Unix network.
The directory to jump to can be given by only the first
characters or an expression with wildcards. This means that
you also can search on the last characters of the directory name.
Eg. wcd *dows
Wildcards *, ? and [SET] are supported fully.
Wcd can also change to directories that are not in the
treedata-file. Eg. wcd ..

wcd generates a treedata-file were it searches the directory
(Dos: \treedata.wcd  Unix: ~/.treedata.wcd).

>wcd adir
searches for a directory matching adir*
In case of multiple matches the user can choose from
a list of matching directories.
A 100 % match of adir goes first.


It is also possible to give a part of a directory path.
Eg.

>wcd adir1/adir2

wcd searches for directory adir2* which path matches
*adir1/adir2*

It is allowed to type any kind of expression with slashes
and wildcards.

>wcd 1/ad
>wcd src*/*1?/a*2

In DOS it does not matter if you use a slash or a backslash as
directory-separator.
It is also possible under DOS to change drive and directory
in one go by preceding the directory name with the drive name.
E.g.    wcd d:games


  -a  :  Add current dir to treedata.
	 Use this option to quickly add the current dir
	 to the database. Re-scanning the complete disk can
	 take a long time in some cases.

  -c  :  direct CD mode
	 In direct CD mode wcd is more cd-like.

         By default wcd works as follows:
         1. Try to find a match in the treedata file(s)
         2. If no match, try to open the directory you typed.

         In direct CD mode wcd works in reversed order.
         1. Try to open the directory you typed.
         2. If not, try to find a match in the treedata file(s).

  -b  :  Ban current path.
	 Wcd places the current path in the banfile (Dos: \ban.wcd
	 Unix: ~/.ban.wcd ). This means that if wcd ignores all
	 matches of this directory and its subdirectories.
	 The match is printed in unquiet operation.
	 The banfile can be edited with a normal ascii-editor.

  -l  :  aLias current dir.
	 Wcd places the current path and the alias in the aliasfile
         (Dos: \alias.wcd Unix: ~/.alias.wcd ). Aliases are
	 case sensitive. The aliasfile can be edited with a normal
	 ascii-editor.


Wcd is not meant to be a replacement of the 'cd' command. It is
meant to be used in addition to the 'cd' command. If you use wcd
a lot you will notice that you will find short search strings for
all the directories you go often. Choosing from a list will only
happen sometimes. Sometimes the normal cd command is faster.
Like changing to your HOME or ROOT directory. Or on a read-only
drive.

Why WCD? Because I wanted a Unix clone of Norton Change Directory.

======================================================================
= DOS/Windows installation                                           =
======================================================================

16 bit version:
 Make sure that wcd.exe is in your path.

......................................................................

32 bit version:
 Make sure that wcd.exe and cwsdpmi.exe are in your path.
 (requires 80386 CPU or higher)

The 32 bit DOS version for DOS supports long directory names
in a Windows 95 Dos-box. Cwsdpmi.exe is not needed in a
Windows 95 Dos-box.

......................................................................

DOS Bourne Again Shell (bash):
(32 bit)

1)

 copy wcd.exe to your ~/bin directory.

2)

 Add the following function to your ~/_bashrc
 file. Notice that under Windows 95/NT the ~/.bashrc
 file overrides the ~/_bashrc file. In that case place
 the function in ~/.bashrc

function wcd
{
   c:/bin/wcd.exe $*
   source ~/wcd.go
}

Start a new bash

......................................................................

If you want to use some options by default use an alias or macro to do that.
Smarter shells like 4DOS and NDOS are able to set aliases like this:
alias wcd=wcd.exe -q

In DOS BASH add the options in your function.

In the MS-DOS COMMAND.COM shell you can use the 'doskey' command to define
a macro. You could add the following line to you AUTOEXEC.BAT file:
doskey wcd=wcd.exe -Q $*

......................................................................

The first time wcd is used the program will scan your
disk and build a treedata.wcd file in the root.
The treedata.wcd file can be updated by feeding the -s option.

......................................................................

Adding extra directories not on your current drive:
(works only with 32 bit version.)

You can add an extra directory-list in the file \extra.wcd
in your ROOT-directory.
Do not end the directory-names with a slash!

Example:

d:/games
d:/games/invaders
e:/project_a


======================================================================
= UNIX installation                                                  =
======================================================================

If you have downloaded the package with source-code (wcd??src.*)
you have to compile your own executable by typing 'make' in
the unix directory. The default compiler is cc.

......................................................................

Korn Shell (ksh):

1)

 copy wcd.exe to your $HOME/bin directory.

2)

 Add the following function to your $HOME/.kshrc
 file.

function wcd
{
   $HOME/bin/wcd.exe $*
   . $HOME/bin/wcd.go
}

Start a new Korn Shell

......................................................................

C Shell (csh):

1)

 copy wcd.exe to your $HOME/bin directory.

2)

 Add the following alias to your $HOME/.cshrc
 file.

alias wcd "$HOME/bin/wcd.exe \!* ; source $HOME/bin/wcd.go"

Start a new C Shell

......................................................................

Bourne Again Shell (bash):

1)

 copy wcd.exe to your $HOME/bin directory.

2)

 Add the following function to your $HOME/.bashrc
 file.

function wcd
{
   $HOME/bin/wcd.exe $*
   source $HOME/bin/wcd.go
}

Start a new bash

......................................................................

The first time wcd is used the program will scan your
disk and build a .treedata.wcd file in your HOME-directory.
The .treedata.wcd file can be updated by feeding the -s option.

wcd.exe will generate each time a script wcd.go in your
HOME/bin directory which must be executed via the function.

......................................................................

Adding extra directories not on your own account:

You can add an extra directory-list in the file .extra.wcd
in your HOME-directory.
Do not end the directory-names with a slash!

Example:

/home/piet/vhdl
/home/piet/project_a/c/src
/home/jan/phideo

Tip:
You can generate directory-trees with the unix find command.

Example:

find . -type d -print

......................................................................

Handy function to make new directories and add them
to your wcd list without re-scanning of the disk.
(Korn Shell)

Add this function to your ~/.kshrc file:

function wmkdir
{
   mkdir $1
   cd $1
   pwd >> $HOME/.treedata.wcd
   cd -
}

......................................................................

NOTE:

1) WCD does not follow symbolic links while scanning the disk.

======================================================================
= BUGS                                                               =
======================================================================

1. Unix and DOS 32 bit version:
   - Strange behaviour when the argument has a wildcard and matches a
     file or directory in the current directory.

  This is the result of the automatic expanding of arguments. The
  work-around is to "doublequote" the argument.

2. If you have a directory-path like
   /work/src/project_a/src
   then WCD ork/sr will match

   1 /work/src
   2 /work/src/project_a/src

   The second match is not correct.

......................................................................

If you think you found a bug do the following.
First check that you have the latest version of WCD. The bug
may already have been solved.
If it has not been solved than send me an e-mail.
Describe the bug and tell me
what version of WCD you use and under what operating system.
Addresses are in the end of this file.

Also ideas to improve wcd are welcome.

======================================================================
= Source code                                                        =
======================================================================

The source code for DOS 16 bit and Unix is identical.

The DOS version has been compiled with Borland C/C++ 4.02.
It is a 16 bit executable.
I used the compact memory model (64 KB for code, 1 MB for data).
Using the small memory model (64 KB for code, 64 KB for data)
results in sudden crashes.
To compile just type 'make'.

The default compiler for Unix is cc. The wcd source-code
also compiles wihtout problems with the gcc compiler.
To compile just type 'make'.

Aug 18 1997. Source-code changed for 32 bit DOS version.
32 bit DOS version is compiled with DJGPP, a 32 bit DOS
compiler. DJGPP is a DOS version of the Unix GNU C/C++ compiler.
For more information about DJGPP take a look at this
internet homepage:

http://www.delorie.com/djgpp/

======================================================================
= Modification history                                               =
======================================================================

   V1.0 beta Oct-1996  Original version.
   V1.0      Nov 14 1996. Always let the user choose
             in case of multiple match.
   V1.2c     Feb 11 1997.
             Many bugs have been solved.
   V1.3a     May 2 1997
             The Unix version can now also deal with
             directory names with spaces, dollars,
             backslashes, single quotes and double quotes.
   V1.4      Jun 18 1997
             Search with subdirectory definition
             (Eg. wcd adir1/adir2).

   V1.4      Aug 18 1997
	     Added 32 bit DOS version. Changed sourcecode
	     for DJGPP compiler.
	     This version is faster but needs a 80386 CPU
	     or higher.

   V1.4b     Sep 12 1997
	     Small bugfix perfect match list.
	     Quiet option added.

   V1.5      Oct 28 1997
             More options: -Q -f -u
	     Dos versions can work on read-only drives if
	     TEMP environment variable is set.
	     C shell support.

   V1.5a     Nov 10 1997
             Bugfix dos32 bit version long dir names support
	     in Windows 95 dos-box

   V1.6      Nov 11 1997
	     Added Unix bash support
	     Added a DOS bash version

   V1.7e     Dec 9 1997
	     - Add directories without scanning.
	     - Improved choosing from a list.
	     - quiet option default ON in DOS versions.
	     - changed MAX_LIST and MAX_WILD_LIST to 22
	     - no drive in treedata (DOS)
	     - direct CD mode

   V1.8.0    Feb 9 1998
	     - Change drive and dir in one go (Dos).
	     - Ban paths
	     - Alias directories

======================================================================
= Copyright                                                          =
======================================================================
Copyright (C) 1997 Erwin Waterlander

This program is freeware.
Permission is granted to any individual or institution to use,
copy, redistribute or modify this program, provided this
copyright notice is retained.

For the DOS-16-bit and the Unix version I used DOSDIR. See copyright
below.
I used the matching algorithm of Info-Zip's unzip program. See copyright
below.

Both DOSDIR and UNZIP are distributed by the Simtel.Net(sm)
world-wide network

......................................................................

DOSDIR: A Portable DOS/UNIX/VMS
Directory Interface, version 2.1 by Jason Mathews,
NASA/Goddard Space Flight Center, Greenbelt, Maryland  20771-0001 USA

Copyright (C) 1994 Jason Mathews.

Permission is granted to any individual or institution to use, copy
or redistribute this software so long as it is not sold for profit,
provided this copyright notice is retained.
......................................................................

Copyright on recmatch() from Zip's match.c

Copyright (C) 1990-1992 Mark Adler, Richard B. Wales, Jean-loup Gailly,
Kai Uwe Rommel and Igor Mandrichenko.

Permission is granted to any individual or institution to use, copy,
or redistribute this software so long as all of the original files are
included unmodified, that it is not sold for profit, and that this copy-
right notice is retained.

======================================================================
= Contact / Download new versions                                    =
======================================================================

I can be contacted via E-mail addresses:
          waterlan@xs4all.nl
      or  waterlan@natlab.research.philips.com

normal mail:
Address : Jongemastate 125
          5655 HS Eindhoven, The Netherlands

The latest version of WCD, executables and sources, can be downloaded from
this internet-page:

http://www.xs4all.nl/~waterlan/


Wcd is also distributed by Simtel.Net:
http://www.simtel.net/pub/simtelnet/msdos/dirutl/
ftp://ftp.simtel.net/pub/simtelnet/msdos/dirutl/

and Garbo:
http://garbo.uwasa.fi/pc/dirutil/
ftp://garbo.uwasa.fi/pc/dirutil/


Erwin Waterlander
