mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Decouple listpath and initpath
This commit is contained in:
parent
8b764a5f7c
commit
3f60a1931f
14
src/nnn.c
14
src/nnn.c
|
@ -1170,14 +1170,14 @@ static size_t seltofile(int fd, uint *pcount)
|
||||||
|
|
||||||
if (listpath) {
|
if (listpath) {
|
||||||
prefixlen = (ssize_t)xstrlen(prefixpath);
|
prefixlen = (ssize_t)xstrlen(prefixpath);
|
||||||
initlen = (ssize_t)xstrlen(initpath);
|
initlen = (ssize_t)xstrlen(listpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pos <= lastpos) {
|
while (pos <= lastpos) {
|
||||||
DPRINTF_S(pbuf);
|
DPRINTF_S(pbuf);
|
||||||
len = (ssize_t)xstrlen(pbuf);
|
len = (ssize_t)xstrlen(pbuf);
|
||||||
|
|
||||||
if (!listpath || strncmp(initpath, pbuf, initlen) != 0) {
|
if (!listpath || strncmp(listpath, pbuf, initlen) != 0) {
|
||||||
if (write(fd, pbuf, len) != len)
|
if (write(fd, pbuf, len) != len)
|
||||||
return pos;
|
return pos;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4225,8 +4225,9 @@ static void rmlistpath()
|
||||||
{
|
{
|
||||||
if (listpath) {
|
if (listpath) {
|
||||||
DPRINTF_S(__FUNCTION__);
|
DPRINTF_S(__FUNCTION__);
|
||||||
DPRINTF_S(initpath);
|
DPRINTF_S(listpath);
|
||||||
spawn("rm -rf", initpath, NULL, NULL, F_NOTRACE | F_MULTI);
|
spawn("rm -rf", listpath, NULL, NULL, F_NOTRACE | F_MULTI);
|
||||||
|
free(listpath);
|
||||||
listpath = NULL;
|
listpath = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4261,11 +4262,6 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)
|
||||||
rmlistpath();
|
rmlistpath();
|
||||||
|
|
||||||
nextpath = load_input(fd, *path);
|
nextpath = load_input(fd, *path);
|
||||||
if (nextpath) {
|
|
||||||
free(initpath);
|
|
||||||
initpath = nextpath;
|
|
||||||
DPRINTF_S(initpath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextpath) {
|
if (nextpath) {
|
||||||
|
|
Loading…
Reference in a new issue