implement -o exit_after_connect

this is useful as a connectivity check
This commit is contained in:
2024-08-06 05:17:23 +00:00
parent 5c68307010
commit 3d81b832e5
2 changed files with 7 additions and 1 deletions

View File

@@ -174,6 +174,7 @@ static struct fuse_opt ftpfs_opts[] = {
FTPFS_OPT("codepage=%s", codepage, 0),
FTPFS_OPT("iocharset=%s", iocharset, 0),
FTPFS_OPT("nomulticonn", multiconn, 0),
FTPFS_OPT("exit_after_connect", exit_after_connect, 1),
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
@@ -1502,6 +1503,7 @@ static void usage(const char* progname) {
" utf8 try to transfer file list with utf-8 encoding\n"
" codepage=STR set the codepage the server uses\n"
" iocharset=STR set the charset used by the client\n"
" exit_after_connect after connecting to the FTP server, instead of passing control to FUSE, exit\n"
"\n"
"CurlFtpFS cache options: \n"
" cache=yes|no enable/disable cache (default: yes)\n"
@@ -1800,7 +1802,10 @@ int main(int argc, char** argv) {
fuse_opt_insert_arg(&args, 1, tmp);
g_free(tmp);
res = curlftpfs_fuse_main(&args);
if (!ftpfs.exit_after_connect) {
res = curlftpfs_fuse_main(&args);
}
cancel_previous_multi();
curl_multi_cleanup(ftpfs.multi);

View File

@@ -67,6 +67,7 @@ struct ftpfs {
char *codepage;
char *iocharset;
int multiconn;
int exit_after_connect;
};
extern struct ftpfs ftpfs;