#! /bin/sh
# arglencheck :
#  This program is used to check the maximum length of a command
# which is usually limited by the OS.  We need to have a way to
# create commands of increasing length, checking each time we increase the length
# to see if we've reached the maximum.

testring="ABCDEFGHIJKLMNOPQR"
i=0
result=0
while test $? -eq 0
do
  last_result=$result
  i=`expr $i + 1`
  old_testring="$testring"
  eval testring=\"${testring}${testring}\"
  # evaluate the command to pre-process
  result=`expr "X$testring" : ".*" 2>&1`
done
echo "Maximum command length is no smaller than $last_result"
#
# results:
# sparc-sun-solaris2.6        Maximum command length is no smaller than 589825
# sparc-sun-solaris2.7        Maximum command length is no smaller than 589825
# mips-sgi-irix6.5            Maximum command length is no smaller than 18433
# hppa1.1-hp-hpux10.20        Maximum command length is no smaller than 18433
# hppa2.0w-hp-hpux11.00       Maximum command length is no smaller than 1179649
# powerpc-ibm-aix4.3.3.0      Maximum command length is no smaller than 18433
# i686-pc-linux-gnu           Maximum command length is no smaller than 73729
# alphaev56-dec-osf4.0f       Maximum command length is no smaller than 36865
