mc/vfs/ftpfs.h

104 lines
2.6 KiB
C
Raw Normal View History

1998-02-27 07:54:42 +03:00
/* ftpfs.h */
/* $Id$ */
1998-02-27 07:54:42 +03:00
#if !defined(__FTPFS_H)
#define __FTPFS_H
#include "xdirentry.h"
struct direntry
1998-02-27 07:54:42 +03:00
{
char *name;
int count;
char *linkname;
char *local_filename, *remote_filename;
1998-02-27 07:54:42 +03:00
int local_is_temp:1;
int freshly_created:1;
struct stat local_stat;
struct stat s;
struct stat *l_stat;
struct connection *bucket;
int data_sock; /* For linear_ operations */
1998-10-13 02:07:53 +04:00
int linear_state;
#define LS_NONLIN 0 /* Not using linear access at all */
#define LS_LINEAR_CLOSED 1 /* Using linear access, but not open, yet */
#define LS_LINEAR_OPEN 2 /* Using linear access, open */
1998-02-27 07:54:42 +03:00
};
struct dir
1998-02-27 07:54:42 +03:00
{
int count;
struct timeval timestamp;
char *remote_path;
struct linklist *file_list;
Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> * setup.c: save and restore new global variable/option ftp_use_unix_list_options Tue Sep 15 20:31:32 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.c (ftp_use_unix_list_options): New global variable/option. If true we try to use 'LIST -la <path>'. When it fails we use the two commands 'CWD <path>' and 'LIST' instead. (resolve_symlink): rewritten. Don't get a second directory listing with `LIST -lLa'. Instead use the cache to get the file stat of symbolic links. If the directory the symlink points to isn't already in the cache the directory listing will be fetched and stored in the directory cache (without resolving symlinks recursively). The new method to resolve symlinks is faster if symlinks the same directory or the directory the symlink points to is already in the cache. This function was small and nice until I discovered that it was broken for symlinks to symlinks. Now it looks ugly and perhaps I will revert it to use "LIST -lLa" again. With a fast connection it doesn't matter which methode we use but with a slow connection I wouldn't hesitate to burn more cpu cycles on the client side. (retrieve_dir): Added parameter to tell whether to resolve symlinks (don't resolve symlinks in directory listings retrieved while resolving symlinks). When we don't get a directory listing with 'LIST -la <path>' then try to get it with `CWD <path>; LIST'. Tue Sep 15 20:27:29 1998 Norbert Warmuth <k3190@fh-sw.de * ftpfs.c (login_server): s/ftpfs_get_host/my_get_host/ (retrieve_file_start2): Don't create target file O_EXCL, in copy_file_file we check existance of the target file and know that we want to truncate it (this change was already done a while back but it was reverted with the vfs-split). Tue Sep 15 20:15:42 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.h (struct connection): added boolean which indicates that the ftp server doesn't unterstand Unix ls options * ftpfs.h (struct dir): added enum to store symlink status of the in memory directory cache (directory has no symbolic links; symbolic links but not yet resolved; symbolic links which are resolved) Tue Sep 15 20:02:08 1998 Norbert Warmuth <k3190@fh-sw.de> * shared_ftp_fish.c, fish.c: updated references to retrieve_dir to honour the additional boolean parameter
1998-09-15 23:41:22 +04:00
int symlink_status;
1998-02-27 07:54:42 +03:00
};
Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> * setup.c: save and restore new global variable/option ftp_use_unix_list_options Tue Sep 15 20:31:32 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.c (ftp_use_unix_list_options): New global variable/option. If true we try to use 'LIST -la <path>'. When it fails we use the two commands 'CWD <path>' and 'LIST' instead. (resolve_symlink): rewritten. Don't get a second directory listing with `LIST -lLa'. Instead use the cache to get the file stat of symbolic links. If the directory the symlink points to isn't already in the cache the directory listing will be fetched and stored in the directory cache (without resolving symlinks recursively). The new method to resolve symlinks is faster if symlinks the same directory or the directory the symlink points to is already in the cache. This function was small and nice until I discovered that it was broken for symlinks to symlinks. Now it looks ugly and perhaps I will revert it to use "LIST -lLa" again. With a fast connection it doesn't matter which methode we use but with a slow connection I wouldn't hesitate to burn more cpu cycles on the client side. (retrieve_dir): Added parameter to tell whether to resolve symlinks (don't resolve symlinks in directory listings retrieved while resolving symlinks). When we don't get a directory listing with 'LIST -la <path>' then try to get it with `CWD <path>; LIST'. Tue Sep 15 20:27:29 1998 Norbert Warmuth <k3190@fh-sw.de * ftpfs.c (login_server): s/ftpfs_get_host/my_get_host/ (retrieve_file_start2): Don't create target file O_EXCL, in copy_file_file we check existance of the target file and know that we want to truncate it (this change was already done a while back but it was reverted with the vfs-split). Tue Sep 15 20:15:42 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.h (struct connection): added boolean which indicates that the ftp server doesn't unterstand Unix ls options * ftpfs.h (struct dir): added enum to store symlink status of the in memory directory cache (directory has no symbolic links; symbolic links but not yet resolved; symbolic links which are resolved) Tue Sep 15 20:02:08 1998 Norbert Warmuth <k3190@fh-sw.de> * shared_ftp_fish.c, fish.c: updated references to retrieve_dir to honour the additional boolean parameter
1998-09-15 23:41:22 +04:00
/* valid values for dir->symlink_status */
#define FTPFS_NO_SYMLINKS 0
#define FTPFS_UNRESOLVED_SYMLINKS 1
#define FTPFS_RESOLVED_SYMLINKS 2
#define FTPFS_RESOLVING_SYMLINKS 3
Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> * setup.c: save and restore new global variable/option ftp_use_unix_list_options Tue Sep 15 20:31:32 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.c (ftp_use_unix_list_options): New global variable/option. If true we try to use 'LIST -la <path>'. When it fails we use the two commands 'CWD <path>' and 'LIST' instead. (resolve_symlink): rewritten. Don't get a second directory listing with `LIST -lLa'. Instead use the cache to get the file stat of symbolic links. If the directory the symlink points to isn't already in the cache the directory listing will be fetched and stored in the directory cache (without resolving symlinks recursively). The new method to resolve symlinks is faster if symlinks the same directory or the directory the symlink points to is already in the cache. This function was small and nice until I discovered that it was broken for symlinks to symlinks. Now it looks ugly and perhaps I will revert it to use "LIST -lLa" again. With a fast connection it doesn't matter which methode we use but with a slow connection I wouldn't hesitate to burn more cpu cycles on the client side. (retrieve_dir): Added parameter to tell whether to resolve symlinks (don't resolve symlinks in directory listings retrieved while resolving symlinks). When we don't get a directory listing with 'LIST -la <path>' then try to get it with `CWD <path>; LIST'. Tue Sep 15 20:27:29 1998 Norbert Warmuth <k3190@fh-sw.de * ftpfs.c (login_server): s/ftpfs_get_host/my_get_host/ (retrieve_file_start2): Don't create target file O_EXCL, in copy_file_file we check existance of the target file and know that we want to truncate it (this change was already done a while back but it was reverted with the vfs-split). Tue Sep 15 20:15:42 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.h (struct connection): added boolean which indicates that the ftp server doesn't unterstand Unix ls options * ftpfs.h (struct dir): added enum to store symlink status of the in memory directory cache (directory has no symbolic links; symbolic links but not yet resolved; symbolic links which are resolved) Tue Sep 15 20:02:08 1998 Norbert Warmuth <k3190@fh-sw.de> * shared_ftp_fish.c, fish.c: updated references to retrieve_dir to honour the additional boolean parameter
1998-09-15 23:41:22 +04:00
struct connection {
1998-02-27 07:54:42 +03:00
char *host;
char *user;
char *current_directory;
char *home;
char *updir;
char *password;
int port;
int sock;
struct linklist *dcache;
ino_t __inode_counter;
int lock;
int failed_on_login; /* used to pass the failure reason to upper levels */
int use_proxy; /* use a proxy server */
int use_source_route;
int use_passive_connection;
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.
1999-01-31 23:28:13 +03:00
int remote_is_amiga; /* No leading slash allowed for AmiTCP (Amiga) */
1998-02-27 07:54:42 +03:00
int isbinary;
Sun May 10 13:21:45 1998 Norbert Warmuth <k3190@fh-sw.de> * edit/syntax.c: Disable debug messages on stderr. * edit/edit.h: Added missing _() Sun May 10 14:51:03 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.c (__ftpfs_chdir): CWD command wasn't sent at all. This optimation is wrong because for directories containing spaces we have to "CWD <pathname>" and "LIST -la" instead of "LIST -la <pathname>". I implemented a different optimation. Now ftpfs_chdir only stores the new working directory and sets a flag. __ftpfs_chdir is called when we really want to change the directory on the ftp server. (resolve_symlink): Log the directory listing to the logfile. * ftpfs.h (struct ftpfs_connection): Added a (per connection) cwd_defered flag. Sun May 10 13:27:50 1998 Norbert Warmuth <k3190@fh-sw.de> * widget.c (handle_char): Don't try to to delete default text in input widget more than once. Right after MC's start copy_filename (ESC Enter) failed because a flag wasn't cleared while characters were stuffed into the commandline (Andrej reported this bug). * main.c (copy_readlink): usr mc_readlink instead of readlink * file.c: Changed default for the copy/move option "dive into subdir if exists" to off (note: this was only possible after the change in setup.c). (copy_dir_dir): Activated the previously uncommented code which implements "Dive into subdirs". Even when there's no case where we actually would like that behaviour it is a documented feature. Though I don't wanted to change the default behavour. Hence the option change. (file_mask_defaults): set dive_into_subdirs (file_mask_dialog): Fix for debian Bug #20727: Move operation with "[ ] Dive into subdir if exists" and destination filename not wildcarded. If destination is an existing directory then files will be moved into this directory. If destination is not an existing directory then src file will be renamed (one file selected) or an error will be displayed (more than one file selected). (file_mask_dialog): made the option "Using shell patterns" local to the current copy/move operation, i.e. this option is always initialized with the global options's value. Previously it affected the global Options/Configuration/shell Patterns. Another possiblilty would be to make the global option a default option on startup and keep changes in the copy/move dialog (without saving these changes with save setup). * setup.c: Don't save and load options which can be changed outside the options menu. For example I don't like that preserve_uid_gid and dive_into_subdirs from the copy/move dialog are saved and restored (strange, what about the other options from this dialog?). It would be much cleaner to make these option read-only. This way one could edit ~/.mc/ini to provide default option setting on startup and "Save setup" wouldn't have side effects outside the option's menu. Sun May 10 13:24:20 1998 Norbert Warmuth <k3190@fh-sw.de> * doc/mc.1.in, doc/mc.sgml, mc.hlp: Updated to reflect new default for dive into subdirs.
1998-05-10 17:41:43 +04:00
int cwd_defered; /* current_directory was changed but CWD command hasn't
been sent yet */
Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> * setup.c: save and restore new global variable/option ftp_use_unix_list_options Tue Sep 15 20:31:32 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.c (ftp_use_unix_list_options): New global variable/option. If true we try to use 'LIST -la <path>'. When it fails we use the two commands 'CWD <path>' and 'LIST' instead. (resolve_symlink): rewritten. Don't get a second directory listing with `LIST -lLa'. Instead use the cache to get the file stat of symbolic links. If the directory the symlink points to isn't already in the cache the directory listing will be fetched and stored in the directory cache (without resolving symlinks recursively). The new method to resolve symlinks is faster if symlinks the same directory or the directory the symlink points to is already in the cache. This function was small and nice until I discovered that it was broken for symlinks to symlinks. Now it looks ugly and perhaps I will revert it to use "LIST -lLa" again. With a fast connection it doesn't matter which methode we use but with a slow connection I wouldn't hesitate to burn more cpu cycles on the client side. (retrieve_dir): Added parameter to tell whether to resolve symlinks (don't resolve symlinks in directory listings retrieved while resolving symlinks). When we don't get a directory listing with 'LIST -la <path>' then try to get it with `CWD <path>; LIST'. Tue Sep 15 20:27:29 1998 Norbert Warmuth <k3190@fh-sw.de * ftpfs.c (login_server): s/ftpfs_get_host/my_get_host/ (retrieve_file_start2): Don't create target file O_EXCL, in copy_file_file we check existance of the target file and know that we want to truncate it (this change was already done a while back but it was reverted with the vfs-split). Tue Sep 15 20:15:42 1998 Norbert Warmuth <k3190@fh-sw.de> * ftpfs.h (struct connection): added boolean which indicates that the ftp server doesn't unterstand Unix ls options * ftpfs.h (struct dir): added enum to store symlink status of the in memory directory cache (directory has no symbolic links; symbolic links but not yet resolved; symbolic links which are resolved) Tue Sep 15 20:02:08 1998 Norbert Warmuth <k3190@fh-sw.de> * shared_ftp_fish.c, fish.c: updated references to retrieve_dir to honour the additional boolean parameter
1998-09-15 23:41:22 +04:00
int strict_rfc959_list_cmd; /* ftp server doesn't understand
"LIST -la <path>"; use "CWD <path>"/
"LIST" instead */
1998-02-27 07:54:42 +03:00
};
#define qhost(b) (b)->host
#define quser(b) (b)->user
#define qcdir(b) (b)->current_directory
#define qport(b) (b)->port
#define qsock(b) (b)->sock
#define qlock(b) (b)->lock
#define qdcache(b) (b)->dcache
#define qhome(b) (b)->home
#define qupdir(b) (b)->updir
#define qproxy(b) (b)->use_proxy
/* Increased since now we may use C-r to reread the contents */
#define FTPFS_DIRECTORY_TIMEOUT 30 * 60
#define DO_RESOLVE_SYMLINK 1
#define DO_OPEN 2
#define DO_FREE_RESOURCE 4
1998-02-27 07:54:42 +03:00
extern char *ftpfs_anonymous_passwd;
extern char *ftpfs_proxy_host;
extern int ftpfs_directory_timeout;
extern int ftpfs_always_use_proxy;
1998-02-27 07:54:42 +03:00
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;
void ftpfs_init_passwd (void);
#define OPT_FLUSH 1
#define OPT_IGNORE_ERROR 2
1998-02-27 07:54:42 +03:00
#endif