From 95bfdc5fa2d67b16e2caf21eab1eb629b2edc046 Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:50:31 +0800 Subject: [PATCH] xargs: add -0 flag * The -0 option to xargs is provided by FreeBSD, NetBSD, OpenBSD and GNU * Tested against the output of "find . -print0" * While here add strict (code was already compliant) --- bin/xargs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/xargs b/bin/xargs index 14cca677..a0c35f38 100755 --- a/bin/xargs +++ b/bin/xargs @@ -17,9 +17,11 @@ License: # Gurusamy Sarathy # +use strict; + use File::Basename qw(basename); -use Getopt::Std; -use Text::ParseWords; +use Getopt::Std qw(getopts); +use Text::ParseWords qw(quotewords); use constant EX_SUCCESS => 0; use constant EX_FAILURE => 1; @@ -27,10 +29,11 @@ use constant EX_FAILURE => 1; my $Program = basename($0); my %o; -getopts('tn:l:s:I:', \%o) or die <= $o{n}; last if $o{s} and length("@args") >= $o{s}; last if $o{l} and $totlines >= $o{l};