On Fri, Sep 19, 2025 at 09:18:41AM +0200, Roberto E. Vargas Caballero wrote:
> Hi
> 
> On Thu, Jul 31, 2025 at 03:31:08PM +0200, Hiltjo Posthuma wrote:
> > From ed5e4d34a16436a37c0e084666fcfb77cc4859c3 Mon Sep 17 00:00:00 2001
> > From: Hiltjo Posthuma <[email protected]>
> > Date: Thu, 31 Jul 2025 14:42:59 +0200
> > Subject: [PATCH 4/4] improve man pages and some warnings.
> 
> I have pushed your changes. I will continue with the other patches
> submitted in the comming days. Sorry guys with the delay.
> 
> Regards,
> 

Thanks,

Below is an amended patch to fix xargs compared to my original patch
(also posted on IRC).


>From 4ff69daa154fe154e1e6318ef0493cddcf3478a5 Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <[email protected]>
Date: Fri, 19 Sep 2025 12:04:47 +0200
Subject: [PATCH 1/2] xargs: fix a regression with incorrectly using escaping
 with the -0 flag

The modified version of the original patch caused a regression and handling
escaping with the -0 where it shouldn't.
---
 xargs.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xargs.c b/xargs.c
index c85fb2a..b3b2a81 100644
--- a/xargs.c
+++ b/xargs.c
@@ -108,6 +108,14 @@ poparg(void)
        if (eatspace() < 0)
                return NULL;
        while ((ch = inputc()) != EOF) {
+               /* NUL separator: no escaping */
+               if (nulflag) {
+                       if (ch == '\0')
+                               goto out;
+                       else
+                               goto fill;
+               }
+
                switch (ch) {
                case ' ':
                case '\t':
@@ -127,10 +135,6 @@ poparg(void)
                        if (parseescape() < 0)
                                eprintf("backslash at EOF\n");
                        break;
-               case '\0':
-                       /* NUL separator: no escaping */
-                       if (nulflag)
-                               goto out;
                default:
                fill:
                        fillargbuf(ch);
-- 
2.51.0


>From 0e101b662eb402ca9efefc61b9a077c557288009 Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <[email protected]>
Date: Fri, 19 Sep 2025 12:05:59 +0200
Subject: [PATCH 2/2] README: update: xargs -p is now implemented

---
 README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README b/README
index ee2aae7..a3390a9 100644
--- a/README
+++ b/README
@@ -140,7 +140,7 @@ The following tools are implemented:
 0#*|o wc              .
 0=*|x which           .
 0=*|x whoami          .
-0=*|o xargs           (-p)
+0=*|o xargs           .
 0=*|x yes             .
 
 [1] http://git.suckless.org/ubase/
-- 
2.51.0

-- 
Kind regards,
Hiltjo

Reply via email to