!*************************** AMUS Program Label ******************************
! Filename: FIXDIR.BAS                                      Date: 02/01/90
! Category: UTIL         Hash Code: 576-075-752-255      Version: 89.11H(7)
! Initials: MKE/AM       Name: DAVID W. BARROW III
! Company: STONEWALL COMPUTER CENTER               Telephone #: 4143752667
! Related Files: FIXDIR.DOC
! Min. Op. Sys.: AMOS/L 1.3                    Expertise Level: BEG
! Special:
! Description: Updates a directory listing (as used with the VERIFY command)
! to the current version and hash totals.
!
!*****************************************************************************
!       FIXDIR.BAS
!       WRITTEN by      DAVID W. BARROW III
!               at      STONEWALL COMPUTER CENTER
!                       1894 Elm Drive, Town of Cedarburg
!                       West Bend, WI 53095
!                       Telephone (414) 375-AMOS
!               on      JANUARY 22, 1988
!
!       FIXDIR  (1) makes a copy of a directory file; (2) VERIFYs it;
!               (3) makes a list of the non-verified files; (4) Makes a
!               .CMD file to get the existing file specifications;
!               (5) gets the version and hash of those changed files from
!               the system; (6) presents the old and new data and asks if
!               you want the data updated; (7) Cleans up the work files.
!
!       FIXDIR does NOT modify the directory being updated without permission!
!
!       MODIFICATION HISTORY
!   Date   R    Who     What
!----------     ---     ----------------------------------------------
! 01-24-88 B    DWB     Added Screen info for user
! 01-26-88 C    DWB     Added Comments to new directory
!                       Took care of "not found" files
! 01-30-88 D    DWB     Minor cleanup
! 02-23-88 E    DWB     Fixed erase loop and remote file format
! 04-05-88 F    DWB     Fixed .dir default
! 06-24-89 G    DWB     Extended comment to accomodate new dir format
! 11-07-89 H    DWB     Accomodate two digit logicals
!                       Accomodate different .DIR spacing
!
01000
01010 PROGRAM FIXDIR,89.11H(07)
01020
01030 MAP1      CONTINUE,S,1,"N"        ! Answer to "Do you wish to continue?"
01040 MAP1      COUNTER,F,6,0           ! Loop counter
01050 MAP1      DIRNAM,S,10             ! Name of directory file to be updated
01060 MAP1      DSTRING,S,45            ! Used by ODTIM xcall
01070 MAP1      FILNAM,S,12             ! nmaes/files accessed by this program
01080 MAP1      EXIST,F,6,0             ! Lookup answer
01090 MAP1      OVER'WRITE,S,180        ! WARNING
01100 MAP1      Q$,S,1,CHR$(34)         ! Puts a quote in output file
01110 MAP1      RUN'DATE,S,25           ! Put run date into generated programs
01120 MAP1      SPEC'END,F,6,0          ! Position of end of file'specification
01130 MAP1      T$,S,1,CHR$(9)          ! Puts a tab in output file
01140
! Get the date from the system and construct PROGRAM syntax
01150   XCALL ODTIM, DSTRING,0,0,840    ! Get date as MM/DD/YY
01160   RUN'DATE = "PROGRAM " + "UTFDPx" + "," + DSTRING[7,8] + "."     &
               + DSTRING[1,2] + "A(" + DSTRING[4,5] + ")"
01170
! Let the user know what is going on
01180   PRINT TAB(-1,0)                 ! Clear the screen
01190   PRINT TAB(01,01); "FIXDIR - A program to update a .DIR file ";  &
               "with the current version and hash"
01200   PRINT TAB(03,01); "     Written by David W. Barrow III at ";    &
               "STONEWALL COMPUTER CENTER"
01210   PRINT TAB(04,01); "           1894 Elm Drive, Town of ";        &
               "Cedarburg, West Bend, WI 53095"
01220   PRINT TAB(05,01); "                          Telephone ";       &
               "(414) 375-AMOS"
01230
01240   PRINT TAB(07,01); "FIXDIR will take any directory "             &
               "created using 'DIR/D/H/V filnam.ext='"
01250   PRINT TAB(08,36); "AND THEN"
01260   PRINT TAB(09,05); "Phase 1 - Makes a copy of the directory file"
01270   PRINT TAB(10,05); "Phase 2 - Verifies the copy"
01280   PRINT TAB(11,05); "Phase 3 - Eliminates the 'VERIFIED' and ";   &
               "'File not found' entries"
01290   PRINT TAB(12,05); "Phase 4 - Makes a .CMD file to get current "; &
               "version and hash data"
01300   PRINT TAB(13,05); "Phase 5 - Gets that data"
01310   PRINT TAB(14,05); "Phase 6 - Asks if you want the current data"; &
               " substituted for EACH change"
01320   PRINT TAB(15,05); "Phase 7a - Asks if you want the newly "      &
               "constructed directory file "
01330   PRINT TAB(16,15); "to replace the old one"
01340   PRINT TAB(17,05); "Phase 7b - Asks if you want the work files erased"
01350   PRINT TAB(19,01); "UNTIL PHASE 7 NONE OF YOUR FILES HAVE BEEN " &
               "MODIFIED!"
01360   PRINT TAB(22,01);
01370   STOP
01380
01390   PRINT TAB(07,01); TAB(-1,10)
01400   PRINT TAB(07,01); "What is the name of the directory to be ";   &
               "updated? (def=AMOS.DIR) ";
01410   INPUT ""; DIRNAM
01420   DIRNAM = UCS(DIRNAM)
01430   XCALL STRIP, DIRNAM
01440           IF      ( LEN(DIRNAM) = 0 )                             &
               THEN    DIRNAM = "AMOS"                         ! 04-05-88
01450   SPEC'END = INSTR(1,DIRNAM,".")
01460           IF      ( SPEC'END = 0 )                                &
               THEN    DIRNAM = DIRNAM + ".DIR"
01470
! Abort if VERIFY.LIT doesn't exist
01480   LOOKUP "DSK0:VERIFY.LIT[1,4]", EXIST
01490           IF      ( EXIST < 1 )                                   &
               THEN    PRINT TAB(09,10); "I can't work without ";      &
                               "DSK0:VERIFY.LIT[1,4] - Sorry"          &
                       : END
01500
! Abort if the directory doesn't exist
01510   LOOKUP DIRNAM, EXIST
01520           IF      ( EXIST < 1 )                                   &
               THEN    PRINT TAB(09,10); "Fatal error -  ";            &
                               "I can't find "; DIRNAM                 &
                       : END
01530
! Check to see if any name conflicts
01540   DATA "UTFDP1.CMD","UTFDP1.DIR","UTFDP3.BAS","UTFDP3.LST"
01550   DATA "UTFDP3.RUN","UTFDP4.BAS","UTFDP4.RUN","UTFDP5.CMD"
01560   DATA "UTFDP5.DIR","UTFDP5.LST","UTFDP6.BAS","UTFDP6.RUN"
01570   DATA "UTFDP7.BAS","UTFDP7.CMD","FIXDIR.DIR","UTFDP7.RUN"
01580   DATA "VERIFY.LST"
01590
01600   FOR COUNTER = 1 TO 17
01610           READ FILNAM
01620           LOOKUP FILNAM, EXIST
01630           ! Put in the commas between file names
01640                   IF      ( EXIST <> 0 )                          &
                       THEN    IF      ( LEN(OVER'WRITE) > 2)          &
                               THEN    OVER'WRITE = OVER'WRITE + ", "
01650           ! Put in the file names that will be over written
01660                   IF      ( EXIST <> 0 )                          &
                       THEN    OVER'WRITE = OVER'WRITE + FILNAM
01670   NEXT COUNTER
01680
01690           IF      ( LEN(OVER'WRITE) > 2 )                         &
               THEN    PRINT; CHR(7)                                   &
                       : PRINT; "WARNING!  The following files WILL "; &
                               "be overwritten: "; OVER'WRITE          &
                       : PRINT                                         &
                       : PRINT; "Do you wish to continue? (def=N) ";   &
                       : INPUT ""; CONTINUE                            &
                       : IF    ( UCS(CONTINUE) <> "Y" )                &
                         THEN  END
01700
! PHASE1:
01710   PRINT TAB(08,01); TAB(-1,10)
01720   PRINT; "Phase 1 of FIXDIR - Create necessary files"
01730   OPEN #1, "UTFDP1.CMD", OUTPUT
01740   PRINT #1; "; UTFDP1.CMD - PHASE 1 and 2 of FIXDIR"
01750   PRINT #1; "; "; RUN'DATE
01760   PRINT #1
01770   PRINT #1; "; Compile the Basic files"
01780   PRINT #1; "COMPIL UTFDP3.BAS"
01790   PRINT #1; "COMPIL UTFDP4.BAS"
01800   PRINT #1; "COMPIL UTFDP6.BAS"
01810   PRINT #1; "COMPIL UTFDP7.BAS"
01820   PRINT #1
01830   PRINT #1; "; Copy the directory so we can't damage anything"
01840   PRINT #1; "COPY UTFDP1.DIR = "; DIRNAM
01850   PRINT #1
01860   PRINT #1; "; Let the user know what FIXDIR is doing"
01870   PRINT #1; ":< Phase 2 of FIXDIR - Verify the Directory to a file"
01880   PRINT #1; ">"
01890   PRINT #1; "VERIFY/F UTFDP1.DIR"
01900   PRINT #1; ":R"
01910   PRINT #1; "; Chain to the next step"
01920   PRINT #1; "RUN UTFDP3"
01930   CLOSE #1
01940
! PHASE 3 takes the file produced by VERIFY and eliminates those that are OK
01950   OPEN #2, "UTFDP3.BAS", OUTPUT
01960   PRINT #2; T$; "!        UTFDP3.BAS - PHASE 3 OF FIXDIR"
01970   PRINT #2; T$; "!        Takes VERIFY.LST and prints those ";    &
               "changed to UTFDP3.LST"
01980   PRINT #2; T$; "!        This is a temporary file - You may erase it."
01990   PRINT #2; T$; "!"
02000   PRINT #2
02010   RUN'DATE = RUN'DATE[1,13] + "3" + RUN'DATE[15,25]       ! Fix pgmnam
02020   PRINT #2; T$; RUN'DATE
02030   PRINT #2
02040   PRINT #2; T$; "PRINT; "; Q$; "  Phase 3 of FIXDIR - ";          &
               "Eliminate the 'VERIFIED' "; Q$ ; ";"
02050   PRINT #2; T$; "PRINT; "; Q$; "and 'not found' files"; Q$
02060   PRINT #2
02070   PRINT #2; T$; "MAP1     COUNTER,F,6,0           ! Error count"
02072   PRINT #2; T$; "MAP1     EXIST,F,6,0             ! LOOKUP answer"
02074   PRINT #2; T$; "MAP1     FILNAM,S,10             ! Variable for DATA"
02080   PRINT #2; T$; "MAP1     INLINE,S,90             ! Line from VERIFY.LST"
02090   PRINT #2
02100   PRINT #2; T$; "OPEN #3, "; Q$; "VERIFY.LST"; Q$; ", INPUT"
02110   PRINT #2; T$; "OPEN #4, "; Q$; "UTFDP3.LST"; Q$; ", OUTPUT"
02120   PRINT #2
02130   PRINT #2; "PHASE3:"
02140   PRINT #2; T$; "INPUT LINE #3, INLINE"
02150   PRINT #2; T$; T$; "IF"; T$; "( EOF(3) <> 0 )"; T$; T$; T$; T$; T$; "&"
02160   PRINT #2; T$; T$; "THEN"; T$; "GOTO EXIT3"; T$; T$; T$;         &
               "! Check for EOF"
02170   PRINT #2; T$; T$; "IF"; T$; "( INSTR(1,INLINE,";                &
               Q$; "VERIFIED"; Q$; ") <> 0 )"; T$; T$; "&"
02180   PRINT #2; T$; T$; "THEN"; T$; "GOTO PHASE3"; T$; T$;            &
               T$; "!If OK don't fix"
02190   PRINT #2; T$; T$; "IF"; T$; "( INSTR(1,INLINE,";                &
               Q$; "not found"; Q$; ") <> 0 )"; T$; T$; "&"
02195   PRINT #2; T$; T$; "THEN"; T$; "GOTO PHASE3"; T$; T$; T$;        &
               "! Can't update"
02200   PRINT #2; T$; T$; "IF"; T$; "( INSTR(1,INLINE,";                &
               Q$; "Total "; Q$; ") <> 0 )"; T$; T$; "&"
02204   PRINT #2; T$; T$; "THEN"; T$; "COUNTER = COUNTER - 1"; T$; T$;  &
                       T$; T$ "&"
02206   PRINT #2; T$; T$; T$; ": GOTO EXIT3"
02210   PRINT #2; T$; "PRINT #4, INLINE"
02220   PRINT #2; T$; "COUNTER = COUNTER + 1"
02230   PRINT #2; T$; "GOTO PHASE3"
02240   PRINT #2
02250   PRINT #2; "EXIT3:"
02260   PRINT #2; T$; "CLOSE #3"
02270   PRINT #2; T$; "CLOSE #4"
02280   PRINT #2; T$; T$; "IF"; T$; "( COUNTER = 0 )"; T$; T$; T$;      &
               T$; T$; "&"
02290   PRINT #2; T$; T$; "THEN"; T$; "PRINT"; T$; T$; T$; T$; T$; T$; "&"
02300   PRINT #2; T$; T$; T$; ": PRINT TAB(20); "; Q$; "CONGRATULATIONS!"; &
               Q$; T$; T$; "&"
02310   PRINT #2; T$; T$; T$; ": PRINT; "; Q$; "Your Directory matches "; &
               "the files "; Q$; ";"; T$; "&"
02320   PRINT #2; T$; T$; T$; T$; Q$; "on your system"; Q$; T$; T$; T$; T$; "&"
02330   PRINT #2; T$; T$; T$; ": PRINT TAB(15); "; Q$; "Have a GOOD day!"; &
               Q$; T$; T$; "&"
02340   PRINT #2; T$; T$; T$; ": CALL CLEAN'EM"; T$; T$; T$; T$; T$; "&"
02350   PRINT #2; T$; T$; "ELSE"; T$; "CHAIN "; Q$; "UTFDP4"; Q$
02360   PRINT #2; T$; "END"
02370   PRINT #2
02380   PRINT #2; "CLEAN'EM:"
02390   PRINT #2; T$; "DATA UTFDP1.CMD,UTFDP1.DIR,UTFDP3.BAS,UTFDP3.LST"
02400   PRINT #2; T$; "DATA UTFDP3.RUN,UTFDP4.BAS,UTFDP4.RUN,UTFDP5.CMD"
02410   PRINT #2; T$; "DATA UTFDP5.DIR,UTFDP5.LST,UTFDP6.BAS,UTFDP6.RUN"
02420   PRINT #2; T$; "DATA UTFDP7.BAS,UTFDP7.CMD,UTFDP7.RUN,VERIFY.LST"
02430   PRINT #2
02440   PRINT #2; T$; "FOR COUNTER = 1 TO 16"
02450   PRINT #2; T$; T$; "READ FILNAM"
02460   PRINT #2; T$; T$; "LOOKUP FILNAM, EXIST"
02462   PRINT #2; T$; T$; T$; "IF"; T$; "( EXIST <> 0 )"; T$; T$; T$; "&"
02464   PRINT #2; T$; T$; T$; "THEN"; T$; "KILL FILNAM"
02470   PRINT #2; T$; "NEXT COUNTER"
02480   PRINT #2; T$; "RETURN"
02490   PRINT #2
02500   PRINT #2; "!"; T$; "*"; T$; "**"; T$; "***"; T$;                &
               "End of UTFDP3.BAS"; T$; "***"; T$; "**"; T$; "*"
02510   CLOSE #2
02520
! PHASE 4 MAKES A .CMD FILE TO FIND NEW FILE INFO
!       I realize that Phase 4 could be combined with Phase 3
02530
02540   OPEN #5, "UTFDP4.BAS", OUTPUT
02550   PRINT #5; T$; "!        UTFDP4.BAS - Phase 4 of FIXDIR"
02560   PRINT #5; T$; "!        Creates a command file to get current "; &
               "filspecs"
02570   PRINT #5; T$; "!        This is a temporary file - You may erase it."
02580   PRINT #5; T$; "!"
02590   PRINT #5
02600   RUN'DATE = RUN'DATE[1,13] + "4" + RUN'DATE[15,25]       ! Fix pgmnam
02610   PRINT #5
02620   PRINT #5; T$; RUN'DATE
02630   PRINT #5
02640   PRINT #5; T$; "MAP1     INLINE,S,80"
02650   PRINT #5; T$; "MAP1     SPEC'END,F,6,0"
02660   PRINT #5
02670   PRINT #5; T$; "OPEN #4, "; Q$; "UTFDP3.LST"; Q$; ", INPUT"
02680   PRINT #5; T$; "OPEN #6, "; Q$; "UTFDP5.CMD"; Q$; ", OUTPUT"
02690   PRINT #5
02700   PRINT #5; T$; "PRINT; "; Q$; "   Phase 4 of FIXDIR - Create ";  &
                       "a command file to get current file info"; Q$
02710   PRINT #5
02720   PRINT #5; T$; "! Put in some header information"
02730   PRINT #5; T$; "PRINT #6; "; Q$; ";      UTFDP5.CMD - ";         &
               "Gets current file info"; Q$
02740   PRINT #5; T$; "PRINT #6; "; Q$; ";      "; RUN'DATE[16,25]; Q$
02750   PRINT #5; T$; "PRINT #6; "; Q$; ";      This is a temporary ";  &
               "file - You may erase it"; Q$
02760   PRINT #5; T$; "PRINT #6"
02770   PRINT #5; T$; "PRINT #6; "; Q$; ":R"; Q$
02780   PRINT #5; T$; "PRINT #6; "; Q$;                                 &
               ":<    Phase 5 of FIXDIR - Get the current file info "; Q$
02790   PRINT #5; T$; "PRINT #6; "; Q$; ">"; Q$
02800   PRINT #5
02810   PRINT #5; T$; "! Create the Phase 5 output file"
02820   PRINT #5; T$; "OPEN #7, "; Q$; "UTFDP5.DIR"; Q$; ", OUTPUT"
02830   PRINT #5; T$; "CLOSE #7"
02840   PRINT #5; "PHASE4:"
02850   PRINT #5; T$; "INPUT LINE #4, INLINE"
02860   PRINT #5; T$; T$; "IF"; T$; "( EOF(4) <> 0 )"; T$; T$; T$; T$; T$; "&"
02870   PRINT #5; T$; T$; "THEN"; T$; "GOTO EXIT4"
02880   PRINT #5; T$; "! Can't get info if file not there"
02890   PRINT #5; T$; "SPEC'END = INSTR(1,INLINE,"; Q$;         &
               "?File not found"; Q$; ")"
02900   PRINT #5; T$; T$; "IF"; T$; "( SPEC'END <> 0 )"; T$; T$; T$; T$; "&"
02910   PRINT #5; T$; T$; "THEN"; T$; "GOTO PHASE4"
02920   PRINT #5; T$; T$; "IF"; T$; "( INLINE[1,30] = SPACE(30) )";     &
               T$; T$; T$; "&"
02930   PRINT #5; T$; T$; "THEN"; T$; "GOTO EXIT4"
02940   PRINT #5; T$; "SPEC'END = INSTR(1,INLINE,"; Q$; "]"; Q$; ")"
02950   PRINT #5; T$; "PRINT #6; "; Q$; "DIR/D/H/V/K UTFDP5.LST="; Q$;  &
               ";"; " INLINE[1,SPEC'END]"
02960   PRINT #5; T$; "PRINT #6; "; Q$; "APPEND UTFDP5.DIR ";           &
               "= UTFDP5.DIR, UTFDP5.LST"; Q$
02970   PRINT #5; T$; "GOTO PHASE4"
02980   PRINT #5
02990   PRINT #5; "EXIT4:"
03000   PRINT #5; T$; "CLOSE #4"
03010   PRINT #5; T$; "PRINT #6; "; Q$; "RUN UTFDP6"; Q$
03020   PRINT #5; T$; "CLOSE #6"
03030   PRINT #5; T$; "CHAIN "; Q$; "UTFDP5.CMD"; Q$
03040   PRINT #5; T$; "END"
03050   PRINT #5
03060   PRINT #5; "!"; T$; "*"; T$; "**"; T$; "***"; T$;                &
               "End of UTFDP4.BAS"; T$; "***"; T$; "**"; T$; "*"
03070   CLOSE #5
03080
! PHASE 6 matches the old directory with current info and allows substitution
03090
03100   OPEN #10, "UTFDP6.BAS", OUTPUT
03110   PRINT #10; T$; "!       UTFDP6.BAS - Update directory copy"
03120   PRINT #10; T$; "!       This is a temporary file - You may erase it."
03130   PRINT #10; T$; "!"
03140   PRINT #10
03150   RUN'DATE = RUN'DATE[1,13] + "6" + RUN'DATE[15,25]       ! Fix pgmnam
03160   PRINT #10; T$; RUN'DATE
03170   PRINT #10
03180   PRINT #10; T$; "MAP1    CHANGED,F,6,0"; T$; T$;                 &
               "! Count #/changed files"
03200   PRINT #10; T$; "MAP1    CMNT(3),S,12"; T$; T$; "! Comment ";    &
               "lines for new .DIR"
03210   PRINT #10; T$; "MAP1    COUNTER,F,6,0"; T$; T$;                 &
               "! Ck L# for comment"
03212   PRINT #10; T$; "MAP1    DSTRING,S,45"; T$; T$; "! Used by ODTIM.SBR"
03214   PRINT #10; T$; "MAP1    NEW'COLON,F,6,0"; T$; T$;               &
               "! Check for two digit logical number"
03216   PRINT #10; T$; "MAP1    NEW'LEN,F,6"; T$; T$;                   &
               "! Get the length of the new line entry"
03220   PRINT #10; T$; "MAP1    NEW'LINE,S,100"; T$; T$;                &
               "! Hold a line for FIXDIR.DIR"
03230   PRINT #10; T$; "MAP1    NO'UPDATE,F,6,0"; T$; T$;               &
               "! Count those not updated"
03232   PRINT #10; T$; "MAP1    OLD'COLON,F,6,0"; T$; T$;               &
               "! Check for two digit logical number"
03234   PRINT #10; T$; "MAP1    OLD'LEN,F,6"; T$; T$;                   &
               "! Get the length of the old line entry"
03240   PRINT #10; T$; "MAP1    OLD'LINE,S,72"; T$; T$;                 &
               "! Hold a line from UTFDP1.DIR"
03250   PRINT #10; T$; "MAP1    PRINT'LINE,S,100,0"; T$;                &
               "! Output line"
03260   PRINT #10; T$; "MAP1    SPEC'END,F,6,0"; T$; T$;                &
               "! Pos/end of file'spec"
03270   PRINT #10; T$; "MAP1    SUBSTITUTE,S,1"; T$; T$; "! Y/N"
03280   PRINT #10
03281   PRINT #10; T$; "! Check length of logical name"
03282   PRINT #10; T$; "OPEN #8, "; Q$; "UTFDP1.DIR"; Q$;               &
               ", INPUT"; T$; T$; T$;"! Old directory"
03283   PRINT #10; T$; "INPUT LINE #8, OLD'LINE"
03284   PRINT #10; T$; "OLD'COLON = INSTR(1,OLD'LINE,"; Q$; ":"; Q$;    &
                       ")"; T$; T$; "! Check len/logical#"
03285   PRINT #10; T$; "CLOSE #8"
03286   PRINT #10
03292   PRINT #10; T$; "OPEN #4, "; Q$; "UTFDP5.DIR"; Q$;               &
               ", INPUT"; T$; T$; T$;"! New directory"
03293   PRINT #10; T$; "INPUT LINE #4, NEW'LINE"
03294   PRINT #10; T$; "NEW'COLON = INSTR(1,NEW'LINE,"; Q$; ":"; Q$;    &
                       ")"; T$; T$; "! Check len/logical#"
03295   PRINT #10; T$; "CLOSE #4"
03296   PRINT #10
03298   PRINT #10; T$; "OPEN #8, "; Q$; "UTFDP1.DIR"; Q$;               &
               ", INPUT"; T$; T$; T$;"! Old directory"
03300   PRINT #10; T$; "OPEN #4, "; Q$; "UTFDP5.DIR"; Q$;               &
               ", INPUT"; T$; T$; T$; "! C
urrent info"
03310   PRINT #10; T$; "OPEN #9, "; Q$; "FIXDIR.DIR"; Q$;               &
               ", OUTPUT"; T$; T$; T$; "! Merge file"
03320   PRINT #10
03330   PRINT #10; T$; "PRINT; "; Q$; "     Phase 6 of FIXDIR - ";      &
               "updates the directory copy"; Q$
03340   PRINT #10
03350   PRINT #10; T$; "CMNT(1) = "; Q$; " ; Revised"; Q$
03360   PRINT #10; T$; "! Get the current date"
03370   PRINT #10; T$; "XCALL ODTIM, DSTRING,0,0,840"; T$; T$; T$;      &
               "! MM/DD/YY DATE"
03380   PRINT #10; T$; "CMNT(2) = "; Q$; " ; "; Q$; " + DSTRING"
03390   PRINT #10; T$; "XCALL ODTIM, DSTRING,0,0,2049"; T$; T$; T$;     &
               "! TIME"
03400   PRINT #10; T$; "CMNT(3) = "; Q$; " ; "; Q$; " + DSTRING"
03410   PRINT #10; T$; "COUNTER = 0"
03420   PRINT #10
03430   PRINT #10; "PHASE6A:"
03440   PRINT #10; T$; "INPUT LINE #4, NEW'LINE"; T$; T$; T$;           &
               "! Get a line of the new info"
03450   PRINT #10; T$; T$; "IF"; T$; "( EOF(4) <> 0 )"; T$; T$; T$;     &
               T$; T$; "&"
03460   PRINT #10; T$; T$; "THEN"; T$; "GOTO GET'REST"; T$; T$;         &
                       "! Check for end-of-file"
03462   PRINT #10; T$; T$; "IF"; T$; "( OLD'COLON = 6 )"; T$; T$; T$;   &
                       T$; "&"
03464   PRINT #10; T$; T$; "AND"; T$; "( NEW'COLON = 5 )"; T$; T$; T$;  &
                       T$; "&"
03466   PRINT #10; T$; T$; "THEN"; T$; "NEW'LINE = NEW'LINE[1,3] "      &
               "+ "; Q$; "0"; Q$; " + NEW'LINE[4,100] &"
03470   PRINT #10; T$; T$; T$; ": SPEC'END = INSTR(1,NEW'LINE,";                &
                       Q$; "]"; Q$; ")"; T$; T$; "&"
03473   PRINT #10; T$; T$; T$; ": NEW'LINE = NEW'LINE[1,SPEC'END]"      &
                       T$; T$; "&"
03474   PRINT #10; T$; T$; T$; T$; T$; "+ NEW'LINE[SPEC'END+2,100]"
03476   PRINT #10; T$; "SPEC'END = INSTR(1,NEW'LINE,"; Q$; "]"; Q$; ")"
03480   PRINT #10; T$; "CHANGED = CHANGED + 1"
03490   PRINT #10
03500   PRINT #10; "PHASE6B:"
03510   PRINT #10; T$; "INPUT LINE #8, OLD'LINE"
03520   PRINT #10; T$; T$; "IF"; T$; "( EOF(8) <> 0 )"; T$; T$; T$;     &
               T$; T$; "&"
03530   PRINT #10; T$; T$; "THEN"; T$; "GOTO EXIT4"; T$; T$;            &
               "! Check for End of File"
03532   PRINT #10; T$; T$; "IF"; T$; "( NEW'COLON = 6 )"; T$; T$; T$;   &
               T$; T$; "&"
03534   PRINT #10; T$; T$; "AND"; T$; "( OLD'COLON = 5 )"; T$; T$; T$;  &
               T$; T$; "&"
03536   PRINT #10; T$; T$; "THEN"; T$; "OLD'LINE = OLD'LINE[1,3] "      &
               "+ "; Q$; "0"; Q$; T$; T$; T$; "&"
03538   PRINT #10; T$; T$; T$; T$; T$; "+ OLD'LINE[4,100]"
03540   PRINT #10; T$; T$; "IF"; T$; "( OLD'LINE[1,SPEC'END] ";         &
               "<> NEW'LINE[1,SPEC'END] ) &"
03550   PRINT #10; T$; T$; "THEN"; T$; "PRINT'LINE = OLD'LINE"; T$;     &
               T$; T$; T$; "&"
03560   PRINT #10; T$; T$; T$; ": CALL PRINT'ONE"; T$; T$; T$; T$; "&"
03570   PRINT #10; T$; T$; T$; ": GOTO PHASE6B"; T$;                    &
               "! If it ain't broke don't fix it"
03580   PRINT #10; T$; "SUBSTITUTE = "; Q$; "N"; Q$
03590   PRINT #10; T$; "PRINT TAB(16,01); TAB(-1,10);"
03600   PRINT #10; T$; "PRINT TAB(20); "; Q$; "old directory shows:"; Q$
03610   PRINT #10; T$; "PRINT; OLD'LINE"
03611   PRINT #10; T$; T$; "IF"; T$; "( CHR(OLD'LINE[56,56]) <> 32 )";  &
                       T$; T$; T$; "&"
03612   PRINT #10; T$; T$; "AND"; T$; "( CHR(NEW'LINE[56,56]) <> 32 )"; &
                       T$; T$; T$; "&"
03613   PRINT #10; T$; T$; "THEN"; T$; "XCALL STRIP, NEW'LINE";         &
                       T$; T$; T$; T$; "&"
03614   PRINT #10; T$; T$; T$; ": NEW'LEN = LEN(NEW'LINE)";             &
                       T$; T$; T$; "&"
03615   PRINT #10; T$; T$; T$; ": NEW'LINE = NEW'LINE[1,30] ";          &
                       "+ NEW'LINE[39,56]"; T$; "&"
03616   PRINT #10; T$; T$; T$; T$; T$; "+ CHR(32) + NEW'LINE[57,NEW'LEN+1]"
03620   PRINT #10; T$; "PRINT TAB(20); "; Q$; "file on system is:"; Q$
03630   PRINT #10; T$; "PRINT; NEW'LINE"
03640   PRINT #10; T$; "PRINT"
03650   PRINT #10; T$; "INPUT "; Q$;                                    &
               "Do you want to update this one? (Y/N) (def=N) "; Q$;   &
               ", SUBSTITUTE"
03660   PRINT #10; T$; "SUBSTITUTE = UCS(SUBSTITUTE)"
03670   PRINT #10; T$; T$; "IF"; T$; "( SUBSTITUTE <> "; Q$; "Y" ; Q$;  &
               ")"; T$; T$; T$; T$; "&"
03680   PRINT #10; T$; T$; "THEN"; T$; "PRINT'LINE = OLD'LINE"; T$;     &
               T$; T$; T$; "&"
03690   PRINT #10; T$; T$; T$; ": CALL PRINT'ONE"; T$; T$; T$; T$; "&"
03700   PRINT #10; T$; T$; T$; ": NO'UPDATE = NO'UPDATE + 1"; T$; T$; T$; "&"
03710   PRINT #10; T$; T$; T$; ": GOTO PHASE6A"
03720   PRINT #10; T$; "XCALL STRIP, NEW'LINE"
03730   PRINT #10; T$; "PRINT'LINE = NEW'LINE"
03740   PRINT #10; T$; "CALL PRINT'ONE"
03750   PRINT #10; T$; "GOTO PHASE6A"
03760   PRINT #10
03770   PRINT #10; "EXIT4:"
03780   PRINT #10; T$; "CLOSE #8"
03790   PRINT #10; T$; "CLOSE #9"
03800   PRINT #10; T$; "PRINT TAB(15,01); TAB(-1,10);"
03810   PRINT #10; T$; "PRINT TAB(20); CHANGED; ";                      &
                       Q$; "Files DIDN'T match the directory"; Q$
03820   PRINT #10; T$; "PRINT TAB(20); NO'UPDATE; "; Q$;                &
                       "Directory entries were NOT updated"; Q$
03830   PRINT #10; T$; "PRINT TAB(20); (CHANGED-NO'UPDATE); "           &
                       Q$; "Directory entries WERE updated"; Q$
03840   PRINT #10; T$; "CHAIN "; Q$; "UTFDP7"; Q$
03850   PRINT #10; T$; "END"
03860   PRINT #10
03862   PRINT #10; "GET'CMNT:"
03863   PRINT #10; T$; "OLD'LEN = INSTR(1,PRINT'LINE,"; Q$; ";"; Q$; ")"
03864   PRINT #10; T$; T$; "IF"; T$; "( OLD'LEN <> 0 )"; T$; T$; T$; T$; "&"
03865   PRINT #10; T$; T$; "THEN"; T$; "PRINT'LINE = ";                 &
                       "PRINT'LINE[1,OLD'LEN-2]"
03866   PRINT #10; T$; "PRINT'LINE = PRINT'LINE + CMNT(COUNTER)"
03867   PRINT #10; T$; "RETURN"
03869   PRINT #10
03870   PRINT #10; "GET'REST:"
03880   PRINT #10; T$; "INPUT LINE #8, OLD'LINE"
03890   PRINT #10; T$; T$; "IF"; T$; "( EOF(8) <> 0 )"; T$; T$; T$;     &
               T$; T$; "&"
03900   PRINT #10; T$; T$; "THEN"; T$; "GOTO EXIT4"; T$; T$; T$;        &
               "! End of File?"
03910   PRINT #10; T$; "PRINT'LINE = OLD'LINE"
03920   PRINT #10; T$; "CALL PRINT'ONE"
03930   PRINT #10; T$; "GOTO GET'REST"
03940   PRINT #10
03950   PRINT #10; "PRINT'ONE:"
03960   PRINT #10; T$; "COUNTER = COUNTER + 1"
03965   PRINT #10; T$; "XCALL STRIP, PRINT'LINE"
03970   PRINT #10; T$; T$; "IF"; T$; "( COUNTER <= 3 )"; T$; T$; T$; T$; "&"
03980   PRINT #10; T$; T$; "THEN"; T$; "CALL GET'CMNT"
03990   PRINT #10; T$; "PRINT #9; PRINT'LINE"; Q$; "  "; Q$
04000   PRINT #10; T$; "RETURN"
04010   PRINT #10
04020   PRINT #10; "!"; T$; "*"; T$; "**"; T$; "***"; T$;               &
               "End of UTFDP6.BAS"; T$; "***"; T$; "**"; T$; "*"
04030   CLOSE #10
04040
! Phase 7 does the cleanup
04050   OPEN #11, "UTFDP7.BAS", OUTPUT
04060   PRINT #11; T$; "!       UTFDP7.BAS - FIXDIR PHASE 7 - CLEANUP"
04070   PRINT #11; T$; "!       This is a temporary file - You may erase it."
04080   PRINT #11; T$; "!"
04090   PRINT #11
04100   RUN'DATE = RUN'DATE[1,13] + "7" + RUN'DATE[15,25]       ! Fix pgmnam
04110   PRINT #11; T$; RUN'DATE
04120   PRINT #11
04130   PRINT #11; T$; "MAP1    COUNTER,F,6,0"; T$; T$; T$; T$;         &
               "! Loop counter"
04140   PRINT #11; T$; "MAP1    DO'IT,S,1,"; Q$; "N"; Q$; T$; T$; T$; " ! Y/X"
04150   PRINT #11; T$; "MAP1    FILNAM,S,10"; T$; T$; T$; T$;           &
               "! File name to erase"
04160   PRINT #11
04170   PRINT #11; T$; "OPEN #12, "; Q$; "UTFDP7.CMD"; Q$; ", OUTPUT"
04180   PRINT #11; T$; "PRINT #12; "; Q$; "; UTFDP7.CMD - FIXDIR CLEANUP"; Q$
04190   PRINT #11
04200   PRINT #11; T$; "PRINT; "; Q$; "      Phase 7 of FIXDIR - Cleanup"; Q$
04210   PRINT #11; T$; "PRINT TAB(10); "; Q$; "Replace the ";   &
               "old directory with the updated one? "; Q$; ";"; " &"
04220   PRINT #11; T$; T$; Q$; "(Y/N) (def=N) "; Q$; ";"
04230   PRINT #11; T$; "INPUT "; Q$; Q$; "DO'IT"
04240   PRINT #11; T$; T$; "IF"; T$; "( UCS(DO'IT) = "; Q$; "Y"; Q$; ")"; &
               T$; T$; T$; T$; "&"
04250   PRINT #11; T$; T$; "THEN"; T$; ": PRINT #12; "                  &
               Q$; "COPY "; DIRNAM; " = FIXDIR.DIR"; Q$; T$; T$; "&"
04260   PRINT #11; T$; T$; T$; ": PRINT #12; "; Q$; "ERASE FIXDIR.DIR"; Q$
04270   PRINT #11
04280   PRINT #11; T$; "DO'IT = "; Q$; "N"; Q$
04290   PRINT #11; T$; "PRINT TAB(10); ";                               &
               Q$; "Do you want work files erased? (Y/N) (def=N) "; Q$; ";"
04300   PRINT #11; T$; "INPUT "; Q$; Q$; "; DO'IT"
04310   PRINT #11; T$; "IF UCS(DO'IT) = "; Q$; "Y"; Q$; " THEN CALL CLEAN'EM"
04320   PRINT #11; T$; "PRINT #12; "; Q$; ":T"; Q$
04330   PRINT #11; T$; "PRINT #12"
04340   PRINT #11; T$; "PRINT #12; ";                                   &
                       Q$; ":<I hope you found FIXDIR useful";         &
                               " - Dave Barrow";  Q$
04350   PRINT #11; T$; "PRINT #12; "; Q$; ">"; Q$
04360   PRINT #11; T$; "CLOSE #12"
04370   PRINT #11; T$; "CHAIN "; Q$; "UTFDP7.CMD"; Q$
04380   PRINT #11; T$; "END"
04390   PRINT #11
04400   PRINT #11; "CLEAN'EM:"
04410   PRINT #11; T$; "DATA UTFDP1.CMD,UTFDP1.DIR,UTFDP3.BAS,UTFDP3.LST"
04420   PRINT #11; T$; "DATA UTFDP3.RUN,UTFDP4.BAS,UTFDP4.RUN,UTFDP5.CMD"
04430   PRINT #11; T$; "DATA UTFDP5.DIR,UTFDP5.LST,UTFDP6.BAS,UTFDP6.RUN"
04440   PRINT #11; T$; "DATA UTFDP7.BAS,UTFDP7.CMD,UTFDP7.RUN,VERIFY.LST"
04450   PRINT #11
04460   PRINT #11; T$; "FOR COUNTER = 1 TO 16"
04470   PRINT #11; T$; T$; "READ FILNAM"
04480   PRINT #11; T$; T$; "PRINT #12; "; Q$; "ERASE "; Q$; "; FILNAM"
04490   PRINT #11; T$; "NEXT COUNTER"
04500   PRINT #11; T$; "RETURN"
04510   PRINT #11
04520   PRINT #11; "!"; T$; "*"; T$; "**"; T$; "***"; T$;               &
               "End of UTFDP7.BAS"; T$; "***"; T$; "**"; T$; "*"
04530
! Now start working on it
04540   CHAIN "UTFDP1.CMD"
04550   END
04560
!       *       **      ***     End of FIXDIR.BAS       ***     **      *