Artifact
d09081115aeae4a75ee05fb5c77d0f34fd4ac2f9:
Attachment "FTP-patch.tclsh" to
ticket [548540ffff]
added by
drcampbell
2002-05-15 17:38:32.
set g_errorMsg 0
# Overload ftp::DisplayMsg
proc ftp::DisplayMsg {s msg {state ""}} {
global g_config
global g_errorMsg
switch $state {
data {
if { $g_config(DataMsgs) } {
Prim::Info "FTPDATA: $msg"
}
}
control {
if { $g_config(ControlMsgs) } {
Prim::Info "FTPCONTROL: $msg"
}
}
error {
set g_errorMsg 1
if { $g_config(ErrorMsgs) } {
Prim::Info "FTPERROR: $msg"
}
}
default {
Prim::Info "FTPDEFAULT: $msg"
}
}
}
#
#
#
#
# Clear error message flag
set g_errorMsg 0
if { [ftp::Put $ftp_sess $inp_file $outfile] == 1 } {
# Success?
if {$g_errorMsg} {
Prim::Info "Error despite put success - failed!"
# Do something upon put success despite error
} else {
# Do something upon put success
}
} else {
# Failure
Prim::Info "Failed to send file."
# Do something upon put failure
}
#################################################################
Here's an example of what DisplayMsg outputs for a false-positive
put.
FTPERROR: Timeout of control connection after 15 sec.!
FTPDEFAULT: 3727360 bytes sent in 253 seconds (14732 Bytes/s)