De-fuzzyed some msgs...
[midnight-commander.git] / vfs / extfs / uzoo.in
blobbf6f1f9ab75482d7e0e865a9e7e263d8f96a30f9
1 #! /bin/sh
3 # Zoo file system
5 # Copyright ? U. N. Known
7 # This filesystem is _dangerous_. It used to create symlinks in filesystem
8 # with zoo file, it used to happily delete file from your filesystem.
9 # Now it is 'only' very ugly (it creates temporary files in ~/.mc/
12 ZOO=zoo
14 mczoofs_list ()
16 $ZOO l $1 | @AWK@ -v uid=${UID-0} '
17 BEGIN { hyphens=0 }
18 /^---/ { if (hyphens > 0) exit 0; hyphens=1; next }
19 /^[^\ ]/ { next }
21 if (NF < 8)
22 next
23 if ($8 ~ /^\^/)
24 $8=substr($8, 2)
25 if ($6 > 50)
26 $6=$6 + 1900
27 else
28 $6=$6 + 2000
29 split($7, a, ":")
30 if ($8 ~ /\/$/)
31 printf "drwxr-xr-x 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
32 else
33 printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8
34 }' 2>/dev/null
35 exit 0
38 mczoofs_copyout ()
40 $ZOO xp $1 $2 | tail +6l > $3 2>/dev/null
41 exit 0
44 # zoo is stupid and won't be happy when the name has no extension.
45 # We have to do a small trick :) [pretty dirty, broken hack -- pavel]
46 if echo $2 | grep '\.zoo$' >/dev/null; then
48 else
49 SYMLINK=$HOME/.mc/temporary.$2.zoo
50 if test -f $SYMLINK; then
51 SYMLINK=$HOME/.mc/temporary.$2.
53 if test -f $SYMLINK; then
54 echo "Ugh. I did not expect this to happen. Cleanup your ~/.mc."
55 sleep 5
56 exit 1
58 ln -s $2 $SYMLINK
59 trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15
60 $2=$SYMLINK
63 umask 077
65 case "$1" in
66 list) mczoofs_list $2; exit $?;;
67 copyout) mczoofs_copyout $2 $3 $4; exit $?;;
68 esac
69 exit 1