home *** CD-ROM | disk | FTP | other *** search
/ IBM CD Showcase / OS2_CD_ROM.iso / smce0001 / builder / bin / tellcopy.cmd < prev    next >
Encoding:
Text File  |  1993-11-24  |  9.1 KB  |  230 lines

  1. /*  This cmd file will copy the Builder/2 runtime parts.                */
  2. /*  It does this as follows                                             */
  3. /*       1. Initialization                                              */
  4. /*       2. Ask for source path.                                        */
  5. /*       3. Ask for the target path.                                    */
  6. /*       4. Check state of target disk                                  */
  7. /*       5. Create directories if needed                                */
  8. /*       6. Copy each part from source to destination.                  */
  9. /*       7. Exit                                                        */
  10. /************************************************************************/
  11.  
  12. Abort = 'No';           /* Flag to control aborting */
  13. "@ECHO OFF"
  14.         /* Initialize the RexxUtil environment */
  15.  
  16.         Call RxFuncadd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs';
  17.         Call SysLoadFuncs;
  18.  
  19.         /* Initialize the Parts List           */
  20.  
  21.         rc = Initialize();
  22.  
  23.         /* Give introductory message       */
  24.  
  25.         rc = SayIntro();
  26.         If Abort = 'Yes' then Exit;
  27.  
  28.         /* Determine the current directory */
  29.  
  30.         currdir = Directory();
  31.         If Abort = 'Yes' then Exit;
  32.  
  33.         /* Determine the source disk       */
  34.  
  35.         sdisk = GetSource();
  36.         If Abort = 'Yes' then Exit;
  37.  
  38.         /* Determine the target disk       */
  39.  
  40.         tdisk = GetTarget();
  41.         If Abort = 'Yes' then Exit;
  42.  
  43.         /* If diskette, get a clean one    */
  44.  
  45.         rc = Getdisk(tdisk);
  46.  
  47.         /* Make target directories         */
  48.  
  49.         rc = Builddir(tdisk)
  50.  
  51.         /* Process the parts list */
  52.  
  53.         rc = ProcessParts(sdisk tdisk);
  54.         If rc <> 0 then Do;
  55.            Say " "
  56.            Say "TELLCOPY failed."
  57.            End;
  58.         else Do;
  59.            Say " "
  60.            Say "TELLCOPY completed successfully."
  61.            End;
  62.  
  63.         /* Exit                            */
  64.  
  65.         Exit 0
  66.  
  67. /***********************************************************************/
  68. /* Gives the introductory message.                                     */
  69. /***********************************************************************/
  70. SayIntro:  Procedure Expose Abort;
  71.         Call SysCls;
  72. Say  "                                                                      "
  73. Say  "                                                                      "
  74. Say  "  This CMD file allows you to copy the Builder/2 Runtime Player       "
  75. Say  "  files from the product directory to another directory.  These       "
  76. Say  "  files are required to execute a Builder/2 application.              "
  77. Say  "                                                                      "
  78. Say  "  You will be prompted for the following:                             "
  79. Say  "                                                                      "
  80. Say  "       1. The path for the source (for example, C:\BUILDER)           "
  81. Say  "       2. The path for the target (for example, A:\RUNTIME)           "
  82. Say  "                                                                      "
  83. Say  "  This command file will:                                             "
  84. Say  "                                                                      "
  85. Say  "       1. Ask for the above information.                              "
  86. Say  "       2. Create the specified directory.                             "
  87. Say  "       3. Copy the needed files into the directory.                   "
  88. Say  "                                                                      "
  89. Say  "  You may cancel execution by responding with ENTER to any question.  "
  90. Say  "                                                                      "
  91. Say  "  Would you like to proceed (Y/N)?"
  92.         Pull choice .
  93.         If (choice = "") | (choice = "N") then Do;
  94.           Abort = 'Yes'
  95.           Return 2;
  96.           End;
  97. Return 0
  98. /***********************************************************************/
  99. /* Asks for the directory for the source disk.                         */
  100. /***********************************************************************/
  101. GetSource: Procedure Expose Abort;
  102.         Say " "
  103.         Say "Enter the source directory (for example, C:\BUILDER)"
  104.         Pull sdisk
  105.         If sdisk = "" then Do;
  106.           Abort = 'Yes'
  107.           Return 2;
  108.           End;
  109.         ll = Length(sdisk);
  110.         If "\" = Substr(sdisk,ll,1) then sdisk = Substr(sdisk,1,ll-1);
  111. Return sdisk
  112. /***********************************************************************/
  113. /* Asks for the directory for the target disk.                         */
  114. /***********************************************************************/
  115. GetTarget: Procedure Expose Abort;
  116.         Say " "
  117.         Say "Enter the target directory (for example, A:\RUNTIME)"
  118.         Pull tdisk
  119.         If tdisk = "" then Do;
  120.           Abort = 'Yes'
  121.           Return 2;
  122.           End;
  123.         ll = Length(tdisk);
  124.         If "\" = Substr(tdisk,ll,1) then tdisk = Substr(tdisk,1,ll-1);
  125. Return tdisk
  126. /***********************************************************************/
  127. /* Copies the parts.                                                   */
  128. /***********************************************************************/
  129. ProcessParts:
  130.  
  131.   Parse upper arg sdisk tdisk .
  132.  
  133.   currentdisk = 1;
  134.   Say " "
  135.   Say "Copying files..."
  136.  
  137.   Do i = 1 to in.0
  138.      /* Check if it is time to change diskettes */
  139.         If diskette = "Yes" & disk.i <> currentdisk then Do;
  140.            Say " "
  141.            Say "Copy to diskette completed."
  142.            Say " "
  143.            Say "Does your application include TIFF, TARGA, PCX, or GIF images?  (Y or N)"
  144.            Pull choice;
  145.            If (choice = "") | (choice = "N") then Do;
  146.              Return 0;
  147.              End;
  148.            rc = Getdisk(tdisk);
  149.            rc = Builddir(tdisk);
  150.            currentdisk = disk.i;
  151.         end  /* Do */
  152.  
  153.      /* Put together COPY command  */
  154.  
  155.         part1 = "\"||sub.i||"\"||in.i
  156.         part2 = "\"||in.i
  157.         fromname = sdisk||part1
  158.         toname = tdisk||part2
  159.         rc = SysFileTree(fromname,'lookf','FT')
  160.         Parse var lookf.1 fstamp rest
  161.         rc = SysFileTree(toname,'lookt','FT')
  162.         Parse var lookt.1 tstamp rest
  163.         If (lookf.0 = 0) then Do;                 /* can't copy if source not there */
  164.            Return 8
  165.            End;
  166.         If (lookt.0 = 0 & lookf.0 = 1)  |,      /* copy if not already there */
  167.            (lookt.0 = 1 & (fstamp > tstamp)) then Do;  /* copy if there and older */
  168.            "@COPY" fromname toname
  169.           If rc <> 0 Then Do;
  170.             Abort = 'Yes'
  171.             Return 8;
  172.             End;
  173.           End;  /* If not already there */
  174.  
  175. end /* do */
  176.  
  177. Return 0;
  178. /***********************************************************************/
  179. /* Asks for a diskette, if needed                                      */
  180. /***********************************************************************/
  181. Getdisk:
  182.  
  183.   Parse upper arg tdisk .
  184.  
  185.   tdrive = Substr(tdisk,1,1);
  186.   If tdrive = "A" | tdrive = "B" then diskette = "Yes"
  187.   else diskette = "No";
  188.         If diskette = "Yes" Then Do;
  189.            Say " "
  190.            Say "Insert a blank formatted high-density diskette into the diskette drive"
  191.            Say "Press ENTER when ready..."
  192.            Pull choice
  193.            End;
  194. Return rc
  195. /***********************************************************************/
  196. /* Creates target directories.                                         */
  197. /***********************************************************************/
  198. Builddir:
  199.         Parse arg tdisk .
  200.  
  201.         dirname = tdisk
  202.         rc = SysMkDir(dirname)
  203.  
  204. Return rc;
  205. /***********************************************************************/
  206. /* Initializes the parts array.                                        */
  207. /***********************************************************************/
  208. Initialize:
  209.  
  210.   in.1  = "AVCSQL.DLL"   ;    sub.1  = "DLL"          ;  disk.1  = 1 ;
  211.   in.2  = "PLTELLE.HLP"  ;    sub.2  = "HELP"         ;  disk.2  = 1 ;
  212.   in.3  = "TELLPM.EXE"   ;    sub.3  = "BIN"          ;  disk.3  = 1 ;
  213.   in.4  = "UTSAPI.DLL"   ;    sub.4  = "DLL"          ;  disk.4  = 1 ;
  214.   in.5  = "UTSMPLDB.DLL" ;    sub.5  = "DLL"          ;  disk.5  = 1 ;
  215.   in.6  = "UTTLMAIN.DLL" ;    sub.6  = "DLL"          ;  disk.6  = 1 ;
  216.   in.7  = "UTUBCLIB.DLL" ;    sub.7  = "DLL"          ;  disk.7  = 1 ;
  217.   in.8  = "UTTLENG.DLL"  ;    sub.8  = "DLL"          ;  disk.8  = 1 ;
  218.   in.9  = "REPLACE._DS"  ;    sub.9  = "DATA"         ;  disk.9  = 1 ;
  219.   in.10 = "BOOKB._FN"    ;    sub.10 = "DATA"         ;  disk.10 = 1 ;
  220.   in.11 = "SYSLEVEL.UB2" ;    sub.11 = "INSTALL"      ;  disk.11 = 1 ;
  221.   in.12 = "PCXPROC.DLL"  ;    sub.12 = "UTIOPROC"     ;  disk.12 = 2 ;
  222.   in.13 = "TGAPROC.DLL"  ;    sub.13 = "UTIOPROC"     ;  disk.13 = 2 ;
  223.   in.14 = "TIFPROC.DLL"  ;    sub.14 = "UTIOPROC"     ;  disk.14 = 2 ;
  224.   in.15 = "GIFPROC.DLL"  ;    sub.15 = "UTIOPROC"     ;  disk.15 = 2 ;
  225.   in.16 = "IOPROC.DLL"   ;    sub.16 = "UTIOPROC"     ;  disk.16 = 2 ;
  226.   in.17 = "MMIOINI.EXE"  ;    sub.17 = "INSTALL"      ;  disk.17 = 2 ;
  227.   in.0 = 17
  228.  
  229. Return 0
  230.