summaryrefslogtreecommitdiffstats
path: root/usr.bin/xargs
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2005-02-27 01:35:54 +0000
committergad <gad@FreeBSD.org>2005-02-27 01:35:54 +0000
commit4044e01081b885debf7fde88605f45451c083273 (patch)
tree66b1ddd4658c461ad61861afa5c2bb42076170cf /usr.bin/xargs
parent24b8592306d503ded4ae6f61837516af7e6bfce9 (diff)
downloadFreeBSD-src-4044e01081b885debf7fde88605f45451c083273.zip
FreeBSD-src-4044e01081b885debf7fde88605f45451c083273.tar.gz
MFC 1.22: Fix -0 vs -L/-I processing, mainly so that 'xargs -0 -I []' will
do something sensible (namely: treat then '\0' as the EOL character, when deciding what "a line" is for -N). Note that -I implies -N. MFC after: 3 days
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r--usr.bin/xargs/xargs.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index c30934a..c75f18d 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -272,13 +272,20 @@ parse_input(int argc, char *argv[])
goto addch;
goto arg2;
case '\0':
- if (zflag)
+ if (zflag) {
+ /*
+ * Increment 'count', so that nulls will be treated
+ * as end-of-line, as well as end-of-argument. This
+ * is needed so -0 works properly with -I and -L.
+ */
+ count++;
goto arg2;
+ }
goto addch;
case '\n':
- count++;
if (zflag)
goto addch;
+ count++; /* Indicate end-of-line (used by -L) */
/* Quotes do not escape newlines. */
arg1: if (insingle || indouble)
OpenPOWER on IntegriCloud