#! /bin/sh # mkhistory - rebuild history file and friends # Note, most sorts will accept "-T dir" to say where to put temporary files; # this can be gotten in by setting the SORTTMP environment variable in the # caller to "-T dir" and exporting it. Some sorts might ask you to do it # by setting TMPDIR instead. # =()<. ${NEWSCONFIG-@@}>()= . ${NEWSCONFIG-/usr/local/libexec/cnews/config} PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH umask $NEWSUMASK sizemul= case "$#$1" in 0) ;; 2-s) sizemul="$2" ;; *) echo "Usage: $0 [-s sizemultiplier]" >&2 exit 2 ;; esac lock LOCK $$ || exit 1 status=1 trap "unlock LOCK ; trap 0 ; exit \$status" 0 1 2 15 if lock -o LOCKexpire $$ then trap "unlock LOCK LOCKexpire ; trap 0 ; exit \$status" 0 1 2 15 else echo "$0: expire is running, $0 aborted" >&2 fi cd $NEWSARTS them= for f in `ls | egrep -v '\.|(^lost\+found$)'` do if test -d $f/. then them="$them $f" fi done find $them -type f -name '[0-9]*' -print | histinfo | sort $SORTTMP | awk -f $NEWSBIN/maint/histdups | sort $SORTTMP -t' ' +1n >$NEWSCTL/history.n cd $NEWSCTL if egrep '^<[^>]*@trash> ' history.n >/dev/null then echo "$0: (warning) empty/trash articles found, will expire at once" >&2 echo "$0: (grep history file for '@trash' to see them)" >&2 fi case "$sizemul" in '') dbzparm= ;; *) size="`wc -l