From 49b387bb53e76eecd2b6cf4f89f3146fc2198bd3 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Tue, 24 Nov 2020 17:56:57 +0000
Subject: Fix chomping: only make it default on line-processing binaries
---
doc/forstdin.html | 41 ++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)
(limited to 'doc/forstdin.html')
diff --git a/doc/forstdin.html b/doc/forstdin.html
index 44939fe..74644b4 100644
--- a/doc/forstdin.html
+++ b/doc/forstdin.html
@@ -30,7 +30,7 @@ run another program.
- forstdin [ -p | -o okcodes | -x breakcodes ] [ -E firsteofcode ] [ -e eofcode ] [ -n ] [ -C | -c ] [ -0 | -d delim ] variable loop...
+ forstdin [ -p | -o okcodes | -x breakcodes ] [ -N | -n ] [ -C | -c ] [ -0 | -d delim ] variable loop...
@@ -50,9 +50,6 @@ and 1 if it hasn't read anything.
instance to finish before spawning the next one. forstdin will
still wait for all instances of loop to terminate before
exiting, though.
- - -0 : accept null characters on its stdin,
-using them as delimiters. If this option and a -d option are
-used simultaneously, the rightmost one wins.
- -o okcodes : okcodes must
be a comma-separated list of exit codes. If the -p flag
hasn't been given and loop exits with one of the codes in
@@ -64,15 +61,33 @@ not listed in okcodes, forstdin will exit immediately with an
option, but with inverted meaning - the listed exit codes are codes
that will make forstdin break the loop and exit, and the unlisted exit
codes will make it keep looping.
- - -E firsteofcode : if forstdin encounters
-EOF on its first attempt to read data, exit firsteofcode. Default is 1.
- - -e eofcode : if forstdin has already
-read data, and encounters EOF, exit eofcode. Default is 0.
- - Other options are used to control
-the substitution mechanism for every x. Of course, you can't
-split x. The default delimiter for forstdin is a
-newline; you need a -d option to split x around
-other values.
+
+
+
+ Other options are similar (in name and functionality) to the switches
+passed to control a substitution mechanism,
+on purpose; however, forstdin does not call the substitution
+mechanism and has its own semantics for those options.
+
+
+
+ - -N : store the whole line in variable,
+including the terminating newline (or other delimiter).
+ - -n : chomp a terminating delimiter from the line from
+stdin before storing it into variable. This is the default.
+ - -C : crunch. If there is an empty line (i.e. that
+only contains a delimiter), do not call loop. If this option is
+given, and chomping is active, and the last line of stdin
+is not terminated by a delimiter, then this last line will not be processed.
+ - -c : do not crunch, call loop even if
+the line is empty. This is the default.
+ - -0 : accept null characters on its stdin,
+using them as delimiters. If this option and a -d option are
+used simultaneously, the rightmost one wins.
+ - -d delim : use the characters in string
+delim as delimiters for a line. Default is "\n", meaning
+the input is only split on newlines.
+ -
Notes
--
cgit v1.2.3