src/nnn.c | 26 ++++++++++++++------------ diff --git a/src/nnn.c b/src/nnn.c index aa8ae4cec8856ce6b2ef18a90c5aa61af2d8b02a..567eb92add98de9ac0e2d090be45461e8e225ef7 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4011,34 +4011,36 @@ printmsg(messages[MSG_INVALID_KEY]); return FALSE; } - tmp = xreadline(NULL, "remote name: "); + tmp = xreadline(NULL, "host[:dir] > "); if (!tmp[0]) { printmsg(messages[MSG_CANCEL]); return FALSE; } - /* Create the mount point */ - mkpath(cfgpath, toks[TOK_MNT], mntpath); - mkpath(mntpath, tmp, newpath); - if (!xmktree(newpath, TRUE)) { - printwarn(NULL); - return FALSE; - } - /* Convert "Host" to "Host:" */ size_t len = xstrlen(tmp); bool path = FALSE; for (size_t count = 0; count < len; ++count) if (tmp[count] == ':') { + tmp[count] = '\0'; + len = count; path = TRUE; break; } - if (!path) { /* Append ':' if missing */ - tmp[len] = ':'; + /* Create the mount point */ + mkpath(cfgpath, toks[TOK_MNT], mntpath); + mkpath(mntpath, tmp, newpath); + if (!xmktree(newpath, TRUE)) { + printwarn(NULL); + return FALSE; + } + + tmp[len] = ':'; + + if (!path) /* Append ':' at the end */ tmp[len + 1] = '\0'; - } /* Connect to remote */ if (opt == 's') {