Rerun configure when you have problems with missing slang.h.
Sun Jan 31 20:04:13 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * vfs/vfs.c (vfs_strip_suffix_from_filename): Whoever replaces every occurance of 0 with NULL should stop this stupidy. And replacing '\0' with NULL is plain wrong!!. Reverted this replacement. * vfs/ftpfs.c (load_no_proxy_list): ditto Fri Jan 29 22:55:56 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * slang/slang.h: renamed to slang-mc.h * slang/Makefile.in: delete slang.h on "make clean" * configure.in: link slang/slang-mc.h to slang/slang.h when the included slang is used. Problem was that MC's slang.h was used when we compiled with an already installed SLang and the systems header file were included with <slang/slang.h>. Unfortunatly I can't use AC_LINK_FILES to make the links because if we needn't make any links AC_LINK_FILES makes a link from srcdir to top_builddir (builddir != srcdir). Temporary add $LGPM to $LIBS when checking for the resizeterm and keyok functions (ncurses might be linked against GPM). Substitude PACKAGE (intl/Makefile makes use of it) Sun Jan 31 19:42:47 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * gnome/Makefile.in (install_mx): make it work with srcdir != builddir (gmc.gnorba is located in $srcdir) * src/hotlist.c (add_new_entry_input, add_new_group_input): Make the quick_widget arrays static and various changes needed because they are now static. add_widgets_i18n recalculates button positions which get lost when the quick_widget arrays are non static. * src/screen.c (to_buffer): nul terminate string when using strncpy * src/setup.c: Save and restore new option ftpfs_first_cd_then_ls. Sun Jan 31 19:57:24 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * vfs/ftpfs.c (insert_dot): New function. Insert a "." into the linked list. Stat'ing the root directory of a ftpfs fails if the dot is missing. (retrieve_dir): insert "." into the linked list if the ftp server haven't send it. Sun Jan 31 19:50:24 1999 Norbert Warmuth <nwarmuth@privat.circular.de> * The following changes make ftpfs work with a remote AmiTCP server are the result of somehow longish EMail debugging session. I don't know any public server of this kind but I was told the combination Unix/Amiga boxes are often used in intranets. * vfs/ftpfs.c (translate_path): New function. Translate a Unix path, i.e. MC's internal path representation (e.g. /somedir/somefile) to a path valid for the remote server. Every path transfered to the remote server has to be mangled by this function right prior to sending it. Currently only Amiga ftp servers are handled in a special manner. * vfs/ftpfs.c (various places): use translate_path * vfs/ftpfs.c (login_server): Assume we have to mangle pathnames if the greatings string from the server contains the word Amiga. If this assumption is wrong I have to find another way to turn on path translation. * vfs/ftpfs.c (ftpfs_get_current_directory): Prepend a leading slash if it is missing. MC needs it as seperator between hostname and path in its internal url representation.
Этот коммит содержится в:
родитель
fbb8c67838
Коммит
f75a6470ca
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
Fri Jan 29 22:55:56 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* slang/slang.h: renamed to slang-mc.h
|
||||
|
||||
* slang/Makefile.in: delete slang.h on "make clean"
|
||||
|
||||
* configure.in: link slang/slang-mc.h to slang/slang.h when the
|
||||
included slang is used. Problem was that MC's slang.h was used
|
||||
when we compiled with an already installed SLang and the systems
|
||||
header file were included with <slang/slang.h>.
|
||||
Unfortunatly I can't use AC_LINK_FILES to make the links because
|
||||
if we needn't make any links AC_LINK_FILES makes a link from
|
||||
srcdir to top_builddir (builddir != srcdir).
|
||||
|
||||
Temporary add $LGPM to $LIBS when checking for the resizeterm
|
||||
and keyok functions (ncurses might be linked against GPM).
|
||||
|
||||
Substitude PACKAGE (intl/Makefile makes use of it)
|
||||
|
||||
Wed Jan 27 03:34:44 1999 Timur Bakeyev <mc@bat.ru>
|
||||
|
||||
* gtkedit/edit.h: including of <malloc.h> and <stdlib.h> swaped by
|
||||
|
12
configure.in
12
configure.in
@ -9,6 +9,7 @@ VERSION=4.5.9
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
|
||||
AC_SUBST(VERSION)
|
||||
AC_SUBST(PACKAGE)
|
||||
|
||||
dnl This is path where we're looking for headers in addition to /usr/include
|
||||
dnl and whatever cpp defaults to.
|
||||
@ -819,12 +820,16 @@ AC_DEFUN(AC_WITH_SLANG,
|
||||
LSLANG="-lslang"
|
||||
screen_manager="SLang (using system-installed library)"
|
||||
AC_MSG_RESULT(Using system installed SLang library)
|
||||
rm slang/slang.h
|
||||
else
|
||||
MCCPPFLAGS="$MCCPPFLAGS -I\$(slangdir)"
|
||||
LIBSLANG="libmcslang.a"
|
||||
screen_manager="SLang"
|
||||
LSLANG="-lmcslang"
|
||||
CPPFLAGS="$CPPFLAGS -I../slang"
|
||||
fastdepslang=fastdepslang
|
||||
rm slang/slang.h
|
||||
ln -s ../$srcdir/slang/slang-mc.h slang/slang.h
|
||||
fi
|
||||
if $slang_check_lib
|
||||
then
|
||||
@ -1071,7 +1076,14 @@ changequote([,])dnl
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Ncurses may be linked against libgpm. Change LIBS temporary for
|
||||
dnl check for resizeterm and keyok.
|
||||
dnl
|
||||
SAVED_LIBS="$LIBS"
|
||||
LIBS="$LIBS $LGPM"
|
||||
AC_CHECK_FUNCS(resizeterm keyok)
|
||||
LIBS="$SAVED_LIBS"
|
||||
|
||||
if test "x$screen_manager" = "xunknown"; then
|
||||
AC_WITH_SLANG
|
||||
|
@ -1,3 +1,8 @@
|
||||
Sun Jan 31 19:42:47 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* Makefile.in (install_mx): make it work with srcdir != builddir
|
||||
(gmc.gnorba is located in $srcdir)
|
||||
|
||||
1999-01-29 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gdesktop.c (reload_desktop_icons): Move metadata_unlock after
|
||||
|
@ -284,7 +284,7 @@ install_mx: all
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(datadir)/mime-info
|
||||
$(INSTALL_DATA) mc.keys $(DESTDIR)$(datadir)/mime-info
|
||||
$(mcsrcdir)/xmkdir $(DESTDIR)$(corbadir)
|
||||
$(INSTALL_DATA) gmc.gnorba $(DESTDIR)$(corbadir)
|
||||
$(INSTALL_DATA) $(srcdir)/gmc.gnorba $(DESTDIR)$(corbadir)
|
||||
|
||||
uninstall:
|
||||
-$(RMF) $(DESTDIR)$(bindir)/$(binprefix)gmc
|
||||
|
@ -1 +1,2 @@
|
||||
Makefile
|
||||
slang.h
|
||||
|
@ -51,7 +51,7 @@ TAGS: $(SLANGSRCS)
|
||||
etags $(SLANGSRCS)
|
||||
|
||||
clean:
|
||||
$(RMF) *.o core a.out libmcslang.a
|
||||
$(RMF) *.o core a.out libmcslang.a slang.h
|
||||
|
||||
realclean: clean
|
||||
$(RMF) .depend
|
||||
|
@ -1,3 +1,14 @@
|
||||
Sun Jan 31 19:49:00 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* hotlist.c (add_new_entry_input, add_new_group_input): Make the
|
||||
quick_widget arrays static and various changes needed because they
|
||||
are now static. add_widgets_i18n recalculates button positions
|
||||
which get lost when the quick_widget arrays are non static.
|
||||
|
||||
* screen.c (to_buffer): nul terminate string when using strncpy
|
||||
|
||||
* setup.c: Save and restore new option ftpfs_first_cd_then_ls.
|
||||
|
||||
1999-01-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* file.c (panel_operate_generate_prompt): Removed the cmd_buf
|
||||
|
@ -805,18 +805,26 @@ static void add_widgets_i18n(QuickWidget* qw, int len)
|
||||
|
||||
static int add_new_entry_input (char *header, char *text1, char *text2, char *help, char **r1, char **r2)
|
||||
{
|
||||
#define RELATIVE_Y_BUTTONS 4
|
||||
#define RELATIVE_Y_LABEL_PTH 3
|
||||
#define RELATIVE_Y_INPUT_PTH 4
|
||||
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets [] = {
|
||||
{ quick_button, 55, 80, 4, 0, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
XV_WLAY_DONTCARE, "button-cancel" },
|
||||
{ quick_button, 30, 80, 4, 0, N_("&Insert"), 0, B_INSERT, 0, 0,
|
||||
XV_WLAY_DONTCARE, "button-insert" },
|
||||
{ quick_button, 10, 80, 4, 0, N_("&Append"), 0, B_APPEND, 0, 0,
|
||||
XV_WLAY_DONTCARE, "button-append" },
|
||||
{ quick_input, 4, 80, 4, 0, "",58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-pth" },
|
||||
{ quick_label, 3, 80, 3, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-pth" },
|
||||
{ quick_input, 4, 80, 3, 0, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input-lbl" },
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, "label-lbl" },
|
||||
static QuickWidget quick_widgets [] = {
|
||||
{ quick_button, 55, 80, RELATIVE_Y_BUTTONS, 0, N_("&Cancel"), 0, B_CANCEL,
|
||||
0, 0, XV_WLAY_DONTCARE, "button-cancel" },
|
||||
{ quick_button, 30, 80, RELATIVE_Y_BUTTONS, 0, N_("&Insert"), 0, B_INSERT,
|
||||
0, 0, XV_WLAY_DONTCARE, "button-insert" },
|
||||
{ quick_button, 10, 80, RELATIVE_Y_BUTTONS, 0, N_("&Append"), 0, B_APPEND,
|
||||
0, 0, XV_WLAY_DONTCARE, "button-append" },
|
||||
{ quick_input, 4, 80, RELATIVE_Y_INPUT_PTH, 0, "",58, 0,
|
||||
0, 0, XV_WLAY_BELOWCLOSE, "input-pth" },
|
||||
{ quick_label, RELATIVE_Y_LABEL_PTH, 80, 3, 0, 0, 0, 0,
|
||||
0, 0, XV_WLAY_DONTCARE, "label-pth" },
|
||||
{ quick_input, 4, 80, 3, 0, "", 58, 0,
|
||||
0, 0, XV_WLAY_BELOWCLOSE, "input-lbl" },
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0,
|
||||
0, 0, XV_WLAY_DONTCARE, "label-lbl" },
|
||||
{ 0 } };
|
||||
|
||||
int len;
|
||||
@ -855,11 +863,11 @@ static int add_new_entry_input (char *header, char *text1, char *text2, char *he
|
||||
quick_widgets [i].y_divisions = lines1+lines2+7;
|
||||
Quick_input.ylen = lines1 + lines2 + 7;
|
||||
|
||||
quick_widgets [0].relative_y += (lines1 + lines2);
|
||||
quick_widgets [1].relative_y += (lines1 + lines2);
|
||||
quick_widgets [2].relative_y += (lines1 + lines2);
|
||||
quick_widgets [3].relative_y += (lines1);
|
||||
quick_widgets [4].relative_y += (lines1);
|
||||
quick_widgets [0].relative_y = RELATIVE_Y_BUTTONS + (lines1 + lines2);
|
||||
quick_widgets [1].relative_y = RELATIVE_Y_BUTTONS + (lines1 + lines2);
|
||||
quick_widgets [2].relative_y = RELATIVE_Y_BUTTONS + (lines1 + lines2);
|
||||
quick_widgets [3].relative_y = RELATIVE_Y_INPUT_PTH + (lines1);
|
||||
quick_widgets [4].relative_y = RELATIVE_Y_LABEL_PTH + (lines1);
|
||||
|
||||
quick_widgets [5].str_result = &my_str1;
|
||||
quick_widgets [3].str_result = &my_str2;
|
||||
@ -899,7 +907,7 @@ static int add_new_group_input (char *header, char *label, char **result)
|
||||
{
|
||||
int ret;
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets [] = {
|
||||
static QuickWidget quick_widgets [] = {
|
||||
{ quick_button, 55, 80, 1, 0, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
XV_WLAY_DONTCARE, "button-cancel" },
|
||||
{ quick_button, 30, 80, 1, 0, N_("&Insert"), 0, B_INSERT, 0, 0,
|
||||
@ -909,7 +917,8 @@ static int add_new_group_input (char *header, char *label, char **result)
|
||||
{ quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, XV_WLAY_BELOWCLOSE, "input" },
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0, 0, 0, XV_WLAY_DONTCARE, "label" },
|
||||
{ 0 } };
|
||||
|
||||
int relative_y[] = {1, 1, 1, 0, 2}; /* the relative_x component from the
|
||||
quick_widgets variable above */
|
||||
int len;
|
||||
int i;
|
||||
int lines;
|
||||
@ -943,7 +952,7 @@ static int add_new_group_input (char *header, char *label, char **result)
|
||||
Quick_input.ylen = lines + 6;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
quick_widgets [i].relative_y += 2 + lines;
|
||||
quick_widgets [i].relative_y = relative_y[i] + 2 + lines;
|
||||
|
||||
quick_widgets [3].str_result = &my_str;
|
||||
quick_widgets [3].text = "";
|
||||
|
@ -477,6 +477,7 @@ to_buffer (char *dest, int just_mode, int len, char *txt)
|
||||
*dest++ = ' ';
|
||||
strncpy (dest, txt, len);
|
||||
dest += txtlen;
|
||||
*dest = 0;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ extern int use_netrc;
|
||||
extern int ftpfs_retry_seconds;
|
||||
extern int ftpfs_use_passive_connections;
|
||||
extern int ftpfs_use_unix_list_options;
|
||||
extern int ftpfs_first_cd_then_ls;
|
||||
#endif
|
||||
|
||||
/* "$Id$" */
|
||||
@ -223,6 +224,7 @@ static struct {
|
||||
{ "ftpfs_always_use_proxy", &ftpfs_always_use_proxy },
|
||||
{ "ftpfs_use_passive_connections", &ftpfs_use_passive_connections },
|
||||
{ "ftpfs_use_unix_list_options", &ftpfs_use_unix_list_options },
|
||||
{ "ftpfs_first_cd_then_ls", &ftpfs_first_cd_then_ls },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
|
@ -1,3 +1,45 @@
|
||||
Sun Jan 31 20:04:13 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* vfs.c (vfs_strip_suffix_from_filename): Whoever replaces every
|
||||
occurance of 0 with NULL should stop this stupidy. And replacing
|
||||
'\0' with NULL is plan wrong!!. Reverted this replacement.
|
||||
|
||||
* ftpfs.c (load_no_proxy_list): ditto
|
||||
|
||||
Sun Jan 31 19:57:24 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* ftpfs.c (insert_dot): New function. Insert a "." into the linked
|
||||
list. Stat'ing the root directory of a ftpfs fails if the dot is
|
||||
missing.
|
||||
|
||||
(retrieve_dir): insert "." into the linked list if the ftp server
|
||||
haven't send it.
|
||||
|
||||
Sun Jan 31 19:50:24 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* The following changes make ftpfs work with a remote AmiTCP
|
||||
server are the result of somehow longish EMail debugging session. I
|
||||
don't know any public server of this kind but I was told the
|
||||
combination Unix/Amiga boxes are often used in intranets.
|
||||
|
||||
* ftpfs.c (translate_path): New function. Translate a Unix path,
|
||||
i.e. MC's internal path representation (e.g. /somedir/somefile) to
|
||||
a path valid for the remote server. Every path transfered to the
|
||||
remote server has to be mangled by this function right prior to
|
||||
sending it. Currently only Amiga ftp servers are handled in a
|
||||
special manner.
|
||||
|
||||
* ftpfs.c (various places): use translate_path
|
||||
|
||||
* ftpfs.c (login_server): Assume we have to mangle pathnames if
|
||||
the greatings string from the server contains the word Amiga. If
|
||||
this assumption is wrong I have to find another way to turn on
|
||||
path translation.
|
||||
|
||||
* ftpfs.c (ftpfs_get_current_directory): Prepend a leading slash
|
||||
if it is missing. MC needs it as seperator between hostname and
|
||||
path in its internal url representation.
|
||||
|
||||
1999-01-26 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
|
||||
|
||||
* vfs.c (vfs_parse_ls_lga): attempt to correctly work against
|
||||
|
147
vfs/ftpfs.c
147
vfs/ftpfs.c
@ -106,6 +106,9 @@ int ftpfs_use_passive_connections = 1;
|
||||
*/
|
||||
int ftpfs_use_unix_list_options = 1;
|
||||
|
||||
/* First "CWD <path>", then "LIST -la ." */
|
||||
int ftpfs_first_cd_then_ls;
|
||||
|
||||
/* Use the ~/.netrc */
|
||||
int use_netrc = 1;
|
||||
|
||||
@ -152,6 +155,56 @@ static int get_line (int sock, char *buf, int buf_len,
|
||||
static char *get_path (struct connection **bucket,
|
||||
char *path);
|
||||
|
||||
/* char *translate_path (struct ftpfs_connection *bucket, char *remote_path)
|
||||
Translate a Unix path, i.e. MC's internal path representation (e.g.
|
||||
/somedir/somefile) to a path valid for the remote server. Every path
|
||||
transfered to the remote server has to be mangled by this function
|
||||
right prior to sending it.
|
||||
Currently only Amiga ftp servers are handled in a special manner.
|
||||
|
||||
When the remote server is an amiga:
|
||||
a) strip leading slash if necesarry
|
||||
b) replace first occurance of ":/" with ":"
|
||||
c) strip trailing "/."
|
||||
*/
|
||||
|
||||
static char *
|
||||
translate_path (struct connection *bucket, char *remote_path)
|
||||
{
|
||||
char *p;
|
||||
static char buf[255]; /* No one ever needs more ;-).
|
||||
Actually I consider this static a bug
|
||||
-- Norbert */
|
||||
|
||||
if (!bucket->remote_is_amiga || strlen (remote_path) >= sizeof (buf) - 1)
|
||||
return remote_path;
|
||||
else {
|
||||
if (logfile) {
|
||||
fprintf (logfile, "MC -- translate_path: %s\n", remote_path);
|
||||
fflush (logfile);
|
||||
}
|
||||
|
||||
if (*remote_path == '/' && remote_path[1] == '\0')
|
||||
return "."; /* Don't change "/" into "", e.g. "CWD " would be
|
||||
invalid. */
|
||||
|
||||
/* strip leading slash */
|
||||
if (*remote_path == '/')
|
||||
strcpy (buf, remote_path + 1);
|
||||
else
|
||||
strcpy (buf, remote_path);
|
||||
|
||||
/* replace first occurance of ":/" with ":" */
|
||||
if ((p = strchr (buf, ':')) && *(p + 1) == '/')
|
||||
strcpy (p + 1, p + 2);
|
||||
|
||||
/* strip trailing "/." */
|
||||
if ((p = strrchr (buf, '/')) && *(p + 1) == '.' && *(p + 2) == '\0')
|
||||
*p = '\0';
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract the hostname and username from the path */
|
||||
|
||||
/*
|
||||
@ -307,6 +360,7 @@ login_server (struct connection *bucket, char *netrcpass)
|
||||
char *op;
|
||||
char *name; /* login user name */
|
||||
int anon = 0;
|
||||
char reply_string[255];
|
||||
|
||||
bucket->isbinary = TYPE_UNKNOWN;
|
||||
if (netrcpass)
|
||||
@ -369,7 +423,13 @@ login_server (struct connection *bucket, char *netrcpass)
|
||||
} else
|
||||
name = g_strdup (quser (bucket));
|
||||
|
||||
if (get_reply (qsock (bucket), NULL, 0) == COMPLETE) {
|
||||
if (get_reply (qsock(bucket), reply_string, sizeof (reply_string) - 1) == COMPLETE) {
|
||||
g_strup (reply_string);
|
||||
bucket->remote_is_amiga = strstr (reply_string, "AMIGA") != 0;
|
||||
if (logfile) {
|
||||
fprintf (logfile, "MC -- remote_is_amiga = %d\n", bucket->remote_is_amiga);
|
||||
fflush (logfile);
|
||||
}
|
||||
#if defined(HSC_PROXY)
|
||||
if (qproxy (bucket)){
|
||||
print_vfs_message ("ftpfs: sending proxy login name");
|
||||
@ -496,7 +556,7 @@ load_no_proxy_list ()
|
||||
if (p == s)
|
||||
continue;
|
||||
|
||||
*p = NULL;
|
||||
*p = '\0';
|
||||
|
||||
np = g_new (struct no_proxy_entry, 1);
|
||||
np->domain = g_strdup (s);
|
||||
@ -689,6 +749,7 @@ open_command_connection (char *host, char *user, int port, char *netrcpass)
|
||||
bucket->use_source_route = source_route;
|
||||
bucket->strict_rfc959_list_cmd = !ftpfs_use_unix_list_options;
|
||||
bucket->isbinary = TYPE_UNKNOWN;
|
||||
bucket->remote_is_amiga = 0;
|
||||
|
||||
/* We do not want to use the passive if we are using proxies */
|
||||
if (bucket->use_proxy)
|
||||
@ -843,8 +904,18 @@ ftpfs_get_current_directory (struct connection *bucket)
|
||||
*bufq++ = '/';
|
||||
*bufq = 0;
|
||||
}
|
||||
if (*bufp == '/')
|
||||
return g_strdup (bufp);
|
||||
} else ERRNOR (EIO, NULL);
|
||||
else {
|
||||
/* If the remote server is an Amiga a leading slash
|
||||
might be missing. MC needs it because it is used
|
||||
as seperator between hostname and path internally. */
|
||||
return g_strconcat( "/", bufp, 0);
|
||||
}
|
||||
} else {
|
||||
my_errno = EIO;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -963,7 +1034,8 @@ open_data_connection (struct connection *bucket, char *cmd, char *remote,
|
||||
return -1;
|
||||
}
|
||||
if (remote)
|
||||
j = command (bucket, WAIT_REPLY, "%s %s", cmd, remote);
|
||||
j = command (bucket, WAIT_REPLY, "%s %s", cmd,
|
||||
translate_path (bucket, remote));
|
||||
else
|
||||
j = command (bucket, WAIT_REPLY, "%s", cmd);
|
||||
if (j != PRELIM)
|
||||
@ -1170,6 +1242,36 @@ get_path (struct connection **bucket, char *path)
|
||||
return s_get_path (bucket, path, "/#ftp:");
|
||||
}
|
||||
|
||||
/* Inserts an entry for "." into the linked list. Ignore any errors
|
||||
because "." isn't important (as fas as you don't try to save a
|
||||
file in the root dir of the ftp server).
|
||||
Actually the dot is needed when stating the root directory, e.g.
|
||||
mc_stat ("/ftp#localhost", &buf). Down the call tree _get_file_entry
|
||||
gets called with filename = "/" which will be transformed into "."
|
||||
before searching for a fileentry. Whithout "." in the linked list
|
||||
this search fails. -- Norbert. */
|
||||
static void
|
||||
insert_dot (struct linklist *file_list, struct connection *bucket)
|
||||
{
|
||||
struct direntry *fe;
|
||||
static char buffer[] = "drwxrwxrwx 1 0 0 1024 Jan 1 1970 .";
|
||||
|
||||
fe = malloc(sizeof(struct direntry));
|
||||
if (fe == NULL)
|
||||
return;
|
||||
if (vfs_parse_ls_lga (buffer, &fe->s, &fe->name, &fe->linkname)) {
|
||||
fe->freshly_created = 0;
|
||||
fe->count = 1;
|
||||
fe->local_filename = fe->remote_filename = NULL;
|
||||
fe->l_stat = NULL;
|
||||
fe->bucket = bucket;
|
||||
(fe->s).st_ino = bucket->__inode_counter++;
|
||||
|
||||
if (!linklist_insert(file_list, fe))
|
||||
free(fe);
|
||||
} else
|
||||
free (fe);
|
||||
}
|
||||
|
||||
static struct dir *
|
||||
retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
@ -1183,6 +1285,7 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
char buffer[8192];
|
||||
struct dir *dcache;
|
||||
int got_intr = 0;
|
||||
int dot_found = 0;
|
||||
int has_spaces = (strchr (remote_path, ' ') != NULL);
|
||||
|
||||
canonicalize_pathname (remote_path);
|
||||
@ -1214,12 +1317,16 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
print_vfs_message("ftpfs: Reading FTP directory %s... (don't use UNIX ls options)", remote_path);
|
||||
else
|
||||
print_vfs_message("ftpfs: Reading FTP directory %s...", remote_path);
|
||||
if (has_spaces || bucket->strict_rfc959_list_cmd)
|
||||
if (ftpfs_chdir_internal (bucket, remote_path) != COMPLETE) {
|
||||
if (has_spaces || bucket->strict_rfc959_list_cmd || ftpfs_first_cd_then_ls) {
|
||||
char *p;
|
||||
|
||||
p = translate_path (bucket, remote_path);
|
||||
if (ftpfs_chdir_internal (bucket, p) != COMPLETE) {
|
||||
my_errno = ENOENT;
|
||||
print_vfs_message("ftpfs: CWD failed.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
file_list = linklist_init();
|
||||
if (file_list == NULL)
|
||||
@ -1240,10 +1347,15 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
|
||||
if (bucket->strict_rfc959_list_cmd == 1)
|
||||
sock = open_data_connection (bucket, "LIST", 0, TYPE_ASCII, 0);
|
||||
else if (has_spaces)
|
||||
else if (has_spaces || ftpfs_first_cd_then_ls)
|
||||
sock = open_data_connection (bucket, "LIST -la", ".", TYPE_ASCII, 0);
|
||||
else {
|
||||
char *path = g_strconcat (remote_path, PATH_SEP_STR, ".", NULL);
|
||||
/* Trailing "/." is necessary if remote_path is a symlink
|
||||
but don't generate "//." */
|
||||
char *path = g_strconcat (remote_path,
|
||||
remote_path[1] == '\0' ? "" : PATH_SEP_STR,
|
||||
".", (char *) 0);
|
||||
|
||||
sock = open_data_connection (bucket, "LIST -la", path, TYPE_ASCII, 0);
|
||||
g_free (path);
|
||||
}
|
||||
@ -1291,6 +1403,8 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
goto error_1;
|
||||
}
|
||||
if (vfs_parse_ls_lga (buffer, &fe->s, &fe->name, &fe->linkname)) {
|
||||
if (strcmp (fe->name, ".") == 0)
|
||||
dot_found = 1;
|
||||
fe->count = 1;
|
||||
fe->local_filename = fe->remote_filename = NULL;
|
||||
fe->l_stat = NULL;
|
||||
@ -1324,8 +1438,13 @@ retrieve_dir(struct connection *bucket, char *remote_path, int resolve_symlinks)
|
||||
}
|
||||
close_this_sock(fp, sock);
|
||||
disable_interrupt_key();
|
||||
if ( (get_reply (qsock (bucket), NULL, 0) != COMPLETE) || (file_list->next == file_list))
|
||||
if ((get_reply (qsock (bucket), NULL, 0) != COMPLETE) ||
|
||||
(file_list->next == file_list))
|
||||
goto fallback;
|
||||
|
||||
if (!dot_found)
|
||||
insert_dot (file_list, bucket);
|
||||
|
||||
if (!linklist_insert(qdcache(bucket), dcache)) {
|
||||
my_errno = ENOMEM;
|
||||
goto error_3;
|
||||
@ -1522,14 +1641,15 @@ int ftpfs_ctl (void *data, int ctlop, int arg)
|
||||
static int
|
||||
send_ftp_command(char *filename, char *cmd, int flags)
|
||||
{
|
||||
char *remote_path;
|
||||
char *remote_path, *p;
|
||||
struct connection *bucket;
|
||||
int r;
|
||||
int flush_directory_cache = (flags & OPT_FLUSH) && (normal_flush > 0);
|
||||
|
||||
if (!(remote_path = get_path(&bucket, filename)))
|
||||
return -1;
|
||||
r = command (bucket, WAIT_REPLY, cmd, remote_path);
|
||||
p = translate_path (bucket, remote_path);
|
||||
r = command (bucket, WAIT_REPLY, cmd, p);
|
||||
g_free(remote_path);
|
||||
vfs_add_noncurrent_stamps (&vfs_ftpfs_ops, (vfsid) bucket, NULL);
|
||||
if (flags & OPT_IGNORE_ERROR)
|
||||
@ -1614,11 +1734,14 @@ static int
|
||||
ftpfs_chdir_internal (struct connection *bucket ,char *remote_path)
|
||||
{
|
||||
int r;
|
||||
char *p;
|
||||
|
||||
if (!bucket->cwd_defered && is_same_dir (remote_path, bucket))
|
||||
return COMPLETE;
|
||||
|
||||
r = command (bucket, WAIT_REPLY, "CWD %s", remote_path);
|
||||
p = translate_path (bucket, remote_path);
|
||||
r = command (bucket, WAIT_REPLY, "CWD %s", p);
|
||||
|
||||
if (r != COMPLETE) {
|
||||
my_errno = EIO;
|
||||
} else {
|
||||
|
@ -55,6 +55,7 @@ struct connection {
|
||||
int result_pending;
|
||||
int use_source_route;
|
||||
int use_passive_connection;
|
||||
int remote_is_amiga; /* No leading slash allowed for AmiTCP (Amiga) */
|
||||
int isbinary;
|
||||
int cwd_defered; /* current_directory was changed but CWD command hasn't
|
||||
been sent yet */
|
||||
|
@ -168,11 +168,11 @@ vfs_strip_suffix_from_filename (char *filename)
|
||||
if (vfs->which){
|
||||
if ((*vfs->which) (vfs, semi + 1) == -1)
|
||||
continue;
|
||||
*semi = NULL; /* Found valid suffix */
|
||||
*semi = '\0'; /* Found valid suffix */
|
||||
return p;
|
||||
}
|
||||
if (!strncmp (semi + 1, vfs->prefix, strlen (vfs->prefix))) {
|
||||
*semi = NULL; /* Found valid suffix */
|
||||
*semi = '\0'; /* Found valid suffix */
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user