diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-24 10:44:08 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-24 10:44:08 +0000 |
commit | 8d67429c8b37415b04ec195dab9bdbcec8ec013a (patch) | |
tree | e42f15e902ef3d0454703e90691040c3b603042e | |
parent | 79d5c4eff6101f329b8ea52dd9e6d2336ea8bc93 (diff) | |
download | execline-8d67429c8b37415b04ec195dab9bdbcec8ec013a.tar.gz execline-8d67429c8b37415b04ec195dab9bdbcec8ec013a.tar.xz execline-8d67429c8b37415b04ec195dab9bdbcec8ec013a.zip |
Make forstdin only split on newlines by default
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/forstdin.html | 6 | ||||
-rw-r--r-- | doc/upgrade.html | 3 | ||||
-rw-r--r-- | src/execline/forstdin.c | 2 |
4 files changed, 9 insertions, 5 deletions
diff --git a/NEWS b/NEWS index 54b3ebe..6be3c4d 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,8 @@ Changelog for execline. In 2.7.0.0 ---------- - - New -e option to forstdin. + - forstdin QoL changes: new -e option to exit nonzero on EOF, +and it now only splits on newlines by default. - New "default" directive to trap, replacing the irrelevant "timeout". diff --git a/doc/forstdin.html b/doc/forstdin.html index f57ee9c..c7cc3d4 100644 --- a/doc/forstdin.html +++ b/doc/forstdin.html @@ -35,7 +35,7 @@ run another program. <ul> <li> <tt>forstdin</tt> reads its standard input as it becomes available, -<a href="el_transform.html#split">splitting</a> it automatically. </li> +<a href="el_transform.html#split">splitting</a> it on every line automatically. </li> <li> For every argument <em>x</em> in the split output, <tt>forstdin</tt> runs <em>loop...</em> as a child process, with <em>variable</em>=<em>x</em> added to its environment. </li> @@ -67,7 +67,9 @@ codes will make it keep looping. </li> exit <em>eofcode</em>. Default is 0. </li> <li> Other options are used to <a href="el_transform.html">control the substitution mechanism</a> for every <em>x</em>. Of course, you can't -split <em>x</em>. </li> +split <em>x</em>. The default delimiter for <tt>forstdin</tt> is a +newline; you need a <tt>-d</tt> option to split <em>x</em> around +other values. </li> </ul> <h2> Notes </h2> diff --git a/doc/upgrade.html b/doc/upgrade.html index aa23ab2..690c87e 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -23,7 +23,8 @@ <ul> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> dependency bumped to 2.9.4.0. </li> - <li> New <tt>-e</tt> option to <a href="forstdin.html">forstdin</a>. </li> + <li> <a href="forstdin.html">forstdin</a> gets a new <tt>-e</tt> +option, and now only splits on newlines by default. </li> <li> New <tt>default</tt> directive to <a href="trap.html">trap</a>, replacing the <tt>timeout</tt> one, which was ill-suited to that program. </li> </ul> diff --git a/src/execline/forstdin.c b/src/execline/forstdin.c index 7979811..323ef59 100644 --- a/src/execline/forstdin.c +++ b/src/execline/forstdin.c @@ -47,7 +47,7 @@ static void parallel_sigchld_handler (int sig) int main (int argc, char const **argv, char const *const *envp) { - char const *delim = " \n\r\t" ; + char const *delim = "\n" ; size_t delimlen = 4 ; size_t nbc = 0 ; unsigned short okcodes[256] ; |