From bbe631ad7158608341423235ca4ecec407cc55e6 Mon Sep 17 00:00:00 2001 From: braga Date: Wed, 12 Apr 2006 18:52:02 +0000 Subject: [PATCH] Automatically append the ftp:// prefix if not passed in the host. --- ftpfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftpfs.c b/ftpfs.c index d44ecf4..326d06a 100644 --- a/ftpfs.c +++ b/ftpfs.c @@ -734,7 +734,11 @@ static int ftpfs_opt_proc(void* data, const char* arg, int key, return 1; case FUSE_OPT_KEY_NONOPT: if (!ftpfs.host) { - ftpfs.host = g_strdup_printf("%s%s", arg, + const char* prefix = ""; + if (strncmp(arg, "ftp://", 6)) { + prefix = "ftp://"; + } + ftpfs.host = g_strdup_printf("%s%s%s", prefix, arg, arg[strlen(arg)-1] == '/' ? "" : "/"); return 0; } else if (!ftpfs.mountpoint)