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