summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 19:20:48 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-15 19:20:48 +0000
commit1367418899513629d1994894143eb37b9048c850 (patch)
tree5447b0b110a174215e0837595a6aca16fb738acf
parent051f0f15b39cfaa198e833dd6b6f1bd7c69ec4eb (diff)
downloads6-portable-utils-1367418899513629d1994894143eb37b9048c850.tar.xz
- Move seekablepipe from s6-networking to here
- Version tag: 2.0.1.0, release candidate
-rw-r--r--INSTALL2
-rw-r--r--doc/index.html5
-rw-r--r--doc/seekablepipe.html36
-rw-r--r--doc/upgrade.html13
-rw-r--r--package/deps.mak3
-rw-r--r--package/info2
-rw-r--r--package/modes1
-rw-r--r--package/targets.mak3
-rw-r--r--src/skaembutils/deps-exe/seekablepipe1
-rw-r--r--src/skaembutils/seekablepipe.c41
10 files changed, 100 insertions, 7 deletions
diff --git a/INSTALL b/INSTALL
index cef1e34..00d050d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 4.0 or later
- - skalibs version 2.1.0.0 or later: http://skarnet.org/software/skalibs/
+ - skalibs version 2.2.0.0 or later: http://skarnet.org/software/skalibs/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/doc/index.html b/doc/index.html
index b5ba202..5d00821 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -60,7 +60,7 @@ the package is now used to host specific utilities such as
<li> A POSIX-compliant system with a standard C development environment </li>
<li> GNU make, version 4.0 or later </li>
<li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version
-2.1.0.0 or later </li>
+2.2.0.0 or later </li>
</ul>
<h3> Licensing </h3>
@@ -74,7 +74,7 @@ the package is now used to host specific utilities such as
<ul>
<li> The current released version of s6-portable-utils is
-<a href="s6-portable-utils-2.0.0.1.tar.gz">2.0.0.1</a>. </li>
+<a href="s6-portable-utils-2.0.1.0.tar.gz">2.0.1.0</a>. </li>
<li> Alternatively, you can checkout a copy of the s6-portable-utils git repository:
<pre> git clone git://git.skarnet.org/s6-portable-utils </pre> </li>
</ul>
@@ -143,6 +143,7 @@ the previous versions of s6-portable-utils and the current one. </li>
<li> The <a href="s6-unquote-filter.html"><tt>s6-unquote-filter</tt></a> program </li>
<li> The <a href="s6-unquote.html"><tt>s6-unquote</tt></a> program </li>
<li> The <a href="s6-update-symlinks.html"><tt>s6-update-symlinks</tt></a> program </li>
+ <li> The <a href="seekablepipe.html"><tt>seekablepipe</tt></a> program </li>
</ul>
<h2> Related resources </h2>
diff --git a/doc/seekablepipe.html b/doc/seekablepipe.html
new file mode 100644
index 0000000..e8fe453
--- /dev/null
+++ b/doc/seekablepipe.html
@@ -0,0 +1,36 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>s6-portable-utils: the seekablepipe program</title>
+ <meta name="Description" content="s6-portable-utils: the seekablepipe program" />
+ <meta name="Keywords" content="s6-portable-utils seekablepipe pipe seekablepipe-io" />
+ <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">s6-portable-utils</a><br />
+<a href="http://skarnet.org/software/">Software</a><br />
+<a href="http://skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>seekablepipe</tt> program </h1>
+
+<tt>seekablepipe</tt> turns the reading end of a pipe into a seekable
+file descriptor, using a temporary file.
+
+<h2> Interface </h2>
+
+<pre>
+ <em>writer</em> | seekablepipe <em>tmpfile reader [ args ... ]</em>
+</pre>
+
+<p>
+<tt>seekablepipe</tt> writes <em>writer</em>'s output to <em>tmpfile</em>,
+which is unlinked as soon as it is created. Then it execs into
+<em>reader</em>, reading from a file descriptor on <em>tmpfile</em>.
+</p>
+
+</body>
+</html>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 6ea3b7e..70d8b07 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -17,10 +17,19 @@
<h1> What has changed in s6-portable-utils </h1>
+<h2> in 2.0.1.0 </h2>
+
+<ul>
+ <li> skalibs dependency bumped to 2.2.0.0. </li>
+ <li> seekablepipe moved from
+<a href="http://skarnet.org/software/s6-networking/">s6-networking</a>
+to s6-portable-utils. </li>
+</ul>
+
<h2> in 2.0.0.1 </h2>
<ul>
- <li> skalibs dependency bumped to 2.1.0.0 </li>
+ <li> skalibs dependency bumped to 2.1.0.0. </li>
</ul>
<h2> in 2.0.0.0 </h2>
@@ -31,7 +40,7 @@
build system. See the enclosed INSTALL file for details. </li>
<li> slashpackage is not activated by default. </li>
<li> shared libraries are not used by default. </li>
- <li> skalibs dependency bumped to 2.0.0.0 </li>
+ <li> skalibs dependency bumped to 2.0.0.0. </li>
</ul>
</body>
diff --git a/package/deps.mak b/package/deps.mak
index 6ef1cf4..adbca33 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -41,6 +41,7 @@ src/skaembutils/s6-uniquename.o src/skaembutils/s6-uniquename.lo: src/skaembutil
src/skaembutils/s6-unquote-filter.o src/skaembutils/s6-unquote-filter.lo: src/skaembutils/s6-unquote-filter.c
src/skaembutils/s6-unquote.o src/skaembutils/s6-unquote.lo: src/skaembutils/s6-unquote.c
src/skaembutils/s6-update-symlinks.o src/skaembutils/s6-update-symlinks.lo: src/skaembutils/s6-update-symlinks.c
+src/skaembutils/seekablepipe.o src/skaembutils/seekablepipe.lo: src/skaembutils/seekablepipe.c
s6-basename: private EXTRA_LIBS :=
s6-basename: src/skaembutils/s6-basename.o -lskarnet
@@ -120,3 +121,5 @@ s6-unquote-filter: private EXTRA_LIBS :=
s6-unquote-filter: src/skaembutils/s6-unquote-filter.o -lskarnet
s6-update-symlinks: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB}
s6-update-symlinks: src/skaembutils/s6-update-symlinks.o -lskarnet
+seekablepipe: private EXTRA_LIBS :=
+seekablepipe: src/skaembutils/seekablepipe.o -lskarnet
diff --git a/package/info b/package/info
index 327e4a7..9ea8651 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6-portable-utils
-version=2.0.0.1
+version=2.0.1.0
category=admin
package_macro_name=S6_PORTABLE_UTILS
diff --git a/package/modes b/package/modes
index f32d538..2e8bf85 100644
--- a/package/modes
+++ b/package/modes
@@ -37,3 +37,4 @@ s6-uniquename 0755
s6-unquote 0755
s6-unquote-filter 0755
s6-update-symlinks 0755
+seekablepipe 0755
diff --git a/package/targets.mak b/package/targets.mak
index e811c1f..09fe7b1 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -37,7 +37,8 @@ s6-true \
s6-uniquename \
s6-unquote \
s6-unquote-filter \
-s6-update-symlinks
+s6-update-symlinks \
+seekablepipe
SBIN_TARGETS :=
LIBEXEC_TARGETS :=
diff --git a/src/skaembutils/deps-exe/seekablepipe b/src/skaembutils/deps-exe/seekablepipe
new file mode 100644
index 0000000..e7187fe
--- /dev/null
+++ b/src/skaembutils/deps-exe/seekablepipe
@@ -0,0 +1 @@
+-lskarnet
diff --git a/src/skaembutils/seekablepipe.c b/src/skaembutils/seekablepipe.c
new file mode 100644
index 0000000..611f227
--- /dev/null
+++ b/src/skaembutils/seekablepipe.c
@@ -0,0 +1,41 @@
+/* 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]) ;
+}