home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
newc_dev
/
dc27.lha
/
DC
/
dc.man
< prev
Wrap
Text File
|
1993-05-19
|
6KB
|
159 lines
NAME
DC - Direct Change V2.7
SYNOPSIS
DC <patterns> [-b] [-q] [-e] [-i] [-r]
DC <devs/...> -u [-q]
DESCRIPTION
DC changes the current directory like CD does, but requires only a
tiny piece of the directory path as a parameter. DC looks for a match
in a database of the directory paths in your system, and changes
the current dir directly to that path. Thus, navigating your shell
through large directory trees becomes fast and convenient.
For instance, typing "CD WORK:Program/Source/MyTools" reduces to
"DC w:sou/my" or even a "DC myt" assuming the pattern "myt" doesn't
occur elsewhere. If it does, you can cycle through these multiple
matches until you've found the directory you are looking for. This
is done simply by rerunning DC using the same pattern.
INSTALLATION
DC requires WorkBench 2.0 or higher. The database containing the
directory paths can be updated by typing "DC <list of volumes> -u".
The directory trees of all specified volumes will be stored in
the file ".dc". "Devs:" is the default location for this file, if you
prefer another location you'll have to set the environment variable "DC"
to the path of your choice.
Updating the database should be done regulary so as to have it reflect
recent changes in your directory trees. If you use a Cron scheduler,
I suggest you add the update entry to your CronTab.
Once the database has been created you're ready to go, in principle,
but every time you invoke DC it will load the .dc file from disk.
To greatly speed up operations you may wish to install the .dc file
in RAM as a semaphore by adding "DC -i" to your startup sequence.
DC is pure and can be made resident for added performance.
Before I forget, as an added bonus, you may compress the .dc
file using FImp. FImp is a compression utility from the Imploder 4.0
distribution.
MATCHING ALGORITHM
Operation is as follows. The first thing that happens when you use
DC with a directory name or part of a directory name is a normal
CD operation. DC tries to lock the directory and if it succeeds
changes the current directory accordingly. If it fails, DC examines
the current directory name and if it matches the supplied pattern
it will change to the next directory matching this pattern.
So multiple invocations of "DC s" will cycle you through all
(sub)directories containing a character "s". When the supplied
pattern is not matching with the current directory DC tries to
`guess' what the best match will be and jumps to this directory.
DC is not case-sensitive.
OPTIONS
<patterns> :consists of a partial directory name, no wildcards
supported (yet).
-b :used in conjunction with <pattern> to
jump to the best matching directory.
<devs/...> :consists of a list of devices and/or volumes separated
by space or comma.
-u :used in conjunction with <devs/...> to update the
directory cache file. May take a while...
-i :installs directory cache in public memory.
-r :removes directory cache from memory.
-q :quiet flag, to disable some default messages.
-e :echo's result to the standard output instead of
changing the current directory. Used in conjunction
with pipes and command line substitution.
EXAMPLES
DC WB_2.0: WORK: -u :creates database file ".dc" for
volumes WB_2.0: and WORK:
DC -i -q :places directory cache resident in memory
DC system :will take you to _a_ ...:.../.../#?system#?
directory, if one exists e.g. WB_2.0:System
DC vs/pr :takes you to _a_ ...:.../#?vs#?/.../#?pr#?
directory, upto 16 partial pattern separated
by a / or : are allowed
DC -r :removes directory cache from memory
Your (daily) update scheme, worst case, may look like this:
DC WB_2.0: WORK: "RAM DISK:" -u : update directory database
Sort DEVS:.dc TO DEVS:.dc : depends on personal preferences
FImp DEVS:.dc DEVS:.dc : to save a few bytes
WSHELL 2.0
WShell 2.0 users have complained that the prompt or shell titlebar
current directory strings won't be updated after a directory change
using DC (or any other external program for that matter). To amend
this, the following work-around has been contrived; in Config-WShell
add the lines
alias DC LITERAL cd "`DCR -e []`"
resi C:DC as DCR
This has the added benefit that AUTO PUSHCD will still work with DC
as well as adding wildcarding normal CDs using DC.
BUGS
Directory cache format is not very efficient. On the other hand,
it's readable and editable.
Links are not supported. Due to problems with cycling through
all directories containing the specified pattern. During update
any encountered hard- or softlink will be intentionally left out!
FUTURE IMPROVEMENTS
Only(?) 16 volumes can be specified on the command line,
but this can easily be overcome by concatenating different .dc files.
Support for some kind of directory-exclusion.
Should use ExAll().
Reformat .dc file to be both efficient and fast.
Add support for local .dc files (ie. one per drive/partition)?
(In fact this is already possible using a work-around, set
the env var DC to ":", cd to each volume, use "dc -u" for
each volume to build local .dc files. There's one drawback: You
can't place the database in memory by using "DC -i" anymore.)
LEGAL STUFF
DC is FreeWare. If you like DC and you've some suggestions,
comments, bugreports, or whatever please e-mail me.
HISTORY
... lots of beta test versions, lost history.
2.0 1.3 hacks removed, Workbench 2.0 only now
2.1 Aadded multiple subpattern support
2.2 Fixed (another) directory priority bug
2.3 Cleaned up for first public release...
2.4 Ignores directory links to avoid problems with cycling
2.5 Translates device_or_assign: to volume:dir/dir/...
- this avoids problems with cycling (again)
- this allows constructs like: DC SYS:pat
(thanks to Mattias Moltkesson for his suggestions)
2.6 Added env: var "dc" which may be used to specify another
path for dc's database. (Default: "DEVS:")
2.7 Fixed version check bug. Now replaces database in memory
after a directory scan (-u).
AUTHOR
Peter Struijk
struijk@dutiws.twi.tudelft.nl