Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/FTP/Tcl/ftp-1.tcl
Normal file
9
Task/FTP/Tcl/ftp-1.tcl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package require ftp
|
||||
|
||||
set conn [::ftp::Open kernel.org anonymous "" -mode passive]
|
||||
::ftp::Cd $conn /pub/linux/kernel
|
||||
foreach line [ftp::NList $conn] {
|
||||
puts $line
|
||||
}
|
||||
::ftp::Type $conn binary
|
||||
::ftp::Get $conn README README
|
||||
12
Task/FTP/Tcl/ftp-2.tcl
Normal file
12
Task/FTP/Tcl/ftp-2.tcl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package require vfs::urltype
|
||||
vfs::urltype::Mount ftp
|
||||
|
||||
# Patch to enable FTP passive mode.
|
||||
source vfsftpfix.tcl
|
||||
|
||||
set dir [pwd]
|
||||
cd ftp://kernel.org/pub/linux/kernel
|
||||
foreach line [glob -dir ftp://kernel.org/pub/linux/kernel *] {
|
||||
puts $line
|
||||
}
|
||||
file copy README [file join $dir README]
|
||||
50
Task/FTP/Tcl/ftp-3.tcl
Normal file
50
Task/FTP/Tcl/ftp-3.tcl
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Replace vfs::ftp::Mount to enable vfs::ftp to work in passive
|
||||
# mode and make that the default.
|
||||
package require vfs::ftp
|
||||
proc vfs::ftp::Mount {dirurl local {mode passive}} {
|
||||
set dirurl [string trim $dirurl]
|
||||
::vfs::log "ftp-vfs: attempt to mount $dirurl at $local"
|
||||
if {[string index $dirurl end] != "/"} {
|
||||
::vfs::log "ftp-vfs: adding missing directory delimiter to mount point"
|
||||
append dirurl "/"
|
||||
}
|
||||
|
||||
set urlRE {(?:ftp://)?(?:([^@:]*)(?::([^@]*))?@)?([^/:]+)(?::([0-9]*))?/(.*/)?$}
|
||||
if {![regexp $urlRE $dirurl - user pass host port path]} {
|
||||
return -code error "Sorry I didn't understand\
|
||||
the url address \"$dirurl\""
|
||||
}
|
||||
|
||||
if {![string length $user]} {
|
||||
set user anonymous
|
||||
}
|
||||
|
||||
if {![string length $port]} {
|
||||
set port 21
|
||||
}
|
||||
|
||||
set fd [::ftp::Open $host $user $pass -port $port -output ::vfs::ftp::log -mode $mode]
|
||||
if {$fd == -1} {
|
||||
error "Mount failed"
|
||||
}
|
||||
|
||||
if {$path != ""} {
|
||||
if {[catch {
|
||||
::ftp::Cd $fd $path
|
||||
} err]} {
|
||||
ftp::Close $fd
|
||||
error "Opened ftp connection, but then received error: $err"
|
||||
}
|
||||
}
|
||||
|
||||
if {![catch {vfs::filesystem info $dirurl}]} {
|
||||
# unmount old mount
|
||||
::vfs::log "ftp-vfs: unmounted old mount point at $dirurl"
|
||||
vfs::unmount $dirurl
|
||||
}
|
||||
::vfs::log "ftp $host, $path mounted at $fd"
|
||||
vfs::filesystem mount $local [list vfs::ftp::handler $fd $path]
|
||||
# Register command to unmount
|
||||
vfs::RegisterMount $local [list ::vfs::ftp::Unmount $fd]
|
||||
return $fd
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue