mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
VFS: move logfile member from vfs_s_subclass to vfs_class.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
94c0b79f37
commit
45bd20ab0b
@ -811,7 +811,7 @@ vfs_s_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
|
||||
return 1;
|
||||
}
|
||||
case VFS_SETCTL_LOGFILE:
|
||||
VFS_SUBCLASS (path_element->class)->logfile = fopen ((char *) arg, "w");
|
||||
path_element->class->logfile = fopen ((char *) arg, "w");
|
||||
return 1;
|
||||
case VFS_SETCTL_FLUSH:
|
||||
VFS_SUBCLASS (path_element->class)->flush = 1;
|
||||
@ -1605,7 +1605,7 @@ vfs_s_select_on_two (int fd1, int fd2)
|
||||
int
|
||||
vfs_s_get_line (struct vfs_class *me, int sock, char *buf, int buf_len, char term)
|
||||
{
|
||||
FILE *logfile = VFS_SUBCLASS (me)->logfile;
|
||||
FILE *logfile = me->logfile;
|
||||
int i;
|
||||
char c;
|
||||
|
||||
|
@ -147,6 +147,7 @@ typedef struct vfs_class
|
||||
vfs_flags_t flags;
|
||||
const char *prefix; /* "fish:" */
|
||||
int verrno; /* can't use errno because glibc2 might define errno as function */
|
||||
FILE *logfile;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
int (*init) (struct vfs_class * me);
|
||||
|
@ -116,7 +116,6 @@ struct vfs_s_subclass
|
||||
GList *supers;
|
||||
int inode_counter;
|
||||
dev_t rdev;
|
||||
FILE *logfile;
|
||||
int flush; /* if set to 1, invalidate directory cache */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
@ -272,7 +272,7 @@ fish_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply, c
|
||||
size_t cmd_len)
|
||||
{
|
||||
ssize_t status;
|
||||
FILE *logfile = VFS_SUBCLASS (me)->logfile;
|
||||
FILE *logfile = me->logfile;
|
||||
|
||||
if (cmd_len == (size_t) (-1))
|
||||
cmd_len = strlen (cmd);
|
||||
@ -754,7 +754,6 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
struct vfs_s_super *super = dir->super;
|
||||
char buffer[BUF_8K] = "\0";
|
||||
struct vfs_s_entry *ent = NULL;
|
||||
FILE *logfile;
|
||||
char *quoted_path;
|
||||
int reply_code;
|
||||
|
||||
@ -762,10 +761,9 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
* Simple FISH debug interface :]
|
||||
*/
|
||||
#if 0
|
||||
if (VFS_SUBCLASS (me)->logfile == NULL)
|
||||
VFS_SUBCLASS (me)->logfile = fopen ("/tmp/mc-FISH.sh", "w");
|
||||
if (me->logfile == NULL)
|
||||
me->logfile = fopen ("/tmp/mc-FISH.sh", "w");
|
||||
#endif
|
||||
logfile = VFS_SUBCLASS (me)->logfile;
|
||||
|
||||
vfs_print_message (_("fish: Reading directory %s..."), remote_path);
|
||||
|
||||
@ -791,11 +789,11 @@ fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
|
||||
me->verrno = ECONNRESET;
|
||||
goto error;
|
||||
}
|
||||
if (logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
fputs (buffer, logfile);
|
||||
fputs ("\n", logfile);
|
||||
fflush (logfile);
|
||||
fputs (buffer, me->logfile);
|
||||
fputs ("\n", me->logfile);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
if (strncmp (buffer, "### ", 4) == 0)
|
||||
break;
|
||||
|
@ -307,10 +307,10 @@ ftpfs_translate_path (struct vfs_class *me, struct vfs_s_super *super, const cha
|
||||
if (!FTP_SUPER (super)->remote_is_amiga)
|
||||
return g_strdup (remote_path);
|
||||
|
||||
if (VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
fprintf (VFS_SUBCLASS (me)->logfile, "MC -- ftpfs_translate_path: %s\n", remote_path);
|
||||
fflush (VFS_SUBCLASS (me)->logfile);
|
||||
fprintf (me->logfile, "MC -- ftpfs_translate_path: %s\n", remote_path);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
|
||||
/* strip leading slash(es) */
|
||||
@ -491,19 +491,19 @@ ftpfs_command (struct vfs_class *me, struct vfs_s_super *super, int wait_reply,
|
||||
va_end (ap);
|
||||
g_string_append (cmdstr, "\r\n");
|
||||
|
||||
if (VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
if (strncmp (cmdstr->str, "PASS ", 5) == 0)
|
||||
fputs ("PASS <Password not logged>\r\n", VFS_SUBCLASS (me)->logfile);
|
||||
fputs ("PASS <Password not logged>\r\n", me->logfile);
|
||||
else
|
||||
{
|
||||
size_t ret;
|
||||
|
||||
ret = fwrite (cmdstr->str, cmdstr->len, 1, VFS_SUBCLASS (me)->logfile);
|
||||
ret = fwrite (cmdstr->str, cmdstr->len, 1, me->logfile);
|
||||
(void) ret;
|
||||
}
|
||||
|
||||
fflush (VFS_SUBCLASS (me)->logfile);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
|
||||
got_sigpipe = 0;
|
||||
@ -647,7 +647,7 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
|
||||
super->path_element->password = g_strdup (op);
|
||||
}
|
||||
|
||||
if (!anon || VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (!anon || me->logfile != NULL)
|
||||
pass = op;
|
||||
else
|
||||
{
|
||||
@ -675,11 +675,11 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
|
||||
ftp_super->strict = RFC_STRICT;
|
||||
g_free (reply_up);
|
||||
|
||||
if (VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
fprintf (VFS_SUBCLASS (me)->logfile, "MC -- remote_is_amiga = %s\n",
|
||||
fprintf (me->logfile, "MC -- remote_is_amiga = %s\n",
|
||||
ftp_super->remote_is_amiga ? "yes" : "no");
|
||||
fflush (VFS_SUBCLASS (me)->logfile);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
|
||||
vfs_print_message ("%s", _("ftpfs: sending login name"));
|
||||
@ -1658,10 +1658,10 @@ resolve_symlink_with_ls_options (struct vfs_class *me, struct vfs_s_super *super
|
||||
if (fgets (buffer, sizeof (buffer), fp) == NULL)
|
||||
goto done;
|
||||
|
||||
if (VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
fputs (buffer, VFS_SUBCLASS (me)->logfile);
|
||||
fflush (VFS_SUBCLASS (me)->logfile);
|
||||
fputs (buffer, me->logfile);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
|
||||
vfs_die ("This code should be commented out\n");
|
||||
@ -1793,11 +1793,11 @@ ftpfs_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (VFS_SUBCLASS (me)->logfile != NULL)
|
||||
if (me->logfile != NULL)
|
||||
{
|
||||
fputs (lc_buffer, VFS_SUBCLASS (me)->logfile);
|
||||
fputs ("\n", VFS_SUBCLASS (me)->logfile);
|
||||
fflush (VFS_SUBCLASS (me)->logfile);
|
||||
fputs (lc_buffer, me->logfile);
|
||||
fputs ("\n", me->logfile);
|
||||
fflush (me->logfile);
|
||||
}
|
||||
|
||||
ent = vfs_s_generate_entry (me, NULL, dir, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user