aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-07-22 17:05:03 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-07-22 17:57:15 +0530
commit32ec37a796d2c5934250bcd6b6dbbeb0c5133ce3 (patch)
tree9eb34afa078dcdd45b313d26a1b9a0cc9a32ae8d /src
parentf4ff4b07937c7c568474e352f6a7b0af340e7a32 (diff)
downloadnnn-32ec37a796d2c5934250bcd6b6dbbeb0c5133ce3.tar.gz
Create mountpoint by hostname, clear prompt
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/nnn.c b/src/nnn.c
index aa8ae4c..567eb92 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4011,35 +4011,37 @@ static bool remote_mount(char *newpath)
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] = ':';
- tmp[len + 1] = '\0';
+ /* 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') {
if (spawn(env, tmp, newpath, flag)) {