From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 11-APR-1991 18:36:45.77
To:	ARISIA::EVERHART
CC:	
Subj:	Re: Daylight Savings time....

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA03611; Thu, 11 Apr 91 18:04:47 EDT
Received: From UNCAVX.UNCA.EDU by CRVAX.SRI.COM with TCP; Thu, 11 APR 91 14:26:15 PDT
Date: Thu, 11 Apr 1991 17:32 EST
From: SNODGRASS@UNCAVX.UNCA.EDU
Subject: Re: Daylight Savings time....
To: INFO-VAX@SRI.COM
Message-Id: <AB9E0697A00003E1@UNCA.BITNET>
X-Organization: University of North Carolina at Asheville
X-Envelope-To: INFO-VAX@SRI.COM
X-Vms-To: IN%"INFO-VAX@SRI.COM"

Yet another CD program...  This one works just like DOS's CD command.
        
CD \          {root}
CD ..         {previous directory}
CD directory  {certain lower directory}
CD \directory {direcory off of root directory}


This also sets your prompt to the current directory!  This was oginally done
by Kenneth Anders with several changes by me...  ENJOY!

--------------------------->8  CUT HERE   8<-----------------------------------
$!    if f$environment("verify_image") then set noverify
$!
$!    Re-define parameter(s).
$!
$    Directory$ = p1
$!
$!    If directory is blank, show current directory.
$!
$   GetDir:
$    if Directory$ .eqs. ""
$    then
$        READ/END_OF_FILE=GetDir/PROMPT="_Directory: " SYS$COMMAND Directory$
$        if Directory$ .eqs. "" 
$        THEN 
$           WRITE SYS$OUTPUT F$DIRECTORY()
$           EXIT
$        ENDIF
$    endif
$!
$!    If a backslash (\) is found as the first directory, replace it with the
$!    root directory.
$!
$    if f$extract(0,1,Directory$) .eqs. "\"
$      then
$        ParentDirectory = f$element(0,".",f$parse("[]",,,"directory")) - "]"
$        Directory$ = Directory$ - "\"
$        if Directory$ .eqs. ""
$          then
$            DirectoryName = ParentDirectory + "]"
$            goto DefinePrompt
$        endif
$        goto SeparateParent&Child
$    endif
$!
$!    If two periods (..) are found as the first directory, replace it with the
$!    parent directory.
$!
$    if f$element(0,"\",Directory$) .eqs. ".."
$      then
$        if f$directory() .eqs. "[000000]"
$          then
$            write sys$output "Invalid directory"
$            exit
$        endif
$        ParentDirectory = f$parse("[-]",,,"directory") - "]"
$        Directory$ = Directory$ - ".." - "\"
$        if Directory$ .eqs. ""
$          then
$            DirectoryName = ParentDirectory + "]"
$            goto DefinePrompt
$        endif
$        goto SeparateParent&Child
$    endif
$!
$!    If one period (.) is found as the first directory, replace it with the
$!    parent directory.
$!
$    if f$element(0,"\",Directory$) .eqs. "."
$      then
$        ParentDirectory = f$logical("sys$login") - "]"
$        Directory$ = Directory$ - "." - "\"
$        if Directory$ .eqs. ""
$          then
$            DirectoryName = ParentDirectory + "]"
$            goto DefinePrompt
$        endif
$        goto SeparateParent&Child
$    endif
$!
$!    If a logical device is not specified, add the current directory in front
$!    of the specified directory.
$!
$    if f$locate(":",Directory$) .eq. f$length(Directory$)
$      then
$        ParentDirectory = f$directory() - "]"
$      else
$        ParentDirectory = f$element(0,":",Directory$) + ":[000000"
$        Directory$ = f$element(1,":",Directory$)
$        if f$element(0,"\",Directory$) .eqs. "000000" then -
           Directory$ = Directory$ - "000000" - "\"
$        if Directory$ .eqs. ""
$          then
$            DirectoryName = ParentDirectory + "]"
$            goto DefinePrompt
$        endif
$    endif
$!
$!    Find parent and child directories.
$!
$ SeparateParent&Child:
$    DirectoryCount = 0
$ FindStructure:
$    if f$element(DirectoryCount + 1,"\",Directory$) .nes. "\"
$      then
$        ParentDirectory = -
           ParentDirectory + "." + f$element(DirectoryCount,"\",Directory$)
$        DirectoryCount = DirectoryCount + 1
$        goto FindStructure
$    endif
$    ChildDirectory = f$element(DirectoryCount,"\",Directory$)
$!
$!    Check to see if the specified directory is valid.  If not valid, write
$!    error message.  If valid, set default to the specified directory.
$!
$    if f$search(ParentDirectory + "]" + ChildDirectory + ".DIR") .eqs. ""
$      then
$        write sys$output "Invalid directory"
$        exit
$    endif
$!
$!    Define directory.
$!
$    DirectoryName = ParentDirectory + "." + ChildDirectory + "]"
$    if f$element(1,"[",f$element(0,".",DirectoryName)) .eqs. "000000" then -
       DirectoryName = DirectoryName - "000000."
$!
$!    Define prompt.
$!
$ DefinePrompt:
$     DirectoryPrompt = ""
$     PromptName = f$element(1,"[",DirectoryName) - "000000" - "]"
$     if PromptName .eqs. "" then goto ChangeDirectory
$     DirectoryCount = 0
$ NextLevel:
$     DirectoryPrompt = -
        DirectoryPrompt + f$element(DirectoryCount,".",PromptName)
$     DirectoryCount = DirectoryCount + 1
$     if f$element(DirectoryCount,".",PromptName) .nes. "."
$       then
$         DirectoryPrompt = DirectoryPrompt + "\"
$         goto NextLevel
$     endif
$!
$!    Set the default and prompt to the specified directory.
$!
$ ChangeDirectory:
$    write sys$output ""
$    set default 'DirectoryName'
$    DirectoryPrompt = f$parse("[]",,,"device") + "\" + DirectoryPrompt
$    if f$length(DirectoryPrompt) .gt. 30
$      then
$        DirectoryPrompt = f$parse("[]",,,"device")
$        write sys$output "Prompt is too long"
$    endif
$    set prompt = "''DirectoryPrompt'> "

