home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxhll.zip
/
MISC.REX
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-01-22
|
2KB
|
55 lines
/* #include <misc.rex> */
MakeFileName: procedure
/**
*** This will make a file name from the string passed. In the case of
*** HPFS, the name is left pretty much alone. In the case of FAT, the
*** 1st 8 chars are returned, which has a good chance of not being
*** unique.
**/
parse arg FileSystem,string
string = strip(string)
if FileSystem = 'HPFS' then
Name = translate(string, '!!...!---+', '"\/:*?|<>-&')
else
Name = left(translate(string, '___________', '"\/:*?|<>-&'), 8)
return Name
GetHilbertIni: procedure
/**
*** This will find the INI file that contains profile information.
**/
/* Look for an environment variable first */
IniFile = value('Hilbert.Ini',,"OS2ENVIRONMENT")
if IniFile = '' then
IniFile = SysSearchPath("DPATH","Hilbert.Ini")
if IniFile = '' then
do
This = ThisDirectory()
if Exists(This"\Hilbert.Ini") then
IniFile = This"\Hilbert.Ini"
end
if IniFile = '' then
call Error 2002,1,"Hilbert.Ini"
return IniFile
GetUniqueKey: procedure
/**
*** This will return a unique numeric key to the caller. This should be
*** a systemwide critical section, but there's no way to do that in
*** standard REXX, so we will hope for the best.
**/
parse arg IniFile
IniValue = SysIni(IniFile,'Global','Unique Key')
if datatype(IniValue,'Numeric') <> 1 then IniValue = 0
IniValue = IniValue + 1
code = SysIni(IniFile,'Global','Unique Key',IniValue)
return IniValue