From 3550827e81e098c25a3525f64960797777696bc2 Mon Sep 17 00:00:00 2001 From: Norbert Warmuth Date: Mon, 1 Jun 1998 14:34:43 +0000 Subject: [PATCH] Mon Jun 1 15:41:20 1998 Norbert Warmuth * main.c (translate_url_to_new_syntax): translate the common ftp url syntax to the syntax used by the new vfs code. (_do_panel_cd): First translate the path if necessary. This makes it possible to enter ftp://host on the commandline and in the directory hotlist. We might need to move the translation code to the vfs layer if there are other places where we want to enter ftp://host. Mon Jun 1 16:00:19 1998 Norbert Warmuth * vfs/ftpfs.c (ftpfs_fill_names): use right character to seperate prefix and username --- src/ChangeLog | 11 +++++++++++ src/main.c | 18 +++++++++++++++++- vfs/ChangeLog | 5 +++++ vfs/ftpfs.c | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3815f2544..af00875a5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +Mon Jun 1 15:41:20 1998 Norbert Warmuth + + * main.c (translate_url_to_new_syntax): translate the common + ftp url syntax to the syntax used by the new vfs code. + + (_do_panel_cd): First translate the path if necessary. This makes + it possible to enter ftp://host on the commandline and in the + directory hotlist. We might need to move the translation code + to the vfs layer if there are other places where we want to enter + ftp://host. + Mon Jun 1 12:33:08 1998 Alexander V. Lukyanov * configure.in: allowed to use `configure --with-included-gettext' diff --git a/src/main.c b/src/main.c index ae83a90b4..ddd3d6ef6 100644 --- a/src/main.c +++ b/src/main.c @@ -926,18 +926,32 @@ directory_history_add (WPanel * panel, char *s) panel_update_marks (panel); } +/* Translate ftp://user:password@host/directory to + #ftp:user:password@host/directory. + */ +static char * +translate_url_to_new_syntax (const char *p) +{ + if (strncmp (p, "ftp://", 6) == 0) + return copy_strings ("#ftp:", p + 6, 0); + else + return strdup (p); +} + /* Changes the current panel directory */ int _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type) { char *directory, *olddir; char temp [MC_MAXPATHLEN]; + char *translated_url; #ifdef USE_VFS vfs *oldvfs; vfsid oldvfsid; struct vfs_stamping *parent; #endif olddir = strdup (panel->cwd); + translated_url = new_dir = translate_url_to_new_syntax (new_dir); /* Convert *new_path to a suitable pathname, handle ~user */ @@ -951,12 +965,14 @@ _do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type) } } directory = *new_dir ? new_dir : home_dir; - + if (mc_chdir (directory) == -1){ strcpy (panel->cwd, olddir); free (olddir); + free (translated_url); return 0; } + free (translated_url); /* Success: save previous directory, shutdown status of previous dir */ strcpy (panel->lwd, olddir); diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 0b2f1eceb..43c9cf3a6 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 1 16:00:19 1998 Norbert Warmuth + + * ftpfs.c (ftpfs_fill_names): use right character to seperate + prefix and username + Mon Jun 1 14:19:20 1998 Bakeyev I. Timur * vfs.c (parse_ls_lga): allow a bit wider range of listings. diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 538b67e9d..e0716c33b 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1008,7 +1008,7 @@ void ftpfs_fill_names (void (*func)(char *)) do { if ((bucket = lptr->data) != 0){ - path_name = copy_strings ("/#ftp.", quser (bucket), + path_name = copy_strings ("/#ftp:", quser (bucket), "@", qhost (bucket), qcdir(bucket), 0); (*func)(path_name);