#!/bin/csh -f
#
# refer2tex: translate a refer bibliography to a bibtex one.
#  Sort of. It may need some manual help but this is an approximation.
#
# David Kotz
#
# usage: refer2tex bibfile
# produces bibfile.bib, in BibTex format
#

onintr cleanup
set tmp=/tmp/$1.fix$$

if ($#argv < 1) then
    echo usage: refer2tex bibfile
    exit
endif

sed -f /usr/local/new/bib/bibfix.sed $1 > $tmp
sortbib -sA+D $tmp | r2bib > $1.bib

cleanup:
rm -f $tmp
