#!/bin/sh

#	Newsgroup moderators can pipe e-mail submissions into this script
#	to post approved articles to inn.  The author's version of this
#	script is available from:
#
#		ftp://ftp.cccd.edu/pub/usenet/innmoda
# 
#       Permission is freely granted to modify and redistribute this code as 
#       long as credit is given to the author: 
# 
#               Mark Bixby 
#               Coast Community College District 
#               District Information Services 
#               1370 Adams Avenue 
#               Costa Mesa, CA  92626 
#               USA 
#               e-mail: markb@cccd.edu
#               phone: +1 714 432 5064

#	Ignore everything until the Path: header.  Change Nntp-Posting-Host: to
#	the X- variant, and remove Status: headers generated by the mail client.
#	Post article with inews as Approved: by whatever is in $REPLYTO.

awk '\
  /^Path:/					{ art=1; hdr=1 } \
  hdr==1 && length==0				{ hdr=0 } \
  hdr==1 && tolower($1) == "nntp-posting-host:" { printf "X-%s\n",$0; next } \
  hdr==1 && /^Status:/				{ next } \
  art==1	{ print $0 }' | inews -S -h -a $REPLYTO
