      SUBROUTINE MAIN
      INTEGER UIC, DESC, FOUND, FUIC, D, I, J, LOCAL, JUNK
      LOGICAL*1 FILE(40), DEV(10), BUF(40)
      INTEGER OPENDR, GDRPRM, INDEXS, F11UIC, EQUAL, GETARG
      LOGICAL*1 DOTDIR(5)
      LOGICAL*1 ROOT(8)
      LOGICAL*1 MINUSL(3)
      DATA DOTDIR(1)/46/,DOTDIR(2)/100/,DOTDIR(3)/105/,DOTDIR(4)/114/,DO
     *TDIR(5)/0/
      DATA ROOT(1)/91/,ROOT(2)/48/,ROOT(3)/44/,ROOT(4)/51/,ROOT(5)/55/,R
     *OOT(6)/55/,ROOT(7)/93/,ROOT(8)/0/
      DATA MINUSL(1)/45/,MINUSL(2)/108/,MINUSL(3)/0/
      CALL QUERY(17Husage:  prd [-l].)
      LOCAL = 0
      IF (.NOT.(GETARG(1, DEV, 10) .NE. -1))GOTO 23000
      CALL FOLD(DEV)
      IF (.NOT.(EQUAL(DEV, MINUSL) .EQ. 1))GOTO 23002
      LOCAL = 1
      GOTO 23003
23002 CONTINUE
      CALL REMARK(26HIgnoring invalid argument.)
23003 CONTINUE
23000 CONTINUE
      FOUND = 0
      CALL GETUIC(UIC)
      IF (.NOT.(OPENDR(ROOT, DESC) .NE. -3))GOTO 23004
23006 IF (.NOT.(GDRPRM(DESC, FILE) .NE. -1))GOTO 23007
      I = INDEXS(FILE, DOTDIR)
      IF (.NOT.(I .GT. 0))GOTO 23008
      FILE(I) = 0
      J = 1
      CALL CHCOPY(91, BUF, J)
      CALL STCOPY(FILE, 1, BUF, J)
      CALL CHCOPY(93, BUF, J)
      JUNK = F11UIC(DESC, FUIC)
      IF (.NOT.(FUIC .EQ. UIC))GOTO 23010
      FOUND = 1
      GOTO 23007
23010 CONTINUE
23008 CONTINUE
      GOTO 23006
23007 CONTINUE
23004 CONTINUE
      CALL CLOSDR(DESC)
      IF (.NOT.(FOUND .EQ. 1))GOTO 23012
      CALL TRNDEV(2HSY, 0, DEV)
      CALL FOLD(DEV)
      CALL CONCAT(DEV, BUF, FILE)
      GOTO 23013
23012 CONTINUE
      CALL GWDIR(FILE, 6)
23013 CONTINUE
      IF (.NOT.(LOCAL .EQ. 0))GOTO 23014
      CALL STRCPY(FILE, BUF)
      CALL MKPATH(BUF, FILE)
23014 CONTINUE
      CALL PUTLIN(FILE, 2)
      CALL PUTCH(10, 2)
      RETURN
      END
