Introduction
Introduction Statistics Contact Development Disclaimer Help
Fix using blind-from-name without command - blind - suckless command-line video…
git clone git://git.suckless.org/blind
Log
Files
Refs
README
LICENSE
---
commit 86beb51a66bf680a212584e72d70eff74fe559b9
parent f70ffc7f6e6331a56be4a52882c432133e40bd01
Author: Mattias Andrée <[email protected]>
Date: Sat, 22 Jul 2017 17:47:08 +0200
Fix using blind-from-name without command
Signed-off-by: Mattias Andrée <[email protected]>
Diffstat:
M TODO | 2 --
M src/blind-from-named.c | 45 +++++------------------------…
2 files changed, 7 insertions(+), 40 deletions(-)
---
diff --git a/TODO b/TODO
@@ -1,5 +1,3 @@
-Fix blind-from-named without command
-
blind-transform affine transformation by matrix multiplication,…
improve quality on downscaling (pixels' neighb…
blind-primary-key replace a primary with transparency, -g for greyscale…
diff --git a/src/blind-from-named.c b/src/blind-from-named.c
@@ -39,42 +39,16 @@ erecv_fd(int sock)
return fd;
}
-#if !defined(HAVE_SENDFILE)
-static ssize_t
-sendfile(int outfd, int infd, off_t *offset, size_t count)
-{
- char buf[PIPE_BUF];
- ssize_t r, w, p, ret = 0;
-
- (void) offset;
- (void) count;
-
- for (;;) {
- r = read(infd, buf, sizeof(buf));
- if (r < 0)
- eprintf("read <received file>:");
- if (!r)
- break;
- ret += r;
- for (p = 0; p < r; p += w) {
- w = write(outfd, buf + p, (size_t)(r - p));
- if (w < 0)
- eprintf("write <stdout>:");
- }
- }
-
- return ret;
-}
-#endif
-
int
main(int argc, char *argv[])
{
+ char buf[BUFSIZ];
struct sockaddr_un addr;
int abstract = 0;
int filedes = -1;
int tries = 11;
int sockfd, fd;
+ ssize_t n;
ARGBEGIN {
case 'a':
@@ -133,14 +107,9 @@ retry:
eprintf("execvp %s:", argv[0]);
}
- for (;;) {
- switch (sendfile(STDOUT_FILENO, fd, NULL, SIZE_MAX)) {
- case 0:
- return 0;
- case -1:
- eprintf("sendfile <stdout> <received file>:");
- default:
- break;
- }
- }
+ while ((n = read(fd, buf, sizeof(buf))) > 0)
+ ewriteall(STDOUT_FILENO, buf, (size_t)n, "<stdout>");
+ if (n < 0)
+ eprintf("read <received file>:");
+ return 0;
}
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.