summaryrefslogtreecommitdiff
path: root/src/conn-tools/seekablepipe.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 20:51:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 20:51:39 +0000
commitebfd0ba17e0d4b220725018d16e294e8e22a1745 (patch)
tree4b29683050ce9e8f24f1920f1be38b2f837ef5ad /src/conn-tools/seekablepipe.c
parent20c7d8e1b328155145ce9e8648435e127b60c208 (diff)
downloads6-networking-ebfd0ba17e0d4b220725018d16e294e8e22a1745.tar.xz
Move Unix domain socket and access control stuff to s6.
Move seekablepipe to s6-portable-utils. Version: 2.0.1.0, release candidate
Diffstat (limited to 'src/conn-tools/seekablepipe.c')
-rw-r--r--src/conn-tools/seekablepipe.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/conn-tools/seekablepipe.c b/src/conn-tools/seekablepipe.c
deleted file mode 100644
index 611f227..0000000
--- a/src/conn-tools/seekablepipe.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ISC license. */
-
-#include <unistd.h>
-#include <skalibs/strerr2.h>
-#include <skalibs/iobuffer.h>
-#include <skalibs/djbunix.h>
-
-#define USAGE "seekablepipe tempfile prog..."
-
-#define N 8192
-
-int main (int argc, char const *const *argv, char const *const *envp)
-{
- iobuffer b ;
- int fdr, fdw ;
- int r ;
- PROG = "seekablepipe" ;
- if (argc < 3) strerr_dieusage(100, USAGE) ;
- fdw = open_trunc(argv[1]) ;
- if (fdw < 0)
- strerr_diefu2sys(111, "create temporary ", argv[1]) ;
- fdr = open_readb(argv[1]) ;
- if (fdr < 0)
- strerr_diefu3sys(111, "open ", argv[1], " for reading") ;
- if (unlink(argv[1]) < 0)
- strerr_diefu2sys(111, "unlink ", argv[1]) ;
- if (ndelay_off(fdw) < 0)
- strerr_diefu1sys(111, "set fdw blocking") ;
- if (!iobuffer_init(&b, 0, fdw))
- strerr_diefu1sys(111, "iobuffer_init") ;
- while ((r = iobuffer_fill(&b)) > 0)
- if (!iobuffer_flush(&b))
- strerr_diefu2sys(111, "write to ", argv[1]) ;
- if (r < 0) strerr_diefu1sys(111, "read from stdin") ;
- iobuffer_finish(&b) ;
- fd_close(fdw) ;
- if (fd_move(0, fdr) < 0)
- strerr_diefu1sys(111, "move fdr to stdin") ;
- pathexec_run(argv[2], argv+2, envp) ;
- strerr_dieexec(111, argv[2]) ;
-}