home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
vhelp.zip
/
VIEWHLP2.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1994-08-25
|
3KB
|
102 lines
/* REXX */
/*
Procedure to allow VIEW'ing of .HLP files under OS/2 2.x
This procedure requires that VIEW.EXE be located in a
directory which is in your PATH statement. It works by
changing the 4th byte of the .HLP file from x'10' to
x'01', thus fooling OS/2 into thinking it is a .INF file.
This version of the procedure works by copying the .HLP file
to a temporary file before performing any modifications. If
any TEMP or TMP environment variables exist, the temporary file
will be placed in the specified location. Otherwise, it will
be located in the current directory. In any event, the temp
file will be deleted when VIEW is exited.
(c) Copyright 1994 FreeLance Programming. All rights reserved.
I can be contacted at: wcdw@delphi.com
- or -
1052 Utterback Store Road
Great Falls, VA 22066
This code (which comes with no warranties, either expressed
or implied), is hereby placed in the public domain. Enjoy! */
infchar = '01'x
hlpchar = '10'x
call RXFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
call SysLoadFuncs
parse arg filename
filename = strip(filename)
if filename = '' then
do
say 'Usage is: VIEWHLP2 <filename>'
say ' '
say ' Where <filename> = The name of the .HLP file to be viewed. The'
say ' .HLP extension is assumed if it is not entered'
return
end
if translate(right(filename, 4)) <> '.HLP' then
filename = filename || '.hlp'
fullname = stream(filename, 'c', 'query exists')
if fullname = '' then
do
say 'The file ' || filename || ' could not be found!'
return
end
tdir = value('temp',, 'OS2ENVIRONMENT')
if tdir = '' then
do
tdir = value('tmp',, 'OS2ENVIRONMENT')
if tdir = '' then
tdir = directory()
end
tdir = tdir || '\TEMP????.INF'
tname = SysTempFileName(tdir)
'@copy ' fullname ' ' tname ' > nul '
if RC <> 0 then
do
say 'Copy failed - unable to create temporary file!'
'@del ' || tname ' > nul '
return
end
result = stream(tname, 'c', 'open write')
if left(result, 5) <> 'READY' then
do
say 'Unable to open temporary file ' || tname || ' (' || result || ')!'
return
end
left = charout(tname, infchar, 4)
clsd = stream(tname, 'c', close)
'VIEW.EXE ' || tname
/* The following (_really_ crude) do..until continually tries to delete */
/* the file. This cannot be done while VIEW is running, so this proc */
/* just loops until that is no longer true. This may be revised in a */
/* future version, if I find a better way to detected when VIEW has */
/* finished executing. */
do until rc = 0
call SysSleep 1
rc = SysFileDelete(tname)
end
return