# Do a guess.
# We take 128 bytes for each file header in the archive.

cd $packhome

mytee </tmp/tbup/choice 2>/tmp/tbup/logtty | \
stattool -s >/tmp/tbup/total

cd /tmp/tbup

gawk -f- total <<-'blex'
{
 tot=$1; files=$2;
 printf " Files and directories in archive: %d\n",files;
 print ""
 printf " Data in archive:  %d bytes",tot;
 printf "  =  %1.2f Kb", tot/1024;
 printf "  =  %1.2f Mb.\n", tot/(1024*1024);
 print ""
 print " Guess of floppy disks needed:"
 print "                                compression factor"
 print "                              none    70\%    50\%    30\%"

name[1]="5.25\" d   (360Kb)";  size[1]=350;
name[2]="5.25\" h  (1.20Mb)";  size[2]=1181;
name[3]="3.5\"  d   (720Kb)";  size[3]=710;
name[4]="3.5\" xd   (820Kb)";  size[4]=810;
name[5]="3.5\"  h  (1.44Mb)";  size[5]=1421;
name[6]="3.5\" xh  (1.72Mb)";  size[6]=1702;

rate[1]=1; rate[2]=0.7; rate[3]=0.5; rate[4]=0.3;

for(i=1; i<=6; i++)
 {
   if(i==3) printf "\n";
   printf "         %s:",name[i];
   for(j=1; j<=4; j++)
     {
       printf "%7d",int((tot*rate[j]+files*128)/(size[i]*0.95*1024)+1);
     }
   printf "\n";
  }
}
blex

echo
rm total