3 'content' => "This file should have permissions 444\n",
5 'time' => 'Jan 11 10:00',
6 'dostime' => '01-11-10 10:00AM',
11 'content' => "This file should have permissions 666\n",
12 'perm' => 'rw-rw-rw-',
13 'time' => 'Feb 1 8:00',
14 'dostime' => '02-01-10 08:00AM',
19 'content' => "This file should have permissions 777\n",
20 'perm' => 'rwxrwxrwx',
21 'time' => 'Feb 1 8:00',
22 'dostime' => '02-01-10 08:00AM',
28 'content' => "This file should have permissions 001\n",
29 'perm' => '--S--S--t',
30 'time' => 'May 4 4:31',
31 'dostime' => '05-04-10 04:31AM'
37 'content' => "This file should have permissions 110\n",
38 'perm' => '--s--s--T',
39 'time' => 'May 4 4:31',
40 'dostime' => '05-04-10 04:31AM'
45 'name' => 'link -> file.txt',
47 'perm' => 'rwxrwxrwx',
48 'time' => 'Jan 6 4:42'
51 %link_link_absolute = (
53 'name' => 'link_absolute -> /data/ftp/file.txt',
55 'perm' => 'rwxrwxrwx',
56 'time' => 'Jan 6 4:45'
63 'time' => "Apr 27 5:12",
65 'dostime' => "04-27-10 05:12AM",
74 'time' => "Apr 23 3:12",
75 'dostime' => "04-23-10 03:12AM",
81 'name' => "weirddir.txt",
84 'time' => "Apr 23 3:12",
85 'dostime' => "04-23-10 03:12AM",
94 'time' => "Nov 01 2008",
95 'dostime' => "11-01-08 11:11AM",
104 'time' => "Nov 01 2008",
105 'dostime' => "11-01-08 11:11AM",
106 'perm' => "rwx--x--x"
114 'time' => "Jan 23 2:05",
115 'dostime' => "01-23-05 02:05AM",
116 'perm' => "rwxrwxrwx"
119 %file_empty_file_dat = (
120 'name' => "empty_file.dat",
122 'perm' => "rw-r--r--",
123 'time' => "Apr 27 11:01",
124 'dostime' => "04-27-10 11:01AM"
128 'name' => "file.txt",
129 'content' => "This is content of file \"file.txt\"\n",
130 'time' => "Apr 27 11:01",
131 'dostime' => "04-27-10 11:01AM",
132 'perm' => "rw-r--r--"
135 %file_someothertext_txt = (
136 'name' => "someothertext.txt",
137 'content' => "Some junk ;-) This file does not really exist.\n",
138 'time' => "Apr 27 11:01",
139 'dostime' => "04-27-10 11:01AM",
140 'perm' => "rw-r--r--"
144 '/fully_simulated/' => {
145 'files' => [ \%dir_dot, \%dir_ddot, \%dir_DOS, \%dir_UNIX ],
149 '/fully_simulated/UNIX/' => {
150 'files' => [ \%dir_dot, \%dir_ddot,
151 \%file_chmod1, \%file_chmod2, \%file_chmod3, \%file_chmod4, \%file_chmod5,
152 \%file_empty_file_dat, \%file_file_txt,
153 \%link_link, \%link_link_absolute, \%dir_dot_NeXT,
154 \%file_someothertext_txt, \%dir_weirddir_txt ],
158 '/fully_simulated/DOS/' => {
159 'files' => [ \%dir_dot, \%dir_ddot,
160 \%file_chmod1, \%file_chmod2, \%file_chmod3, \%file_chmod4, \%file_chmod5,
161 \%file_empty_file_dat, \%file_file_txt,
162 \%dir_dot_NeXT, \%file_someothertext_txt, \%dir_weirddir_txt ],
168 sub ftp_createcontent($) {
171 $type = $$list{'type'};
172 $eol = $$list{'eol'};
173 $list_ref = $$list{'files'};
177 if($type eq "unix") {
181 my $ftype = $file{'type'} ? $file{'type'} : "-";
182 my $fperm = $file{'perm'} ? $file{'perm'} : "rwxr-xr-x";
183 my $fuser = $file{'user'} ? sprintf("%15s", $file{'user'}) : "ftp-default";
184 my $fgroup = $file{'group'} ? sprintf("%15s", $file{'group'}) : "ftp-default";
186 if($file{'type'} eq "d") {
187 $fsize = $file{'size'} ? sprintf("%7s", $file{'size'}) : sprintf("%7d", 4096);
190 $fsize = sprintf("%7d", length $file{'content'});
192 my $fhlink = $file{'hlink'} ? sprintf("%4d", $file{'hlink'}) : " 1";
193 my $ftime = $file{'time'} ? sprintf("%10s", $file{'time'}) : "Jan 9 1933";
194 push(@contentlist, "$ftype$fperm $fhlink $fuser $fgroup $fsize $ftime $file{'name'}$eol");
199 elsif($type =~ /^dos$/) {
203 my $time = $file{'dostime'} ? $file{'dostime'} : "06-25-97 09:12AM";
205 if($file{'type'} =~ /^d$/) {
206 $size_or_dir = " <DIR> ";
209 $size_or_dir = sprintf("%20d", length $file{'content'});
211 push(@contentlist, "$time $size_or_dir $file{'name'}$eol");
217 sub wildcard_filesize($$) {
218 my ($list_type, $file) = @_;
219 $list = $lists{$list_type};
221 my $files = $list->{'files'};
224 if ($f{'name'} eq $file) {
226 return length $f{'content'};
228 elsif ($f{'type'} ne "d"){
239 sub wildcard_getfile($$) {
240 my ($list_type, $file) = @_;
241 $list = $lists{$list_type};
243 my $files = $list->{'files'};
246 if ($f{'name'} eq $file) {
248 return (length $f{'content'}, $f{'content'});
250 elsif ($f{'type'} ne "d"){
262 sub ftp_contentlist {
263 my $listname = $_[0];
264 $list = $lists{$listname};
265 return ftp_createcontent(\$list);