Wed Dec 16 06:47:47 1998 Norbert Warmuth <nwarmuth@privat.circular.de>

* 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.
This commit is contained in:
Norbert Warmuth 1998-12-16 06:16:13 +00:00
parent cb78daaa9b
commit 549fecfff7
16 changed files with 79 additions and 25 deletions

View File

@ -1,3 +1,13 @@
Wed Dec 16 06:27:00 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* 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.
1998-12-15 Miguel de Icaza <miguel@nuclecu.unam.mx> 1998-12-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
* dir.c (link_isdir): Remove unused variable. * dir.c (link_isdir): Remove unused variable.

View File

@ -831,47 +831,32 @@ do_select (WPanel *panel, int i)
void void
Xtry_to_select (WPanel *panel, char *name) Xtry_to_select (WPanel *panel, char *name)
{ {
int i, best = -1, bestl = -1; int i;
char *subdir; char *subdir;
if (!name) { if (!name) {
do_select(panel, 0); do_select(panel, 0);
return; return;
} }
/* We only want the last component of the directory */ /* We only want the last component of the directory */
subdir = x_basename(name); subdir = x_basename (name);
if (subdir < name) subdir = vfs_strip_suffix_from_filename (subdir);
subdir = name;
/* Search that subdirectory, if found select it */ /* Search that subdirectory, if found select it */
for (i = 0; i < panel->count; i++){ for (i = 0; i < panel->count; i++){
char *s = panel->dir.list [i].fname; if (strcmp (subdir, panel->dir.list [i].fname) == 0) {
int l = strlen (s);
if (strncmp (subdir, s, l))
continue;
if (l == strlen(subdir)){
/* Complete match, hilight */
do_select (panel, i); do_select (panel, i);
free (subdir);
return; return;
} }
if (bestl > l)
continue;
bestl = l;
best = i;
}
if (best != -1) {
/* Try to select longest inclusive match - good for vfs */
do_select (panel, best);
return;
} }
/* Try to select a file near the file that is missing */ /* Try to select a file near the file that is missing */
if (panel->selected >= panel->count) if (panel->selected >= panel->count)
do_select (panel, panel->count-1); do_select (panel, panel->count-1);
free (subdir);
} }
#ifndef PORT_HAS_PANEL_UPDATE_COLS #ifndef PORT_HAS_PANEL_UPDATE_COLS

View File

@ -1,3 +1,12 @@
Wed Dec 16 06:36:42 1998 Norbert Warmuth <nwarmuth@privat.circular.de>
* 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.
* extfs/*: added "umask 077" to every script.
Tue Dec 15 16:41:50 1998 Pavel Machek <pavel@atrey.karlin.mff.cuni.cz> Tue Dec 15 16:41:50 1998 Pavel Machek <pavel@atrey.karlin.mff.cuni.cz>
* extfs.c (extfs_open), sfs.c (redirect): create files 0600 and * extfs.c (extfs_open), sfs.c (redirect): create files 0600 and

View File

@ -130,6 +130,8 @@ version of it. There is no special upgrade option. Install always works.
EOInstall EOInstall
umask 077;
if($ARGV[0] eq "list") { shift; &mcdebfs_list(@ARGV); exit 0; } if($ARGV[0] eq "list") { shift; &mcdebfs_list(@ARGV); exit 0; }
elsif($ARGV[0] eq "copyout") { shift; &mcdebfs_copyout(@ARGV); exit 0; } elsif($ARGV[0] eq "copyout") { shift; &mcdebfs_copyout(@ARGV); exit 0; }
elsif($ARGV[0] eq "run") { shift; &mcdebfs_run(@ARGV); exit 0; } elsif($ARGV[0] eq "run") { shift; &mcdebfs_run(@ARGV); exit 0; }

View File

@ -105,6 +105,8 @@ if (/gzip/) {
exit 1 unless (open IN, "<$mbox_name"); exit 1 unless (open IN, "<$mbox_name");
} }
umask 077;
if($cmd eq "list") { &mailfs_list; exit 0; } if($cmd eq "list") { &mailfs_list; exit 0; }
elsif($cmd eq "copyout") { &mailfs_copyout(@ARGV); exit 0; } elsif($cmd eq "copyout") { &mailfs_copyout(@ARGV); exit 0; }

View File

@ -61,6 +61,7 @@ case $type in
*) exit 1 *) exit 1
esac esac
umask 077
case "$1" in case "$1" in
list) patchfs_list $2; exit 0;; list) patchfs_list $2; exit 0;;
copyout) patchfs_copyout $2 $3 $4; exit 0;; copyout) patchfs_copyout $2 $3 $4; exit 0;;

View File

@ -162,6 +162,7 @@ mcrpmfs_run ()
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
umask 077
case "$1" in case "$1" in
list) mcrpmfs_list "$2"; exit 0;; list) mcrpmfs_list "$2"; exit 0;;
copyout) mcrpmfs_copyout "$2" "$3" "$4"; exit 0;; copyout) mcrpmfs_copyout "$2" "$3" "$4"; exit 0;;

View File

@ -39,6 +39,7 @@ mcarfs_copyout ()
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
umask 077
case "$1" in case "$1" in
list) mcarfs_list $2; exit 0;; list) mcarfs_list $2; exit 0;;
copyout) shift; mcarfs_copyout $*; exit 0;; copyout) shift; mcarfs_copyout $*; exit 0;;

View File

@ -26,6 +26,7 @@ mcarjfs_copyout ()
$ARJ p $1 $2 2> $3 > /dev/null $ARJ p $1 $2 2> $3 > /dev/null
} }
umask 077
case "$1" in case "$1" in
list) mcarjfs_list $2; exit 0;; list) mcarjfs_list $2; exit 0;;
copyout) mcarjfs_copyout $2 $3 $4; exit 0;; copyout) mcarjfs_copyout $2 $3 $4; exit 0;;

View File

@ -60,6 +60,7 @@ mccpiofs_copyout ()
# #
# main # main
# #
umask 077
case "$1" in case "$1" in
list) mccpiofs_list $2 list) mccpiofs_list $2

View File

@ -135,6 +135,8 @@ mc_lha_fs_run()
# The main routine # The main routine
umask 077
case "$1" in case "$1" in
list) mc_lha_fs_list $2; exit $?;; list) mc_lha_fs_list $2; exit $?;;
copyout) mc_lha_fs_copyout $2 $3 $4; exit $?;; copyout) mc_lha_fs_copyout $2 $3 $4; exit $?;;

View File

@ -40,6 +40,7 @@ mcrarfs_copyout ()
{ {
$UNRAR p -c- -inul $1 $2 > $3 2>/dev/null $UNRAR p -c- -inul $1 $2 > $3 2>/dev/null
} }
umask 077
case "$1" in case "$1" in
list) mcrarfs_list $2; exit 0;; list) mcrarfs_list $2; exit 0;;

View File

@ -71,6 +71,8 @@ mczipfs_copyout ()
$XUNZIP -p $1 $2 > $3 2>/dev/null $XUNZIP -p $1 $2 > $3 2>/dev/null
} }
umask 077
case "$1" in case "$1" in
list) mczipfs_list $2; exit 0;; list) mczipfs_list $2; exit 0;;
copyout) mczipfs_copyout $2 $3 $4; exit 0;; copyout) mczipfs_copyout $2 $3 $4; exit 0;;

View File

@ -59,6 +59,9 @@ else
trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15 trap 'rm -f $SYMLINK' 0 1 2 3 5 13 15
$2=$SYMLINK $2=$SYMLINK
fi fi
umask 077
case "$1" in case "$1" in
list) mczoofs_list $2; exit $?;; list) mczoofs_list $2; exit $?;;
copyout) mczoofs_copyout $2 $3 $4; exit $?;; copyout) mczoofs_copyout $2 $3 $4; exit $?;;

View File

@ -146,6 +146,37 @@ vfs_type_from_op (char *path)
return NULL; /* shut up stupid gcc */ return NULL; /* shut up stupid gcc */
} }
/* Strip known vfs suffixes from a filename (possible improvement: strip
suffix from last path component).
Returns a malloced string which has to be freed. */
char *
vfs_strip_suffix_from_filename (char *filename)
{
vfs *vfs;
char *semi;
char *p;
if (!filename) vfs_die( "vfs_strip_suffix_from_path got NULL: impossible" );
p = strdup (filename);
if (!(semi = strrchr (p, '#')))
return p;
for (vfs = vfs_list; vfs != &vfs_local_ops; vfs = vfs->next){
if (vfs->which) {
if ((*vfs->which) (vfs, semi + 1) == -1)
continue;
*semi = '\0'; /* Found valid suffix */
return p;
}
if (!strncmp (semi + 1, vfs->prefix, strlen (vfs->prefix))) {
*semi = '\0'; /* Found valid suffix */
return p;
}
}
return p;
}
static int static int
path_magic (char *path) path_magic (char *path)
{ {

View File

@ -148,6 +148,7 @@ struct utimbuf {
vfsid vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par); vfsid vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par);
void vfs_rm_parents (struct vfs_stamping *stamp); void vfs_rm_parents (struct vfs_stamping *stamp);
char *vfs_path (char *path); char *vfs_path (char *path);
char *vfs_strip_suffix_from_filename (char *filename);
char *vfs_canon (char *path); char *vfs_canon (char *path);
char *mc_get_current_wd (char *buffer, int bufsize); char *mc_get_current_wd (char *buffer, int bufsize);
int vfs_current_is_local (void); int vfs_current_is_local (void);
@ -240,6 +241,7 @@ struct utimbuf {
# define vfs_current_is_tarfs() 0 # define vfs_current_is_tarfs() 0
# define vfs_current_is_extfs() 0 # define vfs_current_is_extfs() 0
# define vfs_path(x) x # define vfs_path(x) x
# define vfs_strip_suffix_from_filename (x) strdup(x)
# define mc_close close # define mc_close close
# define mc_read read # define mc_read read
# define mc_write write # define mc_write write