Rexx Function Package for TCP/IP FTP for OS/2 2.0
Автор: Patrick Mueller
Дата: 1993
----------------------------------------------------------------------
what is rxFtp?
----------------------------------------------------------------------
rxFtp is a REXX function package providing access to the OS/2
TCP/IP FTP API as provided by the IBM TCP/IP product, version
1.2.1.
The function package assumes you know how to use the FTP program.
The function names in the package closely resemble FTP subcommands.
This function package requires the OS/2 TCP/IP product, version 1.2.1
or higher. A specific DLL for the OS/2 TCP/IP product, version 2.0, is
included.
----------------------------------------------------------------------
installation and removal
----------------------------------------------------------------------
The rxFtp rexx function package is contained in the file rxFtp.dll.
This file needs to be placed in a directory along your LIBPATH. To get
access to the functions in the rxFtp function package, execute the
following rexx code:
rc = RxFuncAdd("FtpLoadFuncs","rxFtp","FtpLoadFuncs")
rc = FtpLoadFuncs()
If you want to use the 32-bit FTP functions available in TCP/IP for OS/2
Version 2.0, rename the "rxftp32.dll" file to "rxftp.dll".
You may not use both the 16-bit and 32-bit versions at the same time as
they have the same function names.
To unload the DLL, you should first call the FtpDropFuncs()
function, then exit all CMD.EXE shells. After exiting all the
command shells, the DLL will be dropped by OS/2 and can be deleted
or replaced.
----------------------------------------------------------------------
Parameters and Return Values
----------------------------------------------------------------------
----------------------------------------------------------------------
Return values
----------------------------------------------------------------------
o Set errors
The following functions return Set error codes:
FtpSetUser
FtpSetBinary
The return code is 1 if the string passed in are valid, 0 if not.
FtpSetBinary() should be passed an abbreviation of "BINARY" or
"ASCII" (thus, "b", "as", "BIN", etc).
o FTP errors
The rest of the functions (all the functions but the Set functions)
return ftp error conditions.
It will have one of the following values (or a numeric value if the
number isn't one of these documented values):
"0" - successful call
"-1" - Error during FTP function call
If the function returns a "-1" for a return code, the variable FTPERRNO
will be set to one of the following values:
"FTPSERVICE" - unknown service
"FTPHOST" - unknown host
"FTPSOCKET" - unable to obtain socket
"FTPCONNECT" - unable to connect to server
"FTPLOGIN" - login failed
"FTPABORT" - transfer aborted
"FTPLOCALFILE" - problem openning local file
"FTPDATACONN" - problem initializing data connection
"FTPCOMMAND" - command failed
"FTPPROXYTHIRD" - proxy server does not support third party transfers
"FTPNOPRIMARY" - no primary connection for proxy transfer
----------------------------------------------------------------------
Functions Reference
----------------------------------------------------------------------
-------------------------------------------------------------------
FtpLoadFuncs
-------------------------------------------------------------------
rc = FtpLoadFuncs(quiet)
Loads all the functions in the rxFtp package.
If ANY parameters are passed to this function, it will bypass
the program/author/copyright information normally displayed.
All parameters are ignored (except to determine whether or not
to bypass displaying the information).
-------------------------------------------------------------------
FtpDropFuncs
-------------------------------------------------------------------
rc = FtpDropFuncs()
Drops all the functions in the rxFtp package.
-------------------------------------------------------------------
FtpVersion
-------------------------------------------------------------------
rc = FtpVersion(variable)
Returns the version of RxFtp that you are running in the variable
"variable".
-------------------------------------------------------------------
Set Functions
-------------------------------------------------------------------
FtpSetUser(host,userid,password<,account>)
FtpSetBinary("Binary" | "Ascii")
FtpSetUser() sets the host, userid, and password for the
remote host that most of the other functions require.
FtpSetBinary() sets the default text translation
for functions that can use this. This Binary or Ascii setting
can be overriden by any function that takes it as an option
parameter.
Note that the host, userid, password, and account are retained
during the life of the process. If you are using the RxFtp
package within a .CMD file run the OS/2 prompt, this means the
life of the CMD.EXE process. You may want to 'blank' out the
password (at least) when you are finished, to prevent unauthorized
access to a host you previously used.
-------------------------------------------------------------------
File Functions
-------------------------------------------------------------------
FtpAppend(localFile,remoteFile[,"Binary" | "Ascii"])
FtpDelete(remoteFile)
FtpGet(localFile,remoteFile[,"Binary" | "Ascii"])
FtpPut(localFile,remoteFile[,"Binary" | "Ascii"])
FtpPutUnique(localFile,remoteFile[,"Binary" | "Ascii"])
FtpRename(oldFile,newFile)
These functions perform work on files. The function should
be obvious, except for FtpPutUnique() which insures the remote
file created is unique, and does not overwrite the name of a
file which already exists.
-------------------------------------------------------------------
Directory List Functions
-------------------------------------------------------------------
FtpLs(pattern,stem)
FtpDir(pattern,stem)
These functions return directory list information in the
stemmed variable passed in. FtpLs() returns 'short' form;
FtpDir() returns 'long' form. The Stem value should be
a string with a "." at the end. When the function completes,
the variable stem || ".0" will be set to the number of stem
variables returned, which are set in variables stem || ".1",
stem || ".2", etc.
-------------------------------------------------------------------
Directory Functions
-------------------------------------------------------------------
FtpPwd(variable)
FtpChDir(directory)
FtpMkDir(directory)
FtpRmDir(directory)
These functions work with directories. The function should be
obvious. FtpPwd() returns the name of the current directory on
the remote host if no error occurred in the variable "variable"
-------------------------------------------------------------------
Logoff Function
-------------------------------------------------------------------
FtpLogoff()
This function should be called to terminate all ftp sessions.
-------------------------------------------------------------------
Miscellaneous Functions
-------------------------------------------------------------------
FtpQuote(quote)
FtpSite(site)
FtpSys(variable)
FtpQuote() and FtpSite() pass information to server as the
"site" and "quote" commands do.
FtpSys() returns the name of the operating system that server
is running if no error occurred in the variable "variable"
-------------------------------------------------------------------
Proxy Function
-------------------------------------------------------------------
FtpProxy(host,userid,password,account,pFile,rFile[,"Binary" | "Ascii"])
FtpProxy() copies a file from the named host/userid/password/account
(account may be empty) to the host specified with the Set functions.
pFile is name of the file on the named host/userid/password/account,
rFile is the file on the host specified with the Set functions.
----------------------------------------------------------------------
Utilities Provided
----------------------------------------------------------------------
miniftp.cmd
------------
A test program demonstrating the use of the rxFtp package.