about summary refs log tree commit diff
path: root/src/skaembutils/seekablepipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/skaembutils/seekablepipe.c')
-rw-r--r--src/skaembutils/seekablepipe.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/skaembutils/seekablepipe.c b/src/skaembutils/seekablepipe.c
index c2f5f48..f6c4059 100644
--- a/src/skaembutils/seekablepipe.c
+++ b/src/skaembutils/seekablepipe.c
@@ -4,7 +4,6 @@
 
 #include <skalibs/posixplz.h>
 #include <skalibs/strerr2.h>
-#include <skalibs/iobuffer.h>
 #include <skalibs/djbunix.h>
 #include <skalibs/exec.h>
 
@@ -14,9 +13,7 @@
 
 int main (int argc, char const *const *argv)
 {
-  iobuffer b ;
   int fdr, fdw ;
-  int r ;
   PROG = "seekablepipe" ;
   if (argc < 3) strerr_dieusage(100, USAGE) ;
   fdw = open_trunc(argv[1]) ;
@@ -28,13 +25,8 @@ int main (int argc, char const *const *argv)
   unlink_void(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) ;
+  if (fd_cat(0, fdw) < 0)
+    strerr_diefu1sys(111, "read from stdin") ;
   close(fdw) ;
   if (fd_move(0, fdr) < 0)
     strerr_diefu1sys(111, "move temporary file descriptor") ;