Er... aside from the broken patch problems, I mean.

:(

Once again, sorry about that.

-- 
Raul

--- xargs.c.orig        2017-10-13 14:13:16.000000000 -0400
+++ xargs.c        2017-10-13 15:16:16.000000000 -0400
@@ -65,7 +65,7 @@
 static char **av, **bxp, **ep, **endxp, **xp;
 static char *argp, *bbp, *ebp, *inpline, *p, *replstr;
 static const char *eofstr;
-static int count, insingle, indouble, oflag, pflag, tflag, Rflag, rval, zflag;
+static int count, insingle, indouble, oflag, pflag, tflag, Rflag,
rval, zflag, lflag;
 static int cnt, Iflag, jfound, Lflag, wasquoted, xflag, runeof = 1;
 static int curprocs, maxprocs;
 static size_t inpsize;
@@ -114,7 +114,7 @@
                 nline -= strlen(*ep++) + 1 + sizeof(*ep);
         }
         maxprocs = 1;
-        while ((ch = getopt(argc, argv, "0E:I:J:L:n:oP:pR:rs:tx")) != -1)
+        while ((ch = getopt(argc, argv, "0E:I:J:L:n:oP:pR:rs:tx/")) != -1)
                 switch (ch) {
                 case 'E':
                         eofstr = optarg;
@@ -174,6 +174,9 @@
                 case '0':
                         zflag = 1;
                         break;
+                case '/':
+                        lflag = 1;
+                        break;
                 case '?':
                 default:
                         usage();
@@ -262,7 +265,7 @@
                 if (insingle || indouble)
                         goto addch;
                 hasblank = 1;
-                if (zflag)
+                if (zflag || (lflag  && '\n'!=ch))
                         goto addch;
                 goto arg2;
         }
@@ -282,6 +285,8 @@
                         goto arg2;
                 goto addch;
         case '\n':
+                if (lflag)
+                        goto arg2;
                 hasblank = 1;
                 if (hadblank == 0)
                         count++;
@@ -360,19 +365,19 @@
                 wasquoted = 0;
                 break;
         case '\'':
-                if (indouble || zflag)
+                if (indouble || zflag || lflag)
                         goto addch;
                 insingle = !insingle;
                 wasquoted = 1;
                 break;
         case '"':
-                if (insingle || zflag)
+                if (insingle || zflag || lflag)
                         goto addch;
                 indouble = !indouble;
                 wasquoted = 1;
                 break;
         case '\\':
-                if (zflag)
+                if (zflag || lflag)
                         goto addch;
                 /* Backslash escapes anything, is escaped by quotes. */
                 if (!insingle && !indouble && (ch = getchar()) == EOF)

On Fri, Oct 13, 2017 at 3:07 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> Ok, I am curious - what new problems would this create?
>
> Thanks,
>
> --
> Raul
>
>
> On Fri, Oct 13, 2017 at 2:52 PM, Theo de Raadt <dera...@openbsd.org> wrote:
>>> The problem here is that you currently can't get xargs to use newline
>>> as a separator without also getting spaces as a separator. This
>>> creates a variety of problems.
>>
>> But it creates lots of other problems when you propose an extension to
>> only one operating system's version of a utility.
>>
>> I think you've written a diff and now you are handwaving...
>>

Reply via email to