home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / 9601ls01.cmd < prev    next >
OS/2 REXX Batch file  |  1996-02-05  |  5KB  |  66 lines

  1. /* 9601LS01.CMD - Create CONFIG.TXT from CONFIG.SYS */        /*01*/
  2. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'     /*02*/
  3. call SysLoadFuncs                                             /*03*/
  4.                                                               /*04*/
  5. GBL. = ''            /* initialize stem */                    /*05*/
  6. GBL.environment =,                                            /*06*/
  7.    'OS2ENVIRONMENT'                                           /*07*/
  8. GBL.boot_drive  =,                                            /*08*/
  9.    LEFT( VALUE( 'RUNWORKPLACE',, GBL.environment ), 2 )       /*09*/
  10. GBL.width       = 76 /* limit for nbr of characters / line */ /*10*/
  11.                                                               /*11*/
  12. GBL.input_file =,                                             /*12*/
  13.    GBL.boot_drive ||,                                         /*13*/
  14.    '\config.sys'                                              /*14*/
  15. GBL.output_file =,                                            /*15*/
  16.    GBL.boot_drive ||,                                         /*16*/
  17.    '\config.txt'                                              /*17*/
  18. call SysFileDelete GBL.output_file  /*erase existing file */  /*18*/
  19.                                                               /*19*/
  20. /*------------------------------*\                            /*20*/
  21. |  Read each line of CONFIG.SYS  |                            /*21*/
  22. |    & list according to size    |                            /*22*/
  23. \*------------------------------*/                            /*23*/
  24. do while LINES( GBL.input_file ) > 0                          /*24*/
  25.    input_line = LINEIN( GBL.input_file )                      /*25*/
  26.    if LENGTH( input_line ) <= GBL.width then                  /*26*/
  27.       do                                                      /*27*/
  28.          /*------------------*\                               /*28*/
  29.          |  Echo short lines  |                               /*29*/
  30.          \*------------------*/                               /*30*/
  31.          call LINEOUT GBL.output_file, input_line             /*31*/
  32.          iterate                                              /*32*/
  33.       end                                                     /*33*/
  34.    /*-------------------------------*\                        /*34*/
  35.    |  Calculate number of leading    |                        /*35*/
  36.    |  blanks for continuation lines  |                        /*36*/
  37.    \*-------------------------------*/                        /*37*/
  38.    continuation_line_blank_count =,                           /*38*/
  39.       POS( '=', input_line )                                  /*39*/
  40.    /*------------------------*\                               /*40*/
  41.    |  Process 1st of ? lines  |                               /*41*/
  42.    \*------------------------*/                               /*42*/
  43.    parse value input_line with,                               /*43*/
  44.       output_line,                                            /*44*/
  45.       ';',                                                    /*45*/
  46.       after_semicolon                                         /*46*/
  47.    call LINEOUT GBL.output_file, output_line || ';'           /*47*/
  48.    /*-------------------------------*\                        /*48*/
  49.    |  Process all remaining tokens,  |                        /*49*/
  50.    |        one per line             |                        /*50*/
  51.    \*-------------------------------*/                        /*51*/
  52.    do while after_semicolon <> ''                             /*52*/
  53.       parse value after_semicolon with,                       /*53*/
  54.          token,                                               /*54*/
  55.          ';',                                                 /*55*/
  56.          after_semicolon                                      /*56*/
  57.       output_line =,                                          /*57*/
  58.          COPIES( ' ', continuation_line_blank_count ) ||,     /*58*/
  59.          token || ';'                                         /*59*/
  60.       call LINEOUT GBL.output_file, output_line               /*60*/
  61.    end                                                        /*61*/
  62. end                                                           /*62*/
  63. call STREAM GBL.input_file,  'C', 'CLOSE'                     /*63*/
  64. call STREAM GBL.output_file, 'C', 'CLOSE'                     /*64*/
  65. exit                                                          /*65*/
  66.