Attachment "ftp.patch" to
ticket [659238ffff]
added by
ddrogahn
2003-03-26 09:07:15.
*** ORIG ftp.tcl Wed Nov 06 15:02:58 2002
--- ftp.tcl Fri Dec 27 20:13:56 2002
***************
*** 24,28 ****
# ftp::NList <s> <?directory?>
# ftp::FileSize <s> <file>
! # ftp::ModTime <s> <from> <to>
# ftp::Delete <s> <file>
# ftp::Rename <s> <from> <to>
--- 24,28 ----
# ftp::NList <s> <?directory?>
# ftp::FileSize <s> <file>
! # ftp::ModTime <s> <file> <?newtime?>
# ftp::Delete <s> <file>
# ftp::Rename <s> <from> <to>
***************
*** 548,552 ****
}
modtime {
! PutsCtrlSock $s "MDTM $ftp(File)"
set ftp(State) modtime_sent
}
--- 548,556 ----
}
modtime {
! if {$ftp(DateTime) != ""} {
! PutsCtrlSock $s "MDTM $ftp(DateTime) $ftp(File)"
! } else { ;# No DateTime Specified
! PutsCtrlSock $s "MDTM $ftp(File)"
! }
set ftp(State) modtime_sent
}
***************
*** 560,564 ****
}
default {
! set errmsg "Error getting modification time!"
set complete_with 0
Command $ftp(Command) error $errmsg
--- 564,572 ----
}
default {
! if {$ftp(DateTime) != ""} {
! set errmsg "Error setting modification time! No server MDTM support?"
! } else {
! set errmsg "Error getting modification time!"
! }
set complete_with 0
Command $ftp(Command) error $errmsg
***************
*** 1307,1310 ****
--- 1315,1319 ----
# Arguments:
# filename - specifies the remote file name
+ # datetime - optional new timestamp for file
#
# Returns:
***************
*** 1312,1317 ****
# value in seconds (see tcls clock command) or {} in
# error cases
! proc ftp::ModTime {s {filename ""}} {
upvar ::ftp::ftp$s ftp
--- 1321,1327 ----
# value in seconds (see tcls clock command) or {} in
# error cases
+ # if MDTM not supported on server, returns original timestamp
! proc ftp::ModTime {s {filename ""} {datetime ""}} {
upvar ::ftp::ftp$s ftp
***************
*** 1330,1334 ****
set ftp(File) $filename
! set ftp(DateTime) ""
set ftp(State) modtime
--- 1340,1348 ----
set ftp(File) $filename
!
! if {$datetime != ""} {
! set datetime [clock format $datetime -format "%Y%m%d%H%M%S"]
! }
! set ftp(DateTime) $datetime
set ftp(State) modtime
***************
*** 1341,1345 ****
unset ftp(File)
}
-
if { ![string length $ftp(Command)] && $rc } {
return [ModTimePostProcess $ftp(DateTime)]
--- 1355,1358 ----