3 # External filesystem for mc, using mtools
4 # Written Ludek Brukner (lubr@barco.cz), 1997
6 # WARNING - This software is ALPHA - Absolutely NO WARRANTY
9 ### Change this when the commands are outside PATH
11 $mcopy = "mcopy -noQ";
15 $disk =~ s/^.*\/([^\/]*)$/\1/;
18 my ($path, $name, $size, $date, $time, $longname, @lst, @rv);
23 open(FILE,"$mdir $disk:/$path |");
26 /^ / && next; # ignore `non-file' lines
27 /^$/ && next; # ignore empty lines
28 /^\.\.?/ && next; # ignore `.' and `..'
30 $name = substr($_,0,12);
31 $name =~ s/^([^ ]*) +([^ ]+)[ \t]*$/$1.$2/;
37 ($size,$date,$time,$longname) = split(/[ \t]+/);
39 @lst = split(/([:ap])/, $time);
40 $lst[0] += 12 if ($lst[3] eq "p");
41 $time = sprintf("%02d:%02d", $lst[0], $lst[2]);
42 @lst = split(/-/, $date);
43 $lst[2] %= 100 if ($lst[2] > 100);
44 $date = sprintf ("%02d-%02d-%02d", @lst);
46 $name = $path . lc(($longname) ? $longname : $name);
49 printf("drwxr-xr-x 1 %-8d %-8d %8d %s %s %s\n", 0, 0, 0, $date, $time, $name);
53 printf("-rw-r--r-- 1 %-8d %-8d %8d %s %s %s\n", 0, 0, $size, $date, $time, $name);
64 @files = get_dirs("");
65 while ($file = shift(@files)) {
66 push @files, get_dirs("$file/");
72 my($archname,$filename,$dest) = @_;
73 system "$mcopy $disk:/$filename $dest >& /dev/null";
76 # system "touch /tmp/deb";
80 my($archname,$filename,$dest) = @_;
81 system "$mcopy $dest $disk:/$filename >& /dev/null";
84 if($ARGV[0] eq "list") { shift; &a_list(@ARGV); exit 0; }
85 elsif($ARGV[0] eq "copyout") { shift; &a_copyout(@ARGV); exit 0; }
86 elsif($ARGV[0] eq "copyin") { shift; &a_copyin(@ARGV); exit 0; }