Metropoli BBS
VIEWER: pushpopd.all MODE: TEXT (ASCII)
THORNTON JOHAN A: PUSHD and POPD
Here are PUSHD and POPD, two utilities that I find often come in handy.  PUSHD
of course saves your current directory in a directory stack, and POPD pulls
off the last place where you were.  The directory paths are stored as lists
in a list called DPATH, which you must create in the root directory.
( HOME {} 'DPATH' STO )

I hope you are using the HOME-MAIN utility management method; put the programs
in the HOME directory.  If you're stingy with memory, kill the error message
from POPD - remove everything between DROP and END.


@ PUSHD - push current directory
%%HP: T(3)A(D)F(.);
\<< PATH DUP 1 \->LIST
HOME 'DPATH' STO+
EVAL
\>>


@ POPD - pop directory
%%HP: T(3)A(D)F(.);
\<< HOME DPATH OBJ\-> DUP
  IF
  THEN 1 - \->LIST
'DPATH' STO EVAL
  ELSE DROP
"POPD Error:" 1
"Directory Stack Empty"
2 DISP DISP 1
FREEZE
  END
\>>

 -------  _/__/   -----------------------------------------------------
        _|  ___|    E l e c t r i c a l      |  Johan Thornton, Esq.
       | | |_/     E n g i n E E r i n g     |-------------------------
       |/|  __|     U n i v e r s i t y      |  jthornto@fs1.ee.ubc.ca
       |-| |/__     o f   B r i t i s h      |-------------------------
       | |_____|      C o l u m b i a        |   This space for rent
 ----  |__|/_|   ------------------------------------------------------
[ RETURN TO DIRECTORY ]