
    DirStack 2.01
    (incorporating PUSHD, POPD, INITD)
    Batch file directory stack commands
    (c) 1993 ZingoTech Labs / Jim Nelson
    ------------------------------------

    Licensing and availability
    --------------------------
    DirStack is FREEWARE.  Please distribute everywhere.  There is no
    charge incurred or expected by the author for its use or distribution.
    The only obligation is that this text file be included as part of any
    distribution.

    Operation
    ---------
    These 3 programs work together as an effective batch-file based
    directory stack.  I originally saw these commands on a SCO UNIX
    machine, and found them quite useful in script files for that
    system.  With a little ingenuity, I hacked out similar commands for
    DOS.

    Here's the idea: let's say you have a batch file that changes drives
    or directories internally.  This is sometimes more than a nuisance;
    great ideas for complex batch files are quickly killed when one
    realizes there's no effective way to get back to the directory you
    started in.

    That's what these are for.  PUSHD will push on a stack the current
    drive/directory.  POPD pops the most recently pushed directory off
    the stack, and changes the drive/directory accordingly.

    Now, in some implementations of UNIX, there are script commands that
    allow you to build an array of characters -- perfect for this type of
    application.  As a matter of fact, these commands were not even scripts
    themselves, but simply aliases (commands re-interpreted by the shell
    before execution).  The overhead was low to none in this kind of
    implementation.

    Not so, with DOS-based machines.  I've seen directory stacks for DOS
    before, but they always relied on a TSR.  None of these files are
    TSR-based.  Instead, the stack is located in a temporary file
    (DIRSTACK.DAT).  Each program manipulates the file in its own unique
    manner.

    INITD
    -----
    INITD initializes (clears) the stack for the other modules.  Although
    it's probably not needed in normal use, it is needed if the PC crashes;
    after a reboot, the stack is still (faithfully) there.  This is a
    good AUTOEXEC.BAT or Login Script command.

    INITD /S will not clear the stack, but print to standard output the
    path it (and the other modules) will use to look for DIRSTACK.DAT.

    PUSHD
    -----
    This will push the current drive and directory onto the stack.  That's
    it.

    POPD
    ----
    This will pop from the stack a drive and directory, and then attempt
    to make that the current path.

    Error messages
    --------------
    Unobtrusiveness was a specification from the beginning.  Error messages
    are brief (and to standard output).  The only error messages that will
    appear are if DIRSTACK is unwritable (read-only attribute?), the
    directory is unwritable, or if the drive/directory popped is unavailable.

    Finding DIRSTACK.DAT
    --------------------
    Since this is not a TSR-based package, each utility must hunt for the
    DIRSTACK.DAT individually, each time it is executed.  They each follow
    the same set of rules:
        1. Use directory specified by the environment variable STACK.
        2. Ditto for TEMP.
        3. Ditto for TMP.
        4. Find first local fixed drive, and locate file in its root.
        5. Use the directory the module is located in.
    I have chosen this order to hopefully avoid lost stacks and multiple users
    overwriting the same stack on a network.  Best bet?  Use the STACK
    variable if you plan on using these modules a lot in your batch files.

    Of course, for best results, make sure they are all located in the PATH.

    Final thoughts
    --------------
    I hope you enjoy using this suite of modules.  I developed them
    specifically for my needs, but tried to be "global-thinking" enough for
    anyone in any PC environment to find them useful.  Most of the
    considerations I made were really for a PC network system administrator.

    If you find yourself using these quite a bit, please write to me (address
    below) and tell me what you think.  To be really honest, I'm not sure how
    much practical value this package has, and would like to hear if anyone
    finds this sort of thing useful.

    About ZingoTech Labs
    --------------------
    Entirely fictional.  Decartes would call it a construct of
    Jim Nelson's mind.  Still, the idea is simple: there just aren't
    enough quality widgets in the world ("quality" being the
    emphasized word).  Too often, you find you need some little
    program that would make life that much better, only you can't
    fine one anywhere.  Or, you get your hands on one, and it's too
    limited, ugly, tough to use, or, gosh darnit, the guy wants
    twenty-five bucks for you to legally use it after 30 days.

    That's why (most) of our products are freeware.  There's no
    reason to pay more than $5 and the price of a first-class stamp
    for something like, well, DirStack.  But it's nice to have.  So
    keep it!

    However ...
    -----------
    Standard disclaimer.  Jim Nelson / ZingoTech Labs can't be
    held responsible for any problems, liabilities, destruction,
    permissiveness, loss of house and family, or any other bad kind
    of thing from it's use.  Bottom line: if you use it, you're
    responsible for the consequences.

    On a lighter note
    -----------------
    I love criticism and suggestions.  Whatever you think,
    *please* write and tell me.  Small donations (cash or otherwise)
    will be heartily accepted.  Plus, I might have a newer version
    available as well.  Whatever you have to say, contact me at:

         Jim Nelson / ZingoTech Labs
         1190 Buchon St.
         San Luis Obispo, CA  93401
         Internet: jnelson@tuba.calpoly.edu

    Thanks!


