* * $Id: hcdir.F,v 1.1.1.1 1996/01/16 17:07:33 mclareni Exp $ * * $Log: hcdir.F,v $ * Revision 1.1.1.1 1996/01/16 17:07:33 mclareni * First import * * #include "hbook/pilot.h" *CMZ : 4.22/03 19/05/94 14.31.24 by Rene Brun *-- Author : SUBROUTINE HCDIR(CHPATH,CHOPT) *.==========> *. To set,read or print the Current Working Directory *. Input: *. *CHPATH* Character variable specifying the pathname of the CWD *. (default option). *. The top level directory is //PAWC. When the pathname does *. not start with a '/', the pathname is prefixed with the path *. of the CWD. *. CHOPT Character variable specifying the option *. 'R' Read the CWD pathname into CHPATH *. 'P' Print the CWD *. ' ' Set the CWD *. Output: *. *CHPATH* Character variable containing the complete pathname of the *. current working directory (with 'R' option only). *..=========> ( R.Brun ) #include "hbook/hcbook.inc" #include "hbook/hcflag.inc" #include "hbook/hcunit.inc" #include "hbook/hcdire.inc" #include "hbook/hcmail.inc" #include "hbook/hcpiaf.inc" #include "hbook/czsock.inc" * COMMON/QUEST/IQUEST(100) * CHARACTER*2 NODIR PARAMETER (NODIR = '@#') CHARACTER*128 CHAIN, CACHE DIMENSION IOPTV(2),IHDIR(4) EQUIVALENCE (IOPTR,IOPTV(1)), (IOPTP,IOPTV(2)) CHARACTER*(*) CHPATH,CHOPT * SAVE CACHE DATA CACHE /NODIR/ *.___________________________________________ IF(LHBOOK.EQ.0)GO TO 99 CALL HUOPTC (CHOPT,'RP',IOPTV) * * Read Working directory * IF(IOPTR.NE.0)THEN CALL HPAFF(CHCDIR,NLCDIR,CHPATH) GO TO 99 ENDIF * * Print Working directory * IF(IOPTP.NE.0)THEN CALL HPAFF(CHCDIR,NLCDIR,CHMAIL) WRITE(LOUT,1000)CHMAIL(1:90) 1000 FORMAT(' Current Working Directory = ',A) GO TO 99 ENDIF * * Set Working directory * IQUEST(1)=0 IF(CHPATH(1:1).EQ.'.')THEN CALL HPATH(' ') ELSE CALL HPATH(CHPATH) ENDIF * IF(NLPAT.LE.0)GO TO 99 * ICDOLD=ICDIR ICDIR=1 DO 10 I=1,NCHTOP IF(CHPAT(1).EQ.CHTOP(I))THEN ICDIR=I IF(ICHTOP(I).GT.0)THEN * *-- 200