summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-02-27 00:47:51 +0000
committerLaurent Bercot <ska@appnovation.com>2022-02-27 00:47:51 +0000
commitb4070f01c00a07d4f2df6a3ff85eb6f2b1386b84 (patch)
tree1f39d639b5a8c6bc17326c3a14d30d6015081c4b
parent17a7d5f052aea7d9d79464dd4d4e4ab1b1b8f3c1 (diff)
downloads6-b4070f01c00a07d4f2df6a3ff85eb6f2b1386b84.tar.xz
Add noclamp option to s6-envdir
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--doc/s6-envdir.html9
-rw-r--r--src/daemontools-extras/s6-envdir.c5
2 files changed, 10 insertions, 4 deletions
diff --git a/doc/s6-envdir.html b/doc/s6-envdir.html
index 6392963..17577b4 100644
--- a/doc/s6-envdir.html
+++ b/doc/s6-envdir.html
@@ -25,7 +25,7 @@ s6-envdir changes its environment, then executes into another program.
<h2> Interface </h2>
<pre>
- s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -c <em>nullis</em> ] <em>dir</em> <em>prog...</em>
+ s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -L ] [ -c <em>nullis</em> ] <em>dir</em> <em>prog...</em>
</pre>
<ul>
@@ -35,7 +35,7 @@ that does not begin with a dot and does not contain the '=' character: </li>
<li> Else add a variable named <em>f</em> to the environment (or replace <em>f</em> if it
already exists) with the first line of the contents of file <em>f</em> as value.
Spaces and tabs at the end of this line are removed, as well as any trailing newline;
-null characters in this line are changed to newlines in the environment variable.</li>
+null characters in this line are changed to newlines in the environment variable. </li>
</ul>
<h2> Options </h2>
@@ -52,6 +52,11 @@ option is not given). Null characters are still translated. </li>
file ends with a newline, keep that last newline in the value. If the <tt>-f</tt>
option is not given, keep the trailing blanks at the end of the first line (but
not the ending newline). </li>
+ <li> <tt>-L</tt>&nbsp;: do not clamp. With this option, s6-envdir will process
+the whole first line of each file (if the <tt>-f</tt> option hasn't been given)
+or read each file entirely (if the <tt>-f</tt> option has been given), even if
+it means adding huge variables to the environment. Without this option, s6-envdir
+only reads the first 4096 bytes of each file. </li>
<li> <tt>-c</tt>&nbsp;<em>nullis</em>&nbsp;: replace null characters with the
first character of <em>nullis</em> instead of a newline. </li>
</ul>
diff --git a/src/daemontools-extras/s6-envdir.c b/src/daemontools-extras/s6-envdir.c
index 4c297ea..9b98b4a 100644
--- a/src/daemontools-extras/s6-envdir.c
+++ b/src/daemontools-extras/s6-envdir.c
@@ -8,7 +8,7 @@
#include <skalibs/env.h>
#include <skalibs/exec.h>
-#define USAGE "s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -c nullchar ] dir prog..."
+#define USAGE "s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -L ] [ -c nullchar ] dir prog..."
int main (int argc, char const *const *argv)
{
@@ -20,7 +20,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-envdir" ;
for (;;)
{
- int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ;
+ int opt = subgetopt_r(argc, argv, "IinfLc:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -28,6 +28,7 @@ int main (int argc, char const *const *argv)
case 'i' : insist = 1 ; break ;
case 'n' : options |= SKALIBS_ENVDIR_NOCHOMP ; break ;
case 'f' : options |= SKALIBS_ENVDIR_VERBATIM ; break ;
+ case 'L' : options |= SKALIBS_ENVDIR_NOCLAMP ; break ;
case 'c' : nullis = *l.arg ; break ;
default : strerr_dieusage(100, USAGE) ;
}