summaryrefslogtreecommitdiff
path: root/src/skaembutils/seekablepipe.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-25 19:17:59 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-25 19:17:59 +0000
commit0fb2de356daf76816bf203bf62c257a95ef303b7 (patch)
tree8ec4bd4338febdcc858759b1c710b32cd2523c8e /src/skaembutils/seekablepipe.c
parentb08261b5bb18d5c3f3fece09c5c582679f6c8bbc (diff)
downloads6-portable-utils-0fb2de356daf76816bf203bf62c257a95ef303b7.tar.xz
No iobuffer
Signed-off-by: Laurent Bercot <ska@appnovation.com>
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") ;