home *** CD-ROM | disk | FTP | other *** search
/ IBM Aptiva Multimedia Exploration / BPCDROM.ISO / os2image / disk_0 / dmf_ps2.cmd < prev    next >
Encoding:
Text File  |  1995-02-02  |  9.5 KB  |  296 lines

  1. /*     */
  2.     /*
  3.     * ********************************************************************
  4.     * *             Copyright (c) IBM Corporation, 1995                  *
  5.     * *                     All Rights Reserved                          *
  6.     * ********************************************************************
  7.     *
  8.     *
  9.     * DESCRIPTION: This REXX command file is to be used to make changes
  10.     *              to CONFIG.SYS for IBM Microchannel PS/2's in order
  11.     *              to install Microsoft applications that are in DMF
  12.     *              format on your IBM PS/2 Microchannel system.
  13.     *
  14.     */
  15.  
  16.    /*      trace I */
  17.     call init
  18.  
  19.     /* Get the version of the current OS/2 system. */
  20.     version = SysOs2Ver()
  21.     if version < '2.30' then  /* 2.30 represents Warp version. */
  22.       do
  23.         say 'Este archivo de mandatos no funciona con esta versión de OS/2.'
  24.         say 'Programa finalizado.'
  25.         exit
  26.       end
  27.     "@cls"
  28.     Say ' '
  29.     Say ' '
  30.     Say ' '
  31.     Say 'Este programa permite que los usuarios de OS/2 Warp que utilizan'
  32.     Say 'IBM PS/2 puedan instalar el software que se proporciona en diskettes'
  33.     Say 'con formato DMF no estándar.'
  34.     Say ' '
  35.     Say 'Este program modificará el archivo CONFIG.SYS para permitir que se'
  36.     Say 'puedan leer los diskettes DMF. Una vez el software de DMF está '
  37.     Say 'instalado, debería ejecutar de nuevo este programa mediante la opción'
  38.     Say 'R para Restaurar el archivo CONFIG.SYS original.'
  39.     Say ' '
  40.     Say 'Para modificar el archivo CONFIG.SYS de Os/2 Warp de modo que ofrezca'
  41.     Say 'soporte para instalar desde diskettes con formato DMF, entre M para'
  42.     Say 'modificarlo. '
  43.     Say 'Para deshacer los cambios del CONFIG.SYS de OS/2 Warp relacionados con'
  44.     Say 'DMF, entre R para Restaurar.'
  45.     Say ' '
  46.     Say 'Para salir de este programa sin hacer cambios, pulse S de Salir'
  47.     Say ' '
  48.     Say 'Teclee M (Modificar) o R (Restaurar) o S (Salir).'
  49.  
  50.     parse upper pull answer .   /* Get the answer */
  51.  
  52.     if (answer='S' | answer='SALIR') then    /* If answer is exit then exit */
  53.       say 'Saliendo del archivo de mandatos!'
  54.  
  55.     else if (answer='RESTAURAR' | answer='R') then
  56.       call UNDO    /* If the answer is UNDO then go to the UNDO Subroutine */
  57.  
  58.     else if (answer='M' | answer = 'MODIFICAR') then
  59.      do           /* If the answer is Modify then modify config.sys */
  60.       '@cls'
  61.       say ' '
  62.       say ' '
  63.       say ' '
  64.       say '¿En qué unidad se ha instalado el sistema OS/2 Warp?'
  65.       say 'Entre la letra de unidad o la vía de acceso (ejemplo C:\)'
  66.       say ''
  67.  
  68.         /* Check whether the given drive is valid. */
  69.         call Checkdrive        /* GO to the Checkdrive subroutine */
  70.  
  71.         fname=drive'\config.sys' /* Assign drive letter and path for config.sys */
  72.  
  73.         /* Check whether config.sys exists. */
  74.         call sysfiletree fname, 'files.', 'F'
  75.  
  76.         if files.0 < 1 then
  77.           do
  78.             say 'No se ha encontrado el archivo CONFIG.SYS.'
  79.             say 'Programa finalizado.'
  80.             exit
  81.           end
  82.  
  83.         sname=drive'\config.dmf'  /* Assign drive letter and path to */
  84.                                   /* config.sys back up file name */
  85.  
  86.         /* Check whether config.dmf exists. */
  87.         call sysfiletree sname, 'files.', 'F'
  88.  
  89.         if files.0 >= 1 then
  90.           do
  91.             say 'Config.dmf ya existe. ¿Desea sobreescribirlo (S/N)?'
  92.  
  93.             parse upper pull answer
  94.             answer = left(answer,1)
  95.             if answer = 'N' then
  96.               do
  97.                 say 'Renombre o suprima config.dmf antes de volver a ejecutar dmf_ps2.'
  98.                 exit
  99.               end
  100.           end
  101.  
  102.         nname=drive'\config1.tmp'  /* Assign drive letter and path to */
  103.                                    /* temporary file */
  104.  
  105.         say 'Ejecutándose ........'
  106.         say ' '
  107.         "@copy" fname sname ">nul 2>nul" /* Backup config.sys */
  108.  
  109.         call lineout nname,,1
  110.         do while lines(fname)   /* Parse through config.sys looking for */
  111.            str = linein(fname)  /* the string to be modified */
  112.            basedev = (substr(str,1,20))  /* Only need to look at first 20 */
  113.                                          /* characters of the line */
  114.            select
  115.               when substr(basedev,1,20) == 'BASEDEV=IBM1FLPY.ADD' then do
  116.                   if left(reverse(str), 4) \= 'ACM/' then do
  117.                     call lineout nname, str '/MCA'  /* Add /MCA option to */
  118.                     end                             /* IBM1FLPY.ADD driver */
  119.                   else
  120.                     call lineout nname, str
  121.                     end
  122.               when substr(basedev,1,20) == 'BASEDEV=IBM2FLPY.ADD' then do
  123.                     call lineout nname, 'REM' str /* REM out the */
  124.                     end                           /* IBM2FLPY.ADD driver */
  125.               otherwise do
  126.                     call lineout nname, str
  127.                     end
  128.            end
  129.          end
  130.  
  131.          call lineout fname
  132.          call lineout nname
  133.          "@copy" nname fname ">nul 2>nul"
  134.          "@erase" nname
  135.          "@cls"
  136.  
  137.  
  138.          say ''
  139.          say ''
  140.          say ''
  141.          say ''
  142.          say 'Cambios hechos en el archivo' fname
  143.          say ''
  144.          say 'Se ha modificado el archivo CONFIG.SYS. La versión original'
  145.          say 'se ha guardado como CONFIG.DMF. Para que entren en efecto los '
  146.          say 'cambios, utilice el mandato Concluir, y vuelva iniciar el sistema.'
  147.          say ''
  148.          say 'Cuando se hayan instalado las aplicaciones DMF, por favor vuelva'
  149.          say 'a ejecutar DMF_PS2 con la opción R (Restaurar), para volver a'
  150.          say 'dejar el sistema en el estado original.'
  151.  
  152.       end
  153.     else
  154.         say 'Respuesta desconocida.'
  155.         say 'Programa finalizado.'
  156.  
  157. exit
  158.  
  159. UNDO:
  160.     '@cls'
  161.     say ' '
  162.     say ' '
  163.     say ' '
  164.     say '¿En qué unidad ha instalado el sistema OS/2 Warp?'
  165.     say 'Entre la letra de unidad o la vía de acceso (ejemplo C:\)'
  166.     say ' '
  167.  
  168.     call Checkdrive
  169.  
  170.     fname=drive'\config.sys'
  171.  
  172.     call sysfiletree fname, 'files.', 'F'
  173.     if files.0 < 1 then
  174.       do
  175.         say 'No se ha encontrado el archivo CONFIG.SYS.'
  176.         say 'Programa finalizado.'
  177.         exit
  178.       end
  179.  
  180.     nname=drive'\config1.tmp'
  181.  
  182.     do while lines(fname)            /* This section of code is to check the */
  183.       str = linein(fname)            /* config.sys to see if the DMF changes */
  184.       basedev = (substr(str,1,24))   /* need to be UNDone. */
  185.       select
  186.         when substr(basedev,1,20) == 'BASEDEV=IBM2FLPY.ADD' then do
  187.              "@CLS"
  188.              say ' '                  /* If it finds this then display */
  189.              say ' '                  /* Message */
  190.              say ' '
  191.              say 'CONFIG.SYS no contiene cambios DMF'
  192.              say 'Nada para DESHACER'
  193.              say 'Programa finalizado'
  194.              call exit
  195.              end
  196.         when substr(basedev,1,24) == 'REM BASEDEV=IBM2FLPY.ADD' then do
  197.              call lineout nname
  198.              call lineout fname         /* If it finds this then lets */
  199.              call undo2                 /* call undo2 to really undo the */
  200.              end                        /* DMF changes */
  201.         otherwise do
  202.               call lineout nname, str
  203.               end
  204.     end
  205.   end
  206. EXIT:
  207.     call lineout nname
  208.     "@ERASE" nname
  209.     exit
  210.  
  211. UNDO2:
  212.  
  213.    "@erase" nname
  214.  
  215.     nname=drive'\config1.tmp'
  216.  
  217.     call lineout nname,,1
  218.     do while lines(fname)
  219.       str = linein(fname)
  220.       basedev = (substr(str,1,24))
  221.  
  222.       select
  223.         when substr(basedev,1,24) == 'REM BASEDEV=IBM2FLPY.ADD' then do
  224.               newstr = (subword(str,2))
  225.               call lineout nname, newstr
  226.               end
  227.         when substr(basedev,1,20) == 'BASEDEV=IBM1FLPY.ADD' then do
  228.               parse var str final remaining
  229.               num_item = words(remaining)
  230.               do p = 1 to num_item
  231.                 if strip(word(remaining, p)) \= '/MCA' then
  232.                   final = final || ' 'word(remaining, p)
  233.               end
  234.               call lineout nname, final
  235.               end
  236.         otherwise do
  237.               call lineout nname, str
  238.               end
  239.       end
  240.     end
  241.     call lineout fname
  242.     call lineout nname
  243.     "@copy" nname fname ">nul 2>nul"
  244.     "@erase" nname
  245.     "@cls"
  246.  
  247.  
  248.     say ''
  249.     say ''
  250.     say ''
  251.     say ''
  252.     say 'Se ha restaurado el archivo CONFIG.SYS. Para que los cambios entren en'
  253.     say 'efecto, utilice el mandato concluir, y vuelva a iniciar el sistema.'
  254.     say ''
  255. exit
  256.  
  257. CheckDrive:
  258.     /* Get all the local drive letters. */
  259.     drivemap = sysdrivemap('c:', 'LOCAL')
  260.  
  261.     parse upper pull drive .
  262.  
  263.     drive = strip(translate(drive, ' ', '\'))
  264.     num_item = words(drive)
  265.     if num_item > 1 then
  266.       do
  267.         say 'Unidad no reconocida.'
  268.         say 'Programa finalizado.'
  269.         exit
  270.       end
  271.     found = 'NO'
  272.     do while drivemap \= ''
  273.       parse var drivemap head tail
  274.       drivemap = tail
  275.       head = strip(head)
  276.       if head = drive then
  277.          found = 'YES'
  278.     end
  279.  
  280.     if found = 'NO' then
  281.       do
  282.         say 'Unidad no reconocida.'
  283.         say 'Programa finalizado.'
  284.       end
  285. return
  286.  
  287. /* Load in the extra function library. WPW001 */
  288. Init: Procedure
  289.  
  290.     /* Load in the extra function library */
  291.     if RxFuncQuery('SysLoadFuncs') then do
  292.         Call RXFuncAdd 'SysLoadFuncs','RexxUtil','SysloadFuncs'
  293.     end
  294.     Call SysLoadFuncs
  295. return
  296.