home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
9510ls01.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-08-17
|
5KB
|
66 lines
/* 9510LS01.CMD - Parse Libpath from CONFIG.SYS */ /* 01 */
/* 02 */
crlf = '0D0A'x /* carriage return / line feed *//* 03 */
libpath_search_arg = crlf || 'LIBPATH=' /* 04 */
/* 05 */
/*--------------------------------------*\ /* 06 */
| Determine CONFIG.SYS location & size | /* 07 */
\*--------------------------------------*/ /* 08 */
config_sys_file =, /* 09 */
LEFT( VALUE( 'RUNWORKPLACE',, 'OS2ENVIRONMENT' ), 2 ) ||, /* 10 */
'\CONFIG.SYS' /* 11 */
config_sys_size =, /* 12 */
STREAM( config_sys_file, 'C', 'QUERY SIZE' ) /* 13 */
if config_sys_size = '' then /* 14 */
do /* 15 */
say 'Unable to locate' config_sys_file /* 16 */
exit /* 17 */
end /* 18 */
/* 19 */
/*-----------------------------*\ /* 20 */
| Read entire file & close it | /* 21 */
\*-----------------------------*/ /* 22 */
config_sys_area =, /* 23 */
CHARIN( config_sys_file, 1, config_sys_size ) /* 24 */
call STREAM config_sys_file, 'C', 'CLOSE' /* 25 */
uppercase_config_sys_area =, /* 26 */
TRANSLATE( config_sys_area ) /* uppercase for searching */ /* 27 */
/* 28 */
/*------------------------------------*\ /* 29 */
| Find LIBPATH= at beginning of line | /* 30 */
\*------------------------------------*/ /* 31 */
libpath_beg_pos =, /* 32 */
POS( libpath_search_arg, uppercase_config_sys_area ) + 2 /* 33 */
if libpath_beg_pos = 2 then /* 34 */
do /* 35 */
say 'Unable to locate LIBPATH=' /* 36 */
exit /* 37 */
end /* 38 */
libpath_end_pos =, /* 39 */
POS( crlf, uppercase_config_sys_area, libpath_beg_pos ) /* 40 */
libpath_string =, /* 41 */
SUBSTR( config_sys_area,, /* 42 */
libpath_beg_pos,, /* 43 */
libpath_end_pos - libpath_beg_pos ) /* 44 */
/* 45 */
/*------------------------*\ /* 46 */
| Write tokens to screen | /* 47 */
\*------------------------*/ /* 48 */
token_number = 0 /* 49 */
do while libpath_string <> '' /* 50 */
parse value libpath_string with, /* 51 */
token, /* 52 */
';', /* 53 */
libpath_string /* 54 */
token_number = token_number + 1 /* 55 */
if token_number = 1 then /* 56 */
do /* 57 */
say token || ';' /* 58 */
end /* 59 */
else /* 60 */
do /* 61 */
say COPIES( ' ', 8 ) || token || ';' /* 62 */
end /* 63 */
end /* 64 */
exit /* 65 */