      SUBROUTINE MAIN
      LOGICAL*1 ARGS(256), BUF(512), GRP(10), MEM(10)
      LOGICAL*1 DIR(40), UFD(40), PID(7)
      LOGICAL*1 UFDCMD(256)
      LOGICAL*1 CLOWER
      INTEGER JUNK, I, J, INT, DESC
      INTEGER GETARG, SSPAWN, GETWRD, LENGTH, PROMPT, CREATE, OPENDR
      LOGICAL*1 LOCAL(6)
      LOGICAL*1 PART1(12)
      LOGICAL*1 PART2(11)
      LOGICAL*1 PART3(8)
      LOGICAL*1 USESTR(21)
      LOGICAL*1 PSTR(17)
      LOGICAL*1 CMDFIL(15)
      LOGICAL*1 P1(10)
      LOGICAL*1 ROOT(12)
      LOGICAL*1 UFDFMT(7)
      DATA LOCAL(1)/108/,LOCAL(2)/111/,LOCAL(3)/99/,LOCAL(4)/97/,LOCAL(5
     *)/108/,LOCAL(6)/0/
      DATA PART1(1)/112/,PART1(2)/105/,PART1(3)/112/,PART1(4)/32/,PART1(
     *5)/91/,PART1(6)/48/,PART1(7)/44/,PART1(8)/51/,PART1(9)/55/,PART1(1
     *0)/55/,PART1(11)/93/,PART1(12)/0/
      DATA PART2(1)/46/,PART2(2)/100/,PART2(3)/105/,PART2(4)/114/,PART2(
     *5)/61/,PART2(6)/91/,PART2(7)/48/,PART2(8)/44/,PART2(9)/48/,PART2(1
     *0)/93/,PART2(11)/0/
      DATA PART3(1)/46/,PART3(2)/100/,PART3(3)/105/,PART3(4)/114/,PART3(
     *5)/47/,PART3(6)/101/,PART3(7)/110/,PART3(8)/0/
      DATA USESTR(1)/117/,USESTR(2)/115/,USESTR(3)/97/,USESTR(4)/103/,US
     *ESTR(5)/101/,USESTR(6)/58/,USESTR(7)/32/,USESTR(8)/32/,USESTR(9)/1
     *09/,USESTR(10)/107/,USESTR(11)/100/,USESTR(12)/32/,USESTR(13)/110/
     *,USESTR(14)/97/,USESTR(15)/109/,USESTR(16)/101/,USESTR(17)/32/,USE
     *STR(18)/103/,USESTR(19)/44/,USESTR(20)/109/,USESTR(21)/0/
      DATA PSTR(1)/67/,PSTR(2)/111/,PSTR(3)/110/,PSTR(4)/116/,PSTR(5)/10
     *5/,PSTR(6)/110/,PSTR(7)/117/,PSTR(8)/101/,PSTR(9)/32/,PSTR(10)/91/
     *,PSTR(11)/121/,PSTR(12)/47/,PSTR(13)/110/,PSTR(14)/93/,PSTR(15)/32
     */,PSTR(16)/63/,PSTR(17)/0/
      DATA CMDFIL(1)/91/,CMDFIL(2)/48/,CMDFIL(3)/44/,CMDFIL(4)/51/,CMDFI
     *L(5)/55/,CMDFIL(6)/55/,CMDFIL(7)/93/,CMDFIL(8)/109/,CMDFIL(9)/107/
     *,CMDFIL(10)/100/,CMDFIL(11)/46/,CMDFIL(12)/99/,CMDFIL(13)/109/,CMD
     *FIL(14)/100/,CMDFIL(15)/0/
      DATA P1(1)/117/,P1(2)/102/,P1(3)/100/,P1(4)/32/,P1(5)/115/,P1(6)/1
     *21/,P1(7)/48/,P1(8)/58/,P1(9)/91/,P1(10)/0/
      DATA ROOT(1)/115/,ROOT(2)/121/,ROOT(3)/48/,ROOT(4)/58/,ROOT(5)/91/
     *,ROOT(6)/48/,ROOT(7)/44/,ROOT(8)/51/,ROOT(9)/55/,ROOT(10)/55/,ROOT
     *(11)/93/,ROOT(12)/0/
      DATA UFDFMT(1)/117/,UFDFMT(2)/102/,UFDFMT(3)/100/,UFDFMT(4)/32/,UF
     *DFMT(5)/37/,UFDFMT(6)/115/,UFDFMT(7)/0/
      CALL QUERY(USESTR)
      IF (.NOT.(GETARG(1, DIR, 40) .EQ. -1))GOTO 23000
      CALL ERROR(USESTR)
23000 CONTINUE
      IF (.NOT.(GETARG(2, UFD, 40) .EQ. -1))GOTO 23002
      CALL ERROR(USESTR)
23002 CONTINUE
      IF (.NOT.(OPENDR(ROOT, DESC) .EQ. -3))GOTO 23004
      CALL SPRINT(UFDCMD, UFDFMT, ROOT)
      CALL PUTLNL(UFDCMD, 2)
      JUNK = PROMPT(PSTR, BUF, 1)
      IF (.NOT.(CLOWER(BUF(1)) .NE. 121))GOTO 23006
      RETURN
23006 CONTINUE
      JUNK = SSPAWN(LOCAL, UFDCMD, PID, 119)
      GOTO 23005
23004 CONTINUE
      CALL CLOSDR(DESC)
23005 CONTINUE
      CALL SPRINT(ARGS, 8Hsy0:[%s], UFD)
      IF (.NOT.(OPENDR(ARGS, DESC) .EQ. -3))GOTO 23008
      CALL SPRINT(UFDCMD, UFDFMT, ARGS)
      CALL PUTLNL(UFDCMD, 2)
      JUNK = PROMPT(PSTR, BUF, 1)
      IF (.NOT.(CLOWER(BUF(1)) .NE. 121))GOTO 23010
      RETURN
23010 CONTINUE
      JUNK = SSPAWN(LOCAL, UFDCMD, PID, 119)
      GOTO 23009
23008 CONTINUE
      CALL CLOSDR(DESC)
23009 CONTINUE
      I = INDEXC(UFD, 44)
      IF (.NOT.(I .EQ. 0))GOTO 23012
      CALL ERROR(USESTR)
23012 CONTINUE
      UFD(I) = 32
      I = 1
      JUNK = GETWRD(UFD, I, GRP)
      JUNK = GETWRD(UFD, I, MEM)
      I = 1
      CALL STCOPY(PART1, 1, ARGS, I)
      CALL STCOPY(DIR, 1, ARGS, I)
      CALL STCOPY(PART2, 1, ARGS, I)
      J=LENGTH(GRP)+1
23014 IF (.NOT.(J .LE. 3))GOTO 23016
      CALL CHCOPY(48, ARGS, I)
23015 J=J+1
      GOTO 23014
23016 CONTINUE
      CALL STCOPY(GRP, 1, ARGS, I)
      J=LENGTH(MEM)+1
23017 IF (.NOT.(J .LE. 3))GOTO 23019
      CALL CHCOPY(48, ARGS, I)
23018 J=J+1
      GOTO 23017
23019 CONTINUE
      CALL STCOPY(MEM, 1, ARGS, I)
      CALL STCOPY(PART3, 1, ARGS, I)
      CALL PUTLNL(ARGS, 2)
      IF (.NOT.(PROMPT(PSTR, BUF, 1) .NE. -1))GOTO 23020
      IF (.NOT.(CLOWER(BUF(1)) .EQ. 121))GOTO 23022
      JUNK = SSPAWN(LOCAL, ARGS, PID, 119)
      INT = CREATE(CMDFIL, 4)
      IF (.NOT.(INT .EQ. -3))GOTO 23024
      CALL ERROR(45HError appending pip command to [0,377]mkd.cmd)
      GOTO 23025
23024 CONTINUE
      CALL PUTLIN(ARGS, INT)
      CALL PUTCH(10, INT)
      CALL CLOSE(INT)
23025 CONTINUE
23022 CONTINUE
23020 CONTINUE
      RETURN
      END
