From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8250 invoked from network); 30 Oct 2004 14:00:45 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 30 Oct 2004 14:00:45 -0000 Received: (qmail 59287 invoked from network); 30 Oct 2004 14:00:39 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Oct 2004 14:00:39 -0000 Received: (qmail 23752 invoked by alias); 30 Oct 2004 14:00:37 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20532 Received: (qmail 23722 invoked from network); 30 Oct 2004 14:00:35 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 30 Oct 2004 14:00:35 -0000 Received: (qmail 58378 invoked from network); 30 Oct 2004 13:59:36 -0000 Received: from sodans.usata.org (61.211.239.46) by a.mx.sunsite.dk with SMTP; 30 Oct 2004 13:59:34 -0000 Received: from [192.168.1.12] (ZQ226067.ppp.dion.ne.jp [222.13.226.67]) by sodans.usata.org (Postfix) with ESMTP id 41098AAE2 for ; Sat, 30 Oct 2004 22:59:28 +0900 (JST) Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: zsh-workers@sunsite.dk From: Motoi Washida Subject: number of arguments zargs use Date: Sat, 30 Oct 2004 22:59:08 +0900 X-Mailer: Apple Mail (2.619) X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=1.0 required=6.0 tests=FROM_ENDS_IN_NUMS autolearn=no version=2.63 X-Spam-Hits: 1.0 Hi all, I use zargs. It is good when I want to use long arguments. But it uses too small number of arguments at a time for me. This tries to get size of arguments allowed. I don't know this is portable enough, but it seems to work for me. Index: zargs =================================================================== RCS file: /cvsroot/zsh/zsh/Functions/Misc/zargs,v retrieving revision 1.3 diff -d -u -r1.3 zargs --- zargs 4 Sep 2002 06:28:37 -0000 1.3 +++ zargs 30 Oct 2004 13:54:47 -0000 @@ -213,7 +213,21 @@ fi fi -s=${${s##-(s|-max-chars(=|))}:-20480} +s=${s##-(s|-max-chars(=|))} + +if (( !s )) +then + local argmax envvars + argmax="$({command getconf ARG_MAX || + command sysctl -n kern.argmax} 2>/dev/null)" + if (( argmax )) + then + envvars="$(builtin typeset -x)" + s=$(( argmax - ( ${#${(f)envvars}} + ${#envvars} + 2048 ) )) + else + s=-20480 + fi +fi l=${${l##-(l|-max-lines(=|))}:-${${l[1]:+1}:-$ARGC}} # Everything has to be in a subshell just in case of backgrounding jobs, -- Motoi Washida