From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13013 invoked by alias); 12 Apr 2012 09:28:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30389 Received: (qmail 28089 invoked from network); 12 Apr 2012 09:28:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.214.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=2WVvoURaLk0KkEte7S2AB1oB/m4inuGPDMksYDKiPEk=; b=JnG2m5Wt6XVK+DPapw65MRBnCMPk1DuyM35TkQgkhxN45ZsLgJrqnZX1+DBYUbcaAk qfkp0xegBwnALHzzYXCQG5iA3Y41vjjQREfAb4tb+h1diJJzPE5ddtsTvoWVRnTDUohz i9ALPixSFUiXwdR6kxPRvCJHE9ToKwusp5AhBwgyD/FAehdlrW4Lmybkx5jLarlOLOYs YeIYY0KftUuv+fQIfT1WWg0SLv5oRUtNErrB/FA5ZWXIp4CscD8rqv3LnpykNJ8qwXck 2GgWqgev+913Y7ZeH6UbD6WCTe+ejl3983XNgGE/6ucabVl30iHvE+qwL2ORwrmgZvOb 9ttw== Date: Thu, 12 Apr 2012 10:28:22 +0100 From: Stephane Chazelas To: Peter Stephenson Cc: "zsh-workers@zsh.org" Subject: Re: Problems with zargs (Was: xargs should be a builtin) Message-ID: <20120412092822.GA13041@chaz.gmail.com> Mail-Followup-To: Peter Stephenson , "zsh-workers@zsh.org" References: <0363642A-FD71-4DEE-8284-D7E72EAC8AD0@Yost.com> <87k41mr9u7.fsf@ft.bewatermyfriend.org> <20120411100642.GA8180@chaz.gmail.com> <20120411171539.4a09da6a@pws-pc.ntlworld.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120411171539.4a09da6a@pws-pc.ntlworld.com> User-Agent: Mutt/1.5.21 (2010-09-15) 2012-04-11 17:15:39 +0100, Peter Stephenson: > On Wed, 11 Apr 2012 11:06:42 +0100 > Stephane Chazelas wrote: > > By the way, there seems to be some issues with zargs: > > > > ~$ zargs a b '' -- print -rl > > a > > b > > ~$ zargs a -- print -rl '' > > a > > ~$ zargs -e a '' print -rl > > a print -rl > > ~$ zargs --eof= a '' print -rl > > a > > It helps if everyone always says explicitly what the problem actually > is, it saves lots of guesswork. Sorry about that. Wrote in a rush. > I've come up with the following for the problems I understand, but I'm > sure it could do with a bit more prodding. [...] Thanks. That seems to do the trick. May I knitpick: ~$ ''() echo X "$@" ~$ zargs 1 2 -- '' 1 2 ~$ zargs 1 2 -- '' '' X 1 2 --- zargs.old 2012-04-12 10:26:20.658633028 +0100 +++ /usr/share/zsh/functions/Misc/zargs 2012-04-12 10:27:20.709077765 +0100 @@ -174,7 +174,7 @@ else set -- "${(@)argv[1,end-1]}" fi -if [[ -n $command ]] +if (($#command)) then (( c = $#command - 1 )) else command=( print -r -- ) fi -- Stephane