ftp Library Package 2.1 for Tcl/Tk Manual Pages
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} } } }
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.