[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix for Arg list too long
From: |
Alexandre Oliva |
Subject: |
Re: Fix for Arg list too long |
Date: |
01 Feb 2001 23:55:18 -0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake) |
On Feb 1, 2001, "Boehne, Robert" <address@hidden> wrote:
> If 'expr' is used to check if the arguments list is too long, do we
> have to worry about 'expr' being a shell built-in?
Hmm... Presumably, yes, however I've never heard of expr as a
built-in. I'd use the $0 --fallback-echo approach.
> testring="ABCDEFGHIJKLMNOPQR"
> i=0
> result=0
> while test $? -eq 0
Testing $? here is not portable. Assignments don't always change $?.
How about:
while test `$0 --fallback-echo "X$testring"` = "X$testring" &&
new_result=`expr "X$testring" : ".*"` &&
result=$new_result &&
test $i != 16 # 1 MB should be enough
do
i=`expr $i + 1`
testring=$testring$testring
done
There's one thing I'm a little bit worried about, though. There's a
possibility that expr may not support long strings, when wc or awk
would.
I know some exprs won't print matches wider than 128 bytes, but I
don't know of any limitation when only the length of the match is
requested, as in our case.
This would result in our using command lines shorter than available.
No big deal, I suppose. And users will probably ask about it, so we
can fix it!
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer address@hidden, redhat.com}
CS PhD student at IC-Unicamp address@hidden, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me