ftp Library Package 2.1 for Tcl/Tk Manual Pages

NAME
ftp - Client-side tcl implementation of the ftp protocol
 
SYNOPSIS
package require ftp ?2.2?
 
ftp::Open  server  user  passwd  ?options?
ftp::Close  handle
ftp::Cd  handle  directory
ftp::Pwd  handle
ftp::Type  handle  ?ascii|binary|tenex?
ftp::List  handle  ?directory?
ftp::NList  handle  ?directory?
ftp::FileSize  handle  file
ftp::ModTime  handle  from  to
ftp::Delete  handle  file
ftp::Rename  handle  from  to
ftp::Put  handle  (local | -data "data")  ?remote?
ftp::Append  handle  (local | -data "data")  ?remote?
ftp::Get  handle  remote  ?(local | -variable varname)?
ftp::Reget  handle  remote  ?local?
ftp::Newer  handle  remote  ?local?
ftp::MkDir  handle  directory
ftp::RmDir  handle  directory
ftp::Quote  handle  arg1  arg2  ...
ftp::DisplayMsg  handle  msg  ?state?
 
variable ftp::VERBOSE
variable ftp::DEBUG
 
DESCRIPTION
The ftp library package provides the client side of the ftp protocol. The package implements active (default) and passive ftp sessions.

A new ftp session is started with the Open command. Quitting an existing ftp session is done by Close. All other commands can only be used in an opened ftp session else an error will occured. The ftp package includes file and directory manipulating commands for remote sites. To do the same stuff to the local site the built-in tcl commands like "cd" or "file command" are the best choice.

Two state variables controls the output of ftp. Setting VERBOSE to "1" forces to show all responses from the remote server. The default value is "0". Setting DEBUG to "1" enables debugging to show all the return code, states and "real" ftp commands. The default value is "0".

The procedure DisplayMsg is used to show the different messages from the ftp session. It is simple declared in ftp and must be overwritten by the programmer to make it more comfortable. A state variable for different states assigned to different colors is recommended by the author. For example:

.msg.text tag configure error -foreground red
.msg.text tag configure data -foreground brown
.msg.text tag configure control -foreground blue

namespace ftp {
    proc DisplayMsg {s msg {state ""}} {
        switch $state {
            data	{.msg.text insert end "$msg\n" data}
            control	{.msg.text insert end "$msg\n" control}
	    error	{.msg.f.text insert end "$msg\n" error}
        }	   
    }
}
BUGS
Correct execution of many commands depends upon proper behavior by the remote server, network and router configuration.

An update command placed in the procedure DisplayMsg run into persistent errors or infinite loops. The solution to this problem is to use "update idletasks", rather than a single update.


© 1999 Steffen Traeger