#!/bin/sh
# @(#) $Header: makedexplist,v 1.1 96/06/07 13:57:34 leres Exp $ (LBL)
#
# makedexplist - construct the actual dexplist
#
# The file that we run off of is built from a base file, a list of
# the groups people are reading here, and a default for everything else.

##  =()<. @<_PATH_SHELLVARS>@>()=
. /usr/lib/news/bin/innshellvars

n=250
cd $NEWSLIB
rm -f dexplist.old
mv dexplist dexplist.old
(
  echo "# WARNING: This source automatically generated, do not edit."
  echo ''
  cat dexplist.base
  echo ''
  echo "# Top $n groups that people actually read here."
  cat ${MOST_LOGS}/topgroups/* | \
      awk -e '{t[$2] += $1}; END {for (n in t) printf "%s\t%s\n", t[n], n}' | \
      sort -rn | \
      head -$n | \
      sed -e 's/.*	//' -e 's/$/			x	100/'
  echo ''
  echo '# All other groups.'
  echo 'all			x	25'
  echo 'alt			x	10'
) > dexplist
chmod -w dexplist
