#!/bin/csh
foreach f ( $* )
    set key = "$f.key"
    set flag = "$f.flags"
    set post = "$f.post"
    set html = "$f.html"
    set out = "$f.out"
    set tmp = "$f.tmp"
    set tmp2 = "$f.tmp2"
    rm -f $out $post
    set url = `grep URL $flag | sed 's/^URL: //'`
    set hash = `echo -n $url | sha1`
    echo "Subject: $hash" >> $post
    echo "Newsgroups: alt.anonymous.messages" >> $post
    echo "Message-Id: <$f.test>" >> $post
    echo "From: nobody@test.net" >> $post
    echo "signing html file..."
    pgp -sa $html -o $out
    cat $flag $key $out > $tmp
    pgp -ca -z"eternity" $tmp -o $tmp2
    mv $f $f~
    cat $post $tmp2 > $f
    rm -f $out $tmp $tmp2
end
