mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Code reduction
This commit is contained in:
parent
32ec37a796
commit
defc1965ee
21
src/nnn.c
21
src/nnn.c
|
@ -4017,17 +4017,10 @@ static bool remote_mount(char *newpath)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert "Host" to "Host:" */
|
char *div = strchr(tmp, ':');
|
||||||
size_t len = xstrlen(tmp);
|
|
||||||
bool path = FALSE;
|
|
||||||
|
|
||||||
for (size_t count = 0; count < len; ++count)
|
if (div)
|
||||||
if (tmp[count] == ':') {
|
*div = '\0';
|
||||||
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);
|
||||||
|
@ -4037,10 +4030,12 @@ static bool remote_mount(char *newpath)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp[len] = ':';
|
if (!div) { /* Convert "host" to "host:" */
|
||||||
|
size_t len = xstrlen(tmp);
|
||||||
if (!path) /* Append ':' at the end */
|
tmp[len] = ':';
|
||||||
tmp[len + 1] = '\0';
|
tmp[len + 1] = '\0';
|
||||||
|
} else
|
||||||
|
*div = ':';
|
||||||
|
|
||||||
/* Connect to remote */
|
/* Connect to remote */
|
||||||
if (opt == 's') {
|
if (opt == 's') {
|
||||||
|
|
Loading…
Reference in a new issue