home *** CD-ROM | disk | FTP | other *** search
- $! pushd.com - push directory onto stack
- $
- $ if f$type(dir_stack) .eqs. "" then dir_stack :== ""
- $ if p1 .eqs. "" then p1 = f$logical("sys$login")
- $
- $! check that new directory exists (derived from cd.com)
- $
- $ dir = f$parse(p1,,,"DIRECTORY") - "[" - "]"
- $l1:
- $ n = f$locate(".", dir)
- $ if n .ge. f$length(dir) then goto l2
- $ dir = f$extract(n + 1, 999, dir)
- $ goto l1
- $l2:
- $ dir = p1 - "]" + ".-]" + dir + ".dir"
- $
- $ if f$search(dir) .nes. "" then goto OK ! look for directory
- $ if f$trnlog(p1 - ":") .nes. "" then goto OK ! try logical name
- $ write sys$output "Directory ", p1, " does not exist"
- $ exit
- $OK:
- $
- $ here = f$environment("default") ! push directory on stack
- $ dir_stack == here + " " + dir_stack
- $ set def 'p1 ! change to directory
- $ if f$type(dirs) .eqs. "" then dirs :== show default
- $ dirs
-