OS/2 REXX library of miscellaneous functions. PR1UTIL uses TCP/IP libraries and thus requires TCP/IP to be installed.
This program is installable using the rpm package manager. See below for the install string. Required prerequisites are automatically processed by the package manager and, if needed, downloaded and installed.
yum install pr1util
Program is distributed as ZIP package: download to temporary directory and unpack to destination folder. See below for download link(s).
Following ones are the download links for manual installation:
PR1UTIL v. 1.65 (19/8/2010) | Readme/What's new |
PR1UTIL V1.65
by
Paul Ratcliffe
(c) Aug. 2010
PR1UTIL is a REXX library of miscellaneous functions. It uses TCP/IP
libraries and thus requires TCP/IP to be installed. The program is freeware
and as such:
USE OF THIS PROGRAM IS ENTIRELY AT YOUR OWN RISK.
USAGE
The PR1UTIL.DLL file should be placed in a directory that is somewhere on
your LIBPATH.
Before you can use this library, the functions need to be registered with
the REXX subsystem. You may register them individually using the
RxFuncAdd() call, or as follows:
call RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
call PRLoadFuncs
You may wish to deregister the functions afterwards, either individually
using RxFuncDrop() or as follows:
call PRDropFuncs
but beware of deregistering in one script whilst another relies on having
them available!
FUNCTIONS
PRLoadFuncs(display)
Function: Registers all the PR1UTIL library functions with the REXX
subsystem.
Parameters: display - optional parameter used to display the library
version string. Any value causes the string to be displayed.
Returns: Null string.
PRDropFuncs()
Function: Drops all the PR1UTIL library functions from the REXX
subsystem.
Parameters: Must be null.
Returns: Null string.
PRCloseWindow(handle)
Function: Posts a WM_CLOSE message to a window to close it.
Parameters: handle - Window handle.
Returns: Result code from WinPostMsg().
"1" = Success, "0" = Failure
PRGetFileAttr(file, variable)
Function: Queries a file or directory's attributes.
Parameters: file - File or directory name.
variable - Returned attribute string (any of A,D,H,R,S
indicates that attribute is set).
Returns: Result code from DosQFileMode().
"0" = Success
"ERROR" if unable to set variable.
PRGetGMTOffset()
Function: Retrieves the offset in minutes from GMT (UTC) taking into
account Daylight Savings Time.
Parameters: Must be null.
Notes: The value reported by DosGetDateTime() is returned if it is valid,
otherwise the offset is calculated from the TZ environment
variable - this must be set correctly.
e.g. SET TZ=GMT0BST,3,-1,0,3600,10,-1,0,7200,3600 for the UK.
Returns: Offset in minutes. Positive is ahead of GMT, Negative is behind.
PRGetMXAddress(address, stem)
Function: Returns the MX records for a given address.
Parameters: address - IP address or hostname.
stem - Stem variable for process list.
Returns: "ERROR" if unable to set stem variable.
Null string if success.
stem.0 = Number of items in the stem variable.
stem.i.host = Hostname.
stem.i.priority = Priority level.
where i is a number between 1 and stem.0
PRGetPid()
Function: Retrieves the PID of the current process.
Parameters: Must be null.
Returns: PID number.
PRKillProcess(action, pid)
Function: Kills the specified process and optionally any descendants.
Parameters: action - "0" = Process and all descendants, "1" = Specified
process only.
pid - PID number.
Notes: This is a direct implementation of DosKillProcess().
Returns: Result code from DosKillProcess().
PRProcessList(stem)
Function: Retrieves the entries from the process table.
Parameters: stem - Stem variable for process list.
Returns: "ERROR" if unable to set stem variable, unable to allocate
memory or unable to query the process list.
Null string if success.
stem.0 = Number of items in the stem variable.
stem.i.name = Fully qualified program module name or VDM\Program Title.
stem.i.pid = PID number
stem.i.parent = Parent PID number
stem.i.threads = No. of Threads
stem.i.type = Process Type
stem.i.status = Process Status
stem.i.session = Session ID
stem.i.module = Module handle
stem.i.dlls = No. of DLLs referenced
where i is a number between 1 and stem.0
PRQueryIFConfig(stem)
Function: Retrieves the TCP/IP interface configuration data.
Similar to "ifconfig xxx".
Parameters: stem - Stem variable for interface data.
Returns: "ERROR" if unable to set stem variable.
An error number from socket().
Null string if success.
stem.0 = Number of items in the stem variable.
stem.i.name = Interface name.
stem.i.flags = Interface flags (UP, BROADCAST, DEBUG, LOOPBACK,
POINTOPOINT, NOTRAILERS, RUNNING, NOARP, PROMISC, ALLMULTI,
DEFMTU, MULTICAST, BRIDGE, SNAP, ETHER, LOOPBRD).
stem.i.addr = Interface address in dotted format.
stem.i.dstaddr = Destination address in dotted format (Point to Point
links only).
stem.i.broadaddr = Interface broadcast address in dotted format (if
capable).
stem.i.netmask = Interface netmask in dotted format.
stem.i.metric = Interface metric.
where i is a number between 1 and stem.0
PRQuerySwitchList(stem)
Function: Retrieves the entries from the switch list.
Parameters: stem - Stem variable for switch list.
Returns: "ERROR" if unable to set stem variable, unable to allocate
memory or unable to query switch list.
Null string if success.
stem.0 = Number of items in the stem variable.
stem.i.hswitch = Switch handle
stem.i.hwnd = Window handle
stem.i.hwndicon = Icon handle
stem.i.hprog = Program handle
stem.i.pid = PID number
stem.i.sgid = Screen Group ID number
stem.i.visible = Visibility state - "1" = Invisible, "2" = Greyed,
"4" = Visible
stem.i.jumpable = Jumpability state - "1" = Not jumpable, "2" = Jumpable
stem.i.title = Program title
stem.i.progtype = Program type
where i is a number between 1 and stem.0
PRQuitWindow(handle)
Function: Posts a WM_QUIT message to a window to close/kill the application.
Parameters: handle - Window handle.
Returns: Result code from WinPostMsg().
"1" = Success, "0" = Failure
PRReplaceModule(oldmodule, newmodule, backupmodule)
Function: Replaces a file which is currently locked due to it being open
for execution.
Parameters: oldmodule - Module to be replaced.
newmodule - Replacement module.
backupmodule - Backup of replaced module.
Notes: This is a direct implementation of DosReplaceModule().
Returns: Result code from DosReplaceModule().
PRReplaceObjectClass(oldclass, newclass, flag)
Function: Replaces or restores a WPS class.
Parameters: oldclass - Old class name.
newclass - New class name.
flag - "1" = Replace class, "0" = Restore class
Notes: This is a direct implementation of WinReplaceObjectClass().
Returns: Result code from WinReplaceObjectClass().
"1" = Success, "0" = Failure
PRSetFileAttr(file, attribute)
Function: Sets a file or directory's attributes.
Parameters: file - File or directory name.
attribute - Attribute string (any of A,H,R,S to set the
attribute; any of a,h,r,s to clear the attribute; D and d are
ignored).
Notes: This function can set attributes of open files, unlike the
SysFileTree() function.
Returns: Result code from DosSetFileMode().
"0" = Success
"ERROR" if invalid characters in attribute.
PRStatSockets(stem)
Function: Retrieves the socket list for the PF_INET protocol family.
Equivalent to "netstat -s".
Parameters: stem - Stem variable for socket list.
Returns: "ERROR" if unable to set stem variable or unable to allocate
memory.
An error number from socket() or ioctl().
Null string if success.
stem.0 = Number of items in the stem variable.
stem.i.socknum = Socket number.
stem.i.type = Socket type - "STREAM", "DGRAM", "RAW", "RDM", "SEQPACKET"
or type number.
stem.i.rport = Remote port number.
stem.i.lport = Local port number.
stem.i.raddr = Remote address in dotted format.
stem.i.laddr = Local address in dotted format.
stem.i.state = Socket state -
For STREAM sockets: "CLOSED", "LISTEN", "SYN_SENT",
"SYN_RECEIVED", "ESTABLISHED", "CLOSE_WAIT",
"FIN_WAIT_1", "CLOSING", "LAST_ACK", "FIN_WAIT_2",
"TIME_WAIT", "TRANSIT" or state number.
For RAW sockets: "RAW".
For all other types: "UDP".
where i is a number between 1 and stem.0
PRSwitchToProgram(hswitch)
Function: Switches to another program identified by its switch handle.
Parameters: hswitch - Switch handle.
Notes: This is a direct implementation of WinSwitchToProgram().
Returns: Result code from WinSwitchToProgram().
"0" = Success
PRVersion()
Function: Queries the library version string.
Parameters: Must be null.
Returns: Library version string.
HISTORY
Version 1.65 20-8-10
Added PRQuitWindow().
Version 1.64 18-5-03
Fixed PRReplaceModule() to allow parameters 2 and 3 to be null strings.
Version 1.63 3-11-02
Updated PRGetGMTOffset() to use value from DosGetDateTime() if it is
valid.
Version 1.62 7-10-02
Fixed nasty bug in PRGetGMTOffset() which mangled the TZ environment
variable.
Fixed broken PRProcessList().
Fixed PRStatSockets() to work on 32 bit versions of TCP/IP.
Version 1.61 5-1-02
Fixed bug in PRSetFileAttr() which cleared all attributes.
Version 1.6 12-12-01
Added PRGetFileAttr() and PRSetFileAttr().
Version 1.5 25-11-01
Added PRQueryIFConfig().
Version 1.4 25-8-01
Added PRVersion().
Added PRCloseWindow().
Passing any parameters to PRLoadFuncs() displays the library version
string.
Parameters to PRDropFuncs() must now be null.
Changed PRGetMXAddress() not to return its own address if it is a valid
hostname or IP address.
Version 1.31 18-8-01
Fixed a null pointer bug in PRGetMXAddress().
Version 1.3 29-5-00
Renamed Sys* functions to PR* functions.
Added kill process and descendants capability to PRKillProcess().
Added PRGetMXAddress().
Version 1.2 31-8-99
Added PRGetGMTOffset().
Version 1.1 16-6-99
Added PRProcessList().
Version 1.0 8-6-99
Initial release.
OTHER
This program was initially developed under Warp 3 (without Win-OS/2) and
now is developed under Warp 4 using VisualAge C++ 3.0 for OS/2.
If you use this program could you please let me know. Also if you have any
comments, criticisms, bug reports or anything that could be improved.
I will reply to all messages received.
Paul Ratcliffe: paul@orac12.clara34.co56.uk78
(remove the obvious numbers from the RHS) |
home.clara.net/orac/files/os2/pr1ut165.zip |
This work is licensed under a Creative Commons Attribution 4.0 International License.
Add new comment