diff options
Diffstat (limited to 'src/skaembutils/seekablepipe.c')
-rw-r--r-- | src/skaembutils/seekablepipe.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/skaembutils/seekablepipe.c b/src/skaembutils/seekablepipe.c index 419be78..c2f5f48 100644 --- a/src/skaembutils/seekablepipe.c +++ b/src/skaembutils/seekablepipe.c @@ -1,15 +1,18 @@ /* ISC license. */ #include <unistd.h> + +#include <skalibs/posixplz.h> #include <skalibs/strerr2.h> #include <skalibs/iobuffer.h> #include <skalibs/djbunix.h> +#include <skalibs/exec.h> #define USAGE "seekablepipe tempfile prog..." #define N 8192 -int main (int argc, char const *const *argv, char const *const *envp) +int main (int argc, char const *const *argv) { iobuffer b ; int fdr, fdw ; @@ -22,8 +25,7 @@ int main (int argc, char const *const *argv, char const *const *envp) 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]) ; + unlink_void(argv[1]) ; if (ndelay_off(fdw) < 0) strerr_diefu1sys(111, "set fdw blocking") ; if (!iobuffer_init(&b, 0, fdw)) @@ -33,8 +35,8 @@ int main (int argc, char const *const *argv, char const *const *envp) strerr_diefu2sys(111, "write to ", argv[1]) ; if (r < 0) strerr_diefu1sys(111, "read from stdin") ; iobuffer_finish(&b) ; - fd_close(fdw) ; + close(fdw) ; if (fd_move(0, fdr) < 0) - strerr_diefu1sys(111, "move fdr to stdin") ; - xpathexec_run(argv[2], argv+2, envp) ; + strerr_diefu1sys(111, "move temporary file descriptor") ; + xexec(argv+2) ; } |