#
# mklost+found
#
# Make a lost+found directory.
#

set -ue
umask 022

root=/
slash=

if [ $# -ne 2 ]
then
	echo "Usage: ${0} dir dev" >&2
	exit 1
fi

inodes=`fsinfo -i ${2}`
count=`ignore expr \( \( ${inodes} / 100 \) + 31 \) / 32`

ignore mkdir ${1}/lost+found 2>/dev/null
cd ${1}/lost+found

n=0
while [ ${n} -lt ${count} ]
do
	> a${n} ; > b${n} ; > c${n} ; > d${n} ; > e${n}
	> f${n} ; > g${n} ; > h${n} ; > i${n} ; > j${n}
	> k${n} ; > l${n} ; > m${n} ; > n${n} ; > o${n}
	> p${n} ; > q${n} ; > r${n} ; > s${n} ; > t${n}
	> u${n} ; > v${n} ; > w${n} ; > x${n} ; > y${n}
	> z${n} ; > A${n} ; > B${n} ; > C${n} ; > D${n}
	if [ ${n} -ne 0 ]
	then
		> E${n} ; > F${n}
	fi
	n=`ignore expr ${n} + 1`
done
if [ ${count} -ne 0 ]
then
	rm *
fi