1
1

Set logfile for smbfs using mc_setctl().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2011-07-18 16:11:00 +04:00 коммит произвёл Slava Zanko
родитель 0c51a48a71
Коммит 05385e1586
3 изменённых файлов: 29 добавлений и 29 удалений

Просмотреть файл

@ -416,21 +416,21 @@ mc_setup_by_args (int argc, char *argv[])
const char *base;
char *tmp;
#ifdef ENABLE_VFS_SMB
if (mc_args__debug_level != 0)
smbfs_set_debug (mc_args__debug_level);
#endif /* ENABLE_VFS_SMB */
if (mc_args__netfs_logfile != NULL)
{
#ifdef ENABLE_VFS_FTP
mc_setctl ("ftp://", VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
#endif /* ENABLE_VFS_FTP */
#ifdef ENABLE_VFS_SMB
smbfs_set_debugf (mc_args__netfs_logfile);
mc_setctl ("smb://", VFS_SETCTL_LOGFILE, (void *) mc_args__netfs_logfile);
#endif /* ENABLE_VFS_SMB */
}
#ifdef ENABLE_VFS_SMB
if (mc_args__debug_level != 0)
smbfs_set_debug (mc_args__debug_level);
#endif /* ENABLE_VFS_SMB */
base = x_basename (argv[0]);
tmp = (argc > 0) ? argv[1] : NULL;

Просмотреть файл

@ -27,7 +27,7 @@
* \author Andrew V. Samoilov <sav@bcs.zp.ua>
* \date 1997, 2002, 2003
*
* Namespace: exports init_smbfs, smbfs_set_debug(), smbfs_set_debugf()
* Namespace: exports init_smbfs, smbfs_set_debug()
*/
#include <config.h>
@ -168,6 +168,24 @@ static dir_entry *single_entry;
/* modifies *share */
static struct cli_state *smbfs_do_connect (const char *server, char *share);
/* --------------------------------------------------------------------------------------------- */
static void
smbfs_set_debugf (const char *filename)
{
if (DEBUGLEVEL > 0)
{
FILE *outfile = fopen (filename, "w");
if (outfile)
{
setup_logging ("", True); /* No needs for timestamp for each message */
dbf = outfile;
setbuf (dbf, NULL);
pstrcpy (debugf, filename);
}
}
}
/* --------------------------------------------------------------------------------------------- */
/* this function allows you to write:
* char *s = g_strdup("hello, world");
@ -349,24 +367,6 @@ smbfs_set_debug (int arg)
DEBUGLEVEL = arg;
}
/* --------------------------------------------------------------------------------------------- */
void
smbfs_set_debugf (const char *filename)
{
if (DEBUGLEVEL > 0)
{
FILE *outfile = fopen (filename, "w");
if (outfile)
{
setup_logging ("", True); /* No needs for timestamp for each message */
dbf = outfile;
setbuf (dbf, NULL);
pstrcpy (debugf, filename);
}
}
}
/* --------------------------------------------------------------------------------------------- */
/********************** The callbacks ******************************/
@ -1998,7 +1998,10 @@ smbfs_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
{
case VFS_SETCTL_FORGET:
smbfs_forget (path_element->path);
return 0;
break;
case VFS_SETCTL_LOGFILE:
smbfs_set_debugf ((const char *) arg);
break;
}
return 0;
}

Просмотреть файл

@ -27,11 +27,8 @@ typedef struct smb_authinfo
/*** declarations of public functions ************************************************************/
void init_smbfs (void);
void smbfs_set_debug (int arg);
void smbfs_set_debugf (const char *filename);
smb_authinfo *vfs_smb_authinfo_new (const char *host,
const char *share,