1#!/bin/sh
2#-*-tcl-*-
3# the next line restarts using wish \
4exec tclsh "$0" ${1+"$@"}
5
6catch {console show}
7
8puts "(pwd is '[pwd]', file volumes is '[file volumes]')"
9
10package require vfs
11
12package require vfs::zip
13package require vfs::urltype
14package require vfs::ftp
15package require vfs::http
16
17puts "Adding ftp:// volume..."
18vfs::urltype::Mount ftp
19set listing [glob -dir ftp://ftp.tcl.tk/pub *]
20puts "ftp.tcl.tk/pub listing"
21puts "$listing"
22puts "----"
23puts "(file volumes is '[file volumes]')"
24
25puts "Adding http:// volume..."
26vfs::urltype::Mount http
27set fd [open http://sourceforge.net/projects/tcl]
28set contents [read $fd] ; close $fd
29puts "Contents of <http://sourceforge.net/projects/tcl> web page"
30puts [string range $contents 0 100]
31puts "(first 100 out of [string length $contents] characters)"
32puts "----"
33puts "(file volumes is '[file volumes]')"
34
35puts "Mounting ftp://ftp.ucsd.edu/pub/alpha/ ..."
36vfs::ftp::Mount ftp://ftp.ucsd.edu/pub/alpha/ localmount
37cd localmount ; cd tcl
38puts "(pwd is now '[pwd]' which is effectively a transparent link\
39  to a remote ftp site)"
40puts "Contents of remote directory is:"
41foreach file [glob -nocomplain *] {
42    puts "\t$file"
43}
44puts "sourcing remote file 'vfsTest.tcl', using 'source vfsTest.tcl'"
45# This will actually source the contents of a file on the
46# remote ftp site (which is now the 'pwd').
47source vfsTest.tcl
48
49puts "Done"
50