home *** CD-ROM | disk | FTP | other *** search
- $! cd.com - simulate Un*x 'cd' command
- $
- $ if p1 .eqs. "" then p1 = f$logical("sys$login")
- $
- $! translate disk:[dir1.dir2.dirN] to disk:[dir1.dir2.-]dirN.dir
- $
- $ 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:
- $ set def 'p1
- $ if f$type(pwd) .eqs. "" then pwd :== show default
- $ pwd
-