mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Create mountpoint by hostname, clear prompt
This commit is contained in:
parent
f4ff4b0793
commit
32ec37a796
1 changed files with 14 additions and 12 deletions
28
src/nnn.c
28
src/nnn.c
|
@ -4011,12 +4011,24 @@ static bool remote_mount(char *newpath)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = xreadline(NULL, "remote name: ");
|
tmp = xreadline(NULL, "host[:dir] > ");
|
||||||
if (!tmp[0]) {
|
if (!tmp[0]) {
|
||||||
printmsg(messages[MSG_CANCEL]);
|
printmsg(messages[MSG_CANCEL]);
|
||||||
return FALSE;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the mount point */
|
/* Create the mount point */
|
||||||
mkpath(cfgpath, toks[TOK_MNT], mntpath);
|
mkpath(cfgpath, toks[TOK_MNT], mntpath);
|
||||||
mkpath(mntpath, tmp, newpath);
|
mkpath(mntpath, tmp, newpath);
|
||||||
|
@ -4025,20 +4037,10 @@ static bool remote_mount(char *newpath)
|
||||||
return FALSE;
|
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] == ':') {
|
|
||||||
path = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path) { /* Append ':' if missing */
|
|
||||||
tmp[len] = ':';
|
tmp[len] = ':';
|
||||||
|
|
||||||
|
if (!path) /* Append ':' at the end */
|
||||||
tmp[len + 1] = '\0';
|
tmp[len + 1] = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
/* Connect to remote */
|
/* Connect to remote */
|
||||||
if (opt == 's') {
|
if (opt == 's') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue