mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 21:06:52 +03:00
549fecfff7
* screen.c (Xtry_to_select): Don't select a similar file when "name" can't be found in the panel (when deleting files the selection jumpped from the deleted "file" to a directory which started with the same character as "file", annoying). Strip known vfs suffixes from "name" before trying to select (I think Timur made this suggestion a few months ago). Know the vfs is mature enough to do this. * vfs/vfs.c (vfs_strip_suffix_from_filename): New function which strips known vfs suffixes from a filename and returns a malloced string which has to be freed. Possible improvement: strip vfs suffix from last path component. * vfs/extfs/*: added "umask 077" to every script.
70 lines
1.5 KiB
Bash
70 lines
1.5 KiB
Bash
#! /bin/sh
|
|
#
|
|
# Zoo file system
|
|
#
|
|
# Copyright ? U. N. Known
|
|
#
|
|
# This filesystem is _dangerous_. It used to create symlinks in filesystem
|
|
# with zoo file, it used to happily delete file from your filesystem.
|
|
# Now it is 'only' very ugly (it creates temporary files in ~/.mc/
|
|
#
|
|
|
|
ZOO=zoo
|
|
|
|
mczoofs_list ()
|
|
{
|
|
$ZOO l $1 | @AWK@ -v uid=${UID-0} '
|
|
BEGIN { hyphens=0 }
|
|
/^---/ { if (hyphens > 0) exit 0; hyphens=1; next }
|
|
/^[^\ ]/ { next }
|
|
{
|
|
if (NF < 8)
|
|
next
|
|
if ($8 ~ /^\^/)
|
|
$8=substr($8, 2)
|
|
if ($6 > 50)
|
|
$6=$6 + 1900
|
|
else
|
|
$6=$6 + 2000
|
|
split($7, a, ":")
|
|
if ($8 ~ /\/$/)
|
|
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
|
|
else
|
|
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
|
|
}' 2>/dev/null
|
|
exit 0
|
|
}
|
|
|
|
mczoofs_copyout ()
|
|
{
|
|
$ZOO xp $1 $2 | tail +6l > $3 2>/dev/null
|
|
exit 0
|
|
}
|
|
|
|
# zoo is stupid and won't be happy when the name has no extension.
|
|
# We have to do a small trick :) [pretty dirty, broken hack -- pavel]
|
|
if echo $2 | grep '\.zoo$'; then
|
|
:
|
|
else
|
|
SYMLINK=~/.mc/temporary.$2.zoo
|
|
if test -f $SYMLINK; then
|
|
SYMLINK=~/.mc/temporary.$2.
|
|
fi
|
|
if test -f $SYMLINK; then
|
|
echo "Ugh. I did not expect this to happen. Cleanup your ~/.mc."
|
|
sleep 5
|
|
exit 1
|
|
fi
|
|
ln -s $2 $SYMLINK
|
|
trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15
|
|
$2=$SYMLINK
|
|
fi
|
|
|
|
umask 077
|
|
|
|
case "$1" in
|
|
list) mczoofs_list $2; exit $?;;
|
|
copyout) mczoofs_copyout $2 $3 $4; exit $?;;
|
|
esac
|
|
exit 1
|