[comp.sys.amiga.tech] PushDir/PopDir available?

johnl@tw-rnd.SanDiego.NCR.COM (John Lindwall) (11/14/89)

Has anyone out there written PushDir and PopDir utilities?  These are CLI-
type utilities that I've gotten used to with MSDOS (At work OK?) and Unix.
They work like this:  You type "PushDir" and the current directory is saved
onto a stack.  You CD all over the place for a while, and when you want to
return to your original directory you type "PopDir".

If not, I'd like to take a stab at writing them.  I'm new to CLI internals
so I'd appreciate any help.  I assume the (or Shell) CLI has a lock on its
current directory.  When "PushDir" is called can I just duplicate this lock
in a data structure? When "PopDir" is called ,can I just Unlock the current
dir lock, and lock the saved lock?  (Heh heh.  Look at how naive I am).

Thanks for any help!

-- 
John Lindwall                     |   "Not my employer opinions; mine"
johnl@tw-rnd.SanDiego.NCR.COM     |   a man, a plan, a beer, reeban alpa nama
----------------------------------+--------------------------------------------

FelineGrace@cup.portal.com (Dana B Bourgeois) (11/15/89)

John, these (and many other goodies) come *FREE* when you buy WShell
from William S. Hawes.  If you haven't guessed, WShell is a shell program
and it includes built-in those utilities you mentioned:

Pushcd, Popcd, and also Swapcd which exchanges the current cd and the
the one on top of the stack.  Neat stuff!!

Dana @ cup.portal.com

I'm not related or affiliated with William in any way except I use ConMan,
WShell, and ARexx - all products written and supported by William which I
happen to like very much.

currier@wang.UUCP (Ronald Currier) (11/16/89)

johnl@tw-rnd.SanDiego.NCR.COM (John Lindwall) writes:

>Has anyone out there written PushDir and PopDir utilities?  These are CLI-
>type utilities that I've gotten used to with MSDOS (At work OK?) and Unix.
>They work like this:  You type "PushDir" and the current directory is saved
>onto a stack.  You CD all over the place for a while, and when you want to
>return to your original directory you type "PopDir".

>If not, I'd like to take a stab at writing them.  I'm new to CLI internals
>so I'd appreciate any help.  I assume the (or Shell) CLI has a lock on its
>current directory.  When "PushDir" is called can I just duplicate this lock
>in a data structure? When "PopDir" is called ,can I just Unlock the current
>dir lock, and lock the saved lock?  (Heh heh.  Look at how naive I am).

Yes they are available because I wrote a set. I don't know if they work
under 1.3 or not however, because I switched to using Bill Hawes WSHELL which
provides the same service. What you suggest is basically correct as I remember
it. If you are interested in the code, let me know and I will send it to you.

	- Ron (wang!pensoft!currier)

rszinn@spurge.waterloo.edu (Scotte Zinn) (11/17/89)

In article <24073@cup.portal.com> FelineGrace@cup.portal.com (Dana B Bourgeois) writes:
>John, these (and many other goodies) come *FREE* when you buy WShell
>from William S. Hawes.  If you haven't guessed, WShell is a shell program
>and it includes built-in those utilities you mentioned:
>

A great shell program!  I recommend it.

>Pushcd, Popcd, and also Swapcd which exchanges the current cd and the
>the one on top of the stack.  Neat stuff!!

These three commands implement only a subset of the trio found on *nix.
WShell is extensible, and I have successfully written a library of commands
that add the full *nix implementation of the three commands.  One problem
I found though, is that if you tell WShell to use your own library, it will
forget all about it's internal commands.  Thus, with the current version
of WShell you have to implement the internal commands so that they are
resident.  This is not too difficult, except for the batch commands, but
hey, I have and use AREXX so I didn't put those in.

Mr. Hawes told me that the problem of WShell tossing out it's internal
commands when you install your own command library will be fixed in a 
future version.  At that time I will consider sending my library off to
c.b.a unless there is enough interest.


>
>Dana @ cup.portal.com
>
>I'm not related or affiliated with William in any way except I use ConMan,
>WShell, and ARexx - all products written and supported by William which I
>happen to like very much.

Ditto


---
Scotte Zinn
rszinn@spurge.uwaterloo.edu

peter@sugar.hackercorp.com (Peter da Silva) (11/18/89)

[ quick aside: a nice game to play with AmigaShell: try to execute a window:
  1> con:0/0/640/200/foo ]

For a quick-and-dirty 1-level pushd/popd, try this:

-------pushd:
.key dir
assign pop: ""
cd <dir>
-------popd:
cd pop:
-------
-- 
Peter "Have you hugged your wolf today" da Silva <peter@sugar.hackercorp.com>
`-_-'
 'U`
       "I am the ghost of aquariums past" -- Robotman.