[news.software.b] spacefor under sysV3.2

det@hawkmoon.MN.ORG (Derek E. Terveer) (05/24/90)

Someone asked:
> Sean> Does anyone have a spacefor that works on sysV3.2?

When you run build, it asks for the type of system to use when constructing a
spacefor program.  I stated that is was either usg or sysv (i can't remember
which right now -- but it was fairly obvious).  The spacefor program that was
then created simply did not work under esix 5.3.2-c (which is a sysV3.2
system).  However, the only change required by me to get it to work was to
change the "nr = 2" to "nr = 1" in the awk script.  See below.

# In the following, the initialization of nf determines which field the
# block count comes from, and the one for nr determines which line.  For
# System V, the Makefile edits in a sed which tries to strip silliness
# off in a reasonably System-V-variant-independent way.  Expr would be
# faster than awk, but on a 16-bit machine, expr does 16-bit arithmetic,
# which isn't enough.

# this is set up for the stupid System V df
df $arg | sed "s/.*:/: :/" | awk "BEGIN { nf = 3 ; nr = 1 }
						   ^^^^^^^^
						   change from nr=2 to nr=1
	NR == nr && NF >= nf {
		nb = (\$nf - $desire) * $dfunit / $1
		if (nb > 10000)
			nb = 10000	# ensure representable as integer
		nb = int(nb)
		if (nb <= 0)
			print 0
		else
			print nb
		exit
	}
	NR == nr && NF < nf {		# idiotic Berkeley continuation
		nr += 1
		nf -= 1
	}"
-- 
Derek Terveer		det@hawkmoon.MN.ORG

hargen@pdn.paradyne.com (Bill Hargen) (06/02/90)

In article <1990May23.205735.3150@hawkmoon.MN.ORG> det@hawkmoon.MN.ORG (Derek E. Terveer) writes:
>When you run build, it asks for the type of system to use when constructing a
>spacefor program.  I stated that is was either usg or sysv (i can't remember
>which right now -- but it was fairly obvious).  The spacefor program that was
>then created simply did not work under esix 5.3.2-c (which is a sysV3.2
>system).  However, the only change required by me to get it to work was to
>change the "nr = 2" to "nr = 1" in the awk script.  See below.

I had a similar problem on a Counterpoint System 19K, which is sysV3.0 with
Berkley network stuff added.  I discovered that the version of spacefor as
built for Xenix makes the same change (nf=3, nr=1) and works fine.  The
machine is definitely NOT running Xenix or anything remotely decended from
it, but telling build to use the Xenix model saves me from editing spacefor.

--
Bill Hargen				AT&T Paradyne
{uunet,peora}!pdn!hargen		Mail stop LG-132
Phone: (813) 530-8655			P.O. Box 2826
					Largo, FL  34649-2826