commit 2cbf61dff99c349c5e629d4e8dc7714d03b576fa
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Sep 22 14:19:36 2023 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Sep 22 14:19:36 2023 +0200

    xargs: Read full lines is -I
    
    POSIX specifies that when -I is used then arguments are delimited
    only by newlines.

diff --git a/xargs.c b/xargs.c
index 0d37ec8..d9b2d98 100644
--- a/xargs.c
+++ b/xargs.c
@@ -111,7 +111,11 @@ poparg(void)
                return NULL;
        while ((ch = inputc()) != EOF) {
                switch (ch) {
-               case ' ': case '\t': case '\n':
+               case ' ':
+               case '\t':
+                       if (Iflag)
+                               goto fill;
+               case '\n':
                        goto out;
                case '\'':
                        if (parsequote('\'') < 0)
@@ -126,6 +130,7 @@ poparg(void)
                                eprintf("backslash at EOF\n");
                        break;
                default:
+               fill:
                        fillargbuf(ch);
                        argbpos++;
                        break;

Reply via email to