From: Motoi Washida <a66@h8.dion.ne.jp>
To: zsh-workers@sunsite.dk
Subject: number of arguments zargs use
Date: Sat, 30 Oct 2004 22:59:08 +0900 [thread overview]
Message-ID: <DE201C1C-2A7B-11D9-A1A8-000D93502E64@h8.dion.ne.jp> (raw)
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
next reply other threads:[~2004-10-30 14:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-30 13:59 Motoi Washida [this message]
2004-10-31 5:30 ` Bart Schaefer
2004-10-31 7:34 ` Motoi Washida
2004-11-04 1:32 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DE201C1C-2A7B-11D9-A1A8-000D93502E64@h8.dion.ne.jp \
--to=a66@h8.dion.ne.jp \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).