mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Simplify writing selection
This commit is contained in:
parent
231be5ec36
commit
c92715a01d
11
src/nnn.c
11
src/nnn.c
|
@ -738,10 +738,8 @@ static ssize_t selectiontofd(int fd)
|
||||||
ssize_t pos = 0, len, r, lastpos = copybufpos - 1;
|
ssize_t pos = 0, len, r, lastpos = copybufpos - 1;
|
||||||
|
|
||||||
while (pos < copybufpos) {
|
while (pos < copybufpos) {
|
||||||
while(pcopybuf[pos])
|
|
||||||
++pos;
|
|
||||||
|
|
||||||
len = strlen(pbuf);
|
len = strlen(pbuf);
|
||||||
|
pos += len;
|
||||||
|
|
||||||
r = write(fd, pbuf, len);
|
r = write(fd, pbuf, len);
|
||||||
if (r != len)
|
if (r != len)
|
||||||
|
@ -750,7 +748,7 @@ static ssize_t selectiontofd(int fd)
|
||||||
if (pos != lastpos) {
|
if (pos != lastpos) {
|
||||||
if (write(fd, "\n", 1) != 1)
|
if (write(fd, "\n", 1) != 1)
|
||||||
return pos;
|
return pos;
|
||||||
pbuf = pbuf + len + 1;
|
pbuf += pos + 1;
|
||||||
}
|
}
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
@ -1501,7 +1499,10 @@ static size_t mkpath(char *dir, char *name, char *out, size_t n)
|
||||||
return (xstrlcpy(out + len, name, n - len) + len);
|
return (xstrlcpy(out + len, name, n - len) + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create symbolic/hard link(s) to file(s) in selection list */
|
/*
|
||||||
|
* Create symbolic/hard link(s) to file(s) in selection list
|
||||||
|
* Returns the number of links created
|
||||||
|
*/
|
||||||
static int xlink(char *suffix, char *path, char *buf, int type)
|
static int xlink(char *suffix, char *path, char *buf, int type)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
Loading…
Reference in a new issue