mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
src/
* main.c (_do_panel_cd): If we are using GNOME, and the panel is a desktop panel, open up a new panel for the contents. gnome/ * gdesktop.c (create_panel_from_desktop): Assign selected_index when we find the last selected icon. (desktop_icon_info_open): Desktop directory open case moved to main.c to handle both general and action cd commands. vfs/ * extfs.c (extfs_unlink): (extfs_mkdir): (extfs_rmdir): (remove_entry): New functions. (vfs_extfs_ops): Add unlink, mkdir and rmdir functions to table. Add descriptions for these to the extfs README.
This commit is contained in:
parent
ba44c6a5f0
commit
9e7e543cef
@ -1,3 +1,10 @@
|
|||||||
|
1999-04-12 Andrew T. Veliath <andrewtv@usa.net>
|
||||||
|
|
||||||
|
* gdesktop.c (create_panel_from_desktop): Assign selected_index
|
||||||
|
when we find the last selected icon.
|
||||||
|
(desktop_icon_info_open): Desktop directory open case moved to
|
||||||
|
main.c to handle both general and action cd commands.
|
||||||
|
|
||||||
1999-04-12 Tuomas Kuosmanen <tigert@gimp.org>
|
1999-04-12 Tuomas Kuosmanen <tigert@gimp.org>
|
||||||
|
|
||||||
* glayout.c: Changed the stock icon for File->Delete to
|
* glayout.c: Changed the stock icon for File->Delete to
|
||||||
|
@ -1163,6 +1163,9 @@ create_panel_from_desktop (void)
|
|||||||
marked_count++;
|
marked_count++;
|
||||||
fe->f.marked = TRUE;
|
fe->f.marked = TRUE;
|
||||||
|
|
||||||
|
if (dii == last_selected_icon)
|
||||||
|
selected_index = count;
|
||||||
|
|
||||||
if (S_ISDIR (fe->buf.st_mode)) {
|
if (S_ISDIR (fe->buf.st_mode)) {
|
||||||
dir_marked_count++;
|
dir_marked_count++;
|
||||||
if (fe->f.dir_size_computed)
|
if (fe->f.dir_size_computed)
|
||||||
@ -1285,11 +1288,7 @@ desktop_icon_info_open (DesktopIconInfo *dii)
|
|||||||
} else {
|
} else {
|
||||||
WPanel *panel;
|
WPanel *panel;
|
||||||
panel = push_desktop_panel_hack ();
|
panel = push_desktop_panel_hack ();
|
||||||
/* we need to special case the new dir. Otherwise we'd try to cd */
|
do_enter_on_file_entry (fe);
|
||||||
if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe))
|
|
||||||
new_panel_at (filename);
|
|
||||||
else
|
|
||||||
do_enter_on_file_entry (fe);
|
|
||||||
layout_panel_gone (panel);
|
layout_panel_gone (panel);
|
||||||
free_panel_from_desktop (panel);
|
free_panel_from_desktop (panel);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
1999-04-12 Andrew T. Veliath <andrewtv@usa.net>
|
||||||
|
|
||||||
|
* main.c (_do_panel_cd): If we are using GNOME, and the panel is a
|
||||||
|
desktop panel, open up a new panel for the contents.
|
||||||
|
|
||||||
1999-04-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
1999-04-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
* tree.c (tree_start_search): Renamed from start_search() to avoid
|
* tree.c (tree_start_search): Renamed from start_search() to avoid
|
||||||
|
@ -1000,6 +1000,15 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type)
|
|||||||
}
|
}
|
||||||
directory = *new_dir ? new_dir : home_dir;
|
directory = *new_dir ? new_dir : home_dir;
|
||||||
|
|
||||||
|
#ifdef HAVE_GNOME
|
||||||
|
if (is_a_desktop_panel (panel)) {
|
||||||
|
new_panel_at (directory);
|
||||||
|
g_free (olddir);
|
||||||
|
g_free (translated_url);
|
||||||
|
return 0; /* Don't add to history */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mc_chdir (directory) == -1){
|
if (mc_chdir (directory) == -1){
|
||||||
strcpy (panel->cwd, olddir);
|
strcpy (panel->cwd, olddir);
|
||||||
g_free (olddir);
|
g_free (olddir);
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
1999-04-12 Andrew T. Veliath <andrewtv@usa.net>
|
||||||
|
|
||||||
|
* extfs.c (extfs_unlink):
|
||||||
|
(extfs_mkdir):
|
||||||
|
(extfs_rmdir):
|
||||||
|
(remove_entry): New functions.
|
||||||
|
(vfs_extfs_ops): Add unlink, mkdir and rmdir functions to table.
|
||||||
|
Add descriptions for these to the extfs README.
|
||||||
|
|
||||||
1999-04-12 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
|
1999-04-12 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
|
||||||
|
|
||||||
* Make-mc.in (DISTVFS): try to distribute files needed for
|
* Make-mc.in (DISTVFS): try to distribute files needed for
|
||||||
|
170
vfs/extfs.c
170
vfs/extfs.c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
Written by: 1995 Jakub Jelinek
|
Written by: 1995 Jakub Jelinek
|
||||||
Rewritten by: 1998 Pavel Machek
|
Rewritten by: 1998 Pavel Machek
|
||||||
|
Additional changes by: 1999 Andrew T. Veliath
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License
|
modify it under the terms of the GNU Library General Public License
|
||||||
@ -49,6 +50,7 @@
|
|||||||
static struct entry *
|
static struct entry *
|
||||||
find_entry (struct entry *dir, char *name, int make_dirs, int make_file);
|
find_entry (struct entry *dir, char *name, int make_dirs, int make_file);
|
||||||
static int extfs_which (vfs *me, char *path);
|
static int extfs_which (vfs *me, char *path);
|
||||||
|
static void remove_entry (struct entry *e);
|
||||||
|
|
||||||
static struct archive *first_archive = NULL;
|
static struct archive *first_archive = NULL;
|
||||||
static int my_errno = 0;
|
static int my_errno = 0;
|
||||||
@ -734,6 +736,128 @@ static int extfs_write (void *data, char *buf, int nbyte)
|
|||||||
return write (file->local_handle, buf, nbyte);
|
return write (file->local_handle, buf, nbyte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int extfs_unlink (vfs *me, char *file)
|
||||||
|
{
|
||||||
|
struct archive *archive;
|
||||||
|
char *q;
|
||||||
|
char *mc_extfsdir;
|
||||||
|
struct entry *entry;
|
||||||
|
char *cmd;
|
||||||
|
char *archive_name, *p;
|
||||||
|
|
||||||
|
if ((q = get_path_mangle (file, &archive, 0, 0)) == NULL)
|
||||||
|
return -1;
|
||||||
|
entry = find_entry (archive->root_entry, q, 0, 0);
|
||||||
|
if (entry == NULL)
|
||||||
|
return -1;
|
||||||
|
if ((entry = my_resolve_symlinks (entry)) == NULL)
|
||||||
|
return -1;
|
||||||
|
if (S_ISDIR (entry->inode->mode)) ERRNOR (EISDIR, -1);
|
||||||
|
|
||||||
|
p = get_path_from_entry (entry);
|
||||||
|
q = name_quote (p, 0);
|
||||||
|
g_free (p);
|
||||||
|
archive_name = name_quote (get_archive_name (archive), 0);
|
||||||
|
|
||||||
|
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
||||||
|
cmd = g_strconcat (mc_extfsdir, extfs_prefixes [archive->fstype],
|
||||||
|
" rm ", archive_name, " ", q, NULL);
|
||||||
|
g_free (q);
|
||||||
|
g_free (mc_extfsdir);
|
||||||
|
g_free (archive_name);
|
||||||
|
if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID | EXECUTE_WAIT, shell, cmd)){
|
||||||
|
g_free (cmd);
|
||||||
|
my_errno = EIO;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
g_free (cmd);
|
||||||
|
remove_entry (entry);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extfs_mkdir (vfs *me, char *path, mode_t mode)
|
||||||
|
{
|
||||||
|
struct archive *archive;
|
||||||
|
char *q;
|
||||||
|
char *mc_extfsdir;
|
||||||
|
struct entry *entry;
|
||||||
|
char *cmd;
|
||||||
|
char *archive_name, *p;
|
||||||
|
|
||||||
|
if ((q = get_path_mangle (path, &archive, 0, 0)) == NULL)
|
||||||
|
return -1;
|
||||||
|
entry = find_entry (archive->root_entry, q, 0, 0);
|
||||||
|
if (entry != NULL) ERRNOR (EEXIST, -1);
|
||||||
|
entry = find_entry (archive->root_entry, q, 1, 0);
|
||||||
|
if (entry == NULL)
|
||||||
|
return -1;
|
||||||
|
if ((entry = my_resolve_symlinks (entry)) == NULL)
|
||||||
|
return -1;
|
||||||
|
if (!S_ISDIR (entry->inode->mode)) ERRNOR (ENOTDIR, -1);
|
||||||
|
|
||||||
|
p = get_path_from_entry (entry);
|
||||||
|
q = name_quote (p, 0);
|
||||||
|
g_free (p);
|
||||||
|
archive_name = name_quote (get_archive_name (archive), 0);
|
||||||
|
|
||||||
|
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
||||||
|
cmd = g_strconcat (mc_extfsdir, extfs_prefixes [archive->fstype],
|
||||||
|
" mkdir ", archive_name, " ", q, NULL);
|
||||||
|
g_free (q);
|
||||||
|
g_free (mc_extfsdir);
|
||||||
|
g_free (archive_name);
|
||||||
|
if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID | EXECUTE_WAIT, shell, cmd)){
|
||||||
|
g_free (cmd);
|
||||||
|
my_errno = EIO;
|
||||||
|
remove_entry (entry);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
g_free (cmd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int extfs_rmdir (vfs *me, char *path)
|
||||||
|
{
|
||||||
|
struct archive *archive;
|
||||||
|
char *q;
|
||||||
|
char *mc_extfsdir;
|
||||||
|
struct entry *entry;
|
||||||
|
char *cmd;
|
||||||
|
char *archive_name, *p;
|
||||||
|
|
||||||
|
if ((q = get_path_mangle (path, &archive, 0, 0)) == NULL)
|
||||||
|
return -1;
|
||||||
|
entry = find_entry (archive->root_entry, q, 0, 0);
|
||||||
|
if (entry == NULL)
|
||||||
|
return -1;
|
||||||
|
if ((entry = my_resolve_symlinks (entry)) == NULL)
|
||||||
|
return -1;
|
||||||
|
if (!S_ISDIR (entry->inode->mode)) ERRNOR (ENOTDIR, -1);
|
||||||
|
|
||||||
|
p = get_path_from_entry (entry);
|
||||||
|
q = name_quote (p, 0);
|
||||||
|
g_free (p);
|
||||||
|
archive_name = name_quote (get_archive_name (archive), 0);
|
||||||
|
|
||||||
|
mc_extfsdir = concat_dir_and_file (mc_home, "extfs/");
|
||||||
|
cmd = g_strconcat (mc_extfsdir, extfs_prefixes [archive->fstype],
|
||||||
|
" rmdir ", archive_name, " ", q, NULL);
|
||||||
|
g_free (q);
|
||||||
|
g_free (mc_extfsdir);
|
||||||
|
g_free (archive_name);
|
||||||
|
if (my_system (EXECUTE_AS_SHELL | EXECUTE_SETUID | EXECUTE_WAIT, shell, cmd)){
|
||||||
|
g_free (cmd);
|
||||||
|
my_errno = EIO;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
g_free (cmd);
|
||||||
|
remove_entry (entry);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int extfs_chdir (vfs *me, char *path)
|
static int extfs_chdir (vfs *me, char *path)
|
||||||
{
|
{
|
||||||
struct archive *archive;
|
struct archive *archive;
|
||||||
@ -798,6 +922,46 @@ static int extfs_nothingisopen (vfsid id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void remove_entry (struct entry *e)
|
||||||
|
{
|
||||||
|
int i = --(e->inode->nlink);
|
||||||
|
struct entry *pe, *ent, *prev;
|
||||||
|
|
||||||
|
if (S_ISDIR (e->inode->mode) && e->inode->first_in_subdir != NULL) {
|
||||||
|
struct entry *f = e->inode->first_in_subdir;
|
||||||
|
e->inode->first_in_subdir = NULL;
|
||||||
|
remove_entry (f);
|
||||||
|
}
|
||||||
|
pe = e->dir;
|
||||||
|
if (e == pe->inode->first_in_subdir)
|
||||||
|
pe->inode->first_in_subdir = e->next_in_dir;
|
||||||
|
|
||||||
|
prev = NULL;
|
||||||
|
for (ent = pe->inode->first_in_subdir; ent && ent->next_in_dir;
|
||||||
|
ent = ent->next_in_dir)
|
||||||
|
if (e == ent->next_in_dir) {
|
||||||
|
prev = ent;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (prev)
|
||||||
|
prev->next_in_dir = e->next_in_dir;
|
||||||
|
if (e == pe->inode->last_in_subdir)
|
||||||
|
pe->inode->last_in_subdir = prev;
|
||||||
|
|
||||||
|
if (i <= 0) {
|
||||||
|
if (e->inode->local_filename != NULL) {
|
||||||
|
unlink (e->inode->local_filename);
|
||||||
|
g_free (e->inode->local_filename);
|
||||||
|
}
|
||||||
|
if (e->inode->linkname != NULL)
|
||||||
|
g_free (e->inode->linkname);
|
||||||
|
g_free (e->inode);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (e->name);
|
||||||
|
g_free (e);
|
||||||
|
}
|
||||||
|
|
||||||
static void free_entry (struct entry *e)
|
static void free_entry (struct entry *e)
|
||||||
{
|
{
|
||||||
int i = --(e->inode->nlink);
|
int i = --(e->inode->nlink);
|
||||||
@ -999,7 +1163,7 @@ vfs vfs_extfs_ops = {
|
|||||||
|
|
||||||
NULL, /* symlink */
|
NULL, /* symlink */
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
extfs_unlink,
|
||||||
|
|
||||||
NULL,
|
NULL,
|
||||||
extfs_chdir,
|
extfs_chdir,
|
||||||
@ -1014,8 +1178,8 @@ vfs vfs_extfs_ops = {
|
|||||||
extfs_getlocalcopy,
|
extfs_getlocalcopy,
|
||||||
extfs_ungetlocalcopy,
|
extfs_ungetlocalcopy,
|
||||||
|
|
||||||
NULL, /* mkdir */
|
extfs_mkdir, /* mkdir */
|
||||||
NULL,
|
extfs_rmdir,
|
||||||
NULL,
|
NULL,
|
||||||
extfs_setctl
|
extfs_setctl
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ $(libdir)/extfs (in our example $(libdir)/extfs/uzip).
|
|||||||
* Commands that should be implemented by your shell script
|
* Commands that should be implemented by your shell script
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
Return zero from your script upon completion of the command, otherwise
|
||||||
|
nonzero for failure or in case of an unsupported command.
|
||||||
|
|
||||||
$libdir/extfs/prefix command [arguments]
|
$libdir/extfs/prefix command [arguments]
|
||||||
|
|
||||||
* Command: list archivename
|
* Command: list archivename
|
||||||
@ -67,10 +70,10 @@ points to. (If this PATH starts with a MC vfs prefix, then it is a symlink
|
|||||||
somewhere to the other virtual filesystem (if you want to specify path from
|
somewhere to the other virtual filesystem (if you want to specify path from
|
||||||
the local root, use local:/path_name instead of /path_name, since /path_name
|
the local root, use local:/path_name instead of /path_name, since /path_name
|
||||||
means from root of the archive listed).
|
means from root of the archive listed).
|
||||||
|
|
||||||
If permissions do not start with l, but number of links is greater than one,
|
If permissions do not start with l, but number of links is greater than one,
|
||||||
then it says that this file should be a hardlinked with the other file.
|
then it says that this file should be a hardlinked with the other file.
|
||||||
|
|
||||||
|
|
||||||
* Command: copyout archivename storedfilename extractto
|
* Command: copyout archivename storedfilename extractto
|
||||||
|
|
||||||
This should extract from archive archivename the file called
|
This should extract from archive archivename the file called
|
||||||
@ -89,6 +92,19 @@ archivename will be something like /tmp/f43513254 or just
|
|||||||
anything. Some archivers do not like it, so you'll have to find some
|
anything. Some archivers do not like it, so you'll have to find some
|
||||||
workaround.
|
workaround.
|
||||||
|
|
||||||
|
* Command: rm archivename storedfilename
|
||||||
|
|
||||||
|
This should remove storedfilename from archivename.
|
||||||
|
|
||||||
|
* Command: mkdir archivename dirname
|
||||||
|
|
||||||
|
This should create a new directory called dirname inside archivename.
|
||||||
|
|
||||||
|
* Command: rmdir archivename dirname
|
||||||
|
|
||||||
|
This should remove an existing directory dirname. If the directory is
|
||||||
|
not empty, mc will recursively delete it (possibly prompting).
|
||||||
|
|
||||||
* Command: run
|
* Command: run
|
||||||
|
|
||||||
Undocumented :-)
|
Undocumented :-)
|
||||||
|
Loading…
Reference in New Issue
Block a user