From bartsch@informatik.tu-muenchen.deFri Jun  9 09:12:32 1995
Date: Fri, 2 Jun 1995 16:19:45 +0200
From: Wolfgang Bartsch <bartsch@informatik.tu-muenchen.de>
To: fgate-users@gondor.gun.de
Subject: Echomail Header and Footer for RFC Postings
Resent-Date: Sat, 3 Jun 1995 04:52:23 +0200
Resent-From: fgate-users@gondor.gun.de

Hi,

here is my solution for my wishes for the new fidogate release.

As you may remember I need (eh, not really need, but would like) the
X-Comment-To, Tearline and Origin in the body of the imported news article.

Now I've written 2 small awk scripts which will do that.

I have replaced in ftninpost the RNEWS command with
"awk -f split_newsbatch.awk". This will call the awk script fidoinpost.awk
and inews (not rnews!)

Here are my scripts:

--------------------------------------------------------------------------
#!/usr/bin/awk -f
# split_newsbatch.awk, v0.1
# Wolfgang Bartsch, 29.5.95
# <woba@leo.org>  http://www.leo.org/~bartsch/  (Fido: 2:2480/746)
#
# Copy Policy: you can use and copy this silly small awk script
#	whereever you want. I think you should mention my name,
#	whenever you use a significant part (whatever that means
#	with this <50 lines) of this script.

# Usage:  awk -f [-W lint] split_newsbatch.awk < newsbatch

# Remember: we use "inews" instead of "rnews" here


# sorry, bad style:
#  I couldn't find out how to put the command line in a variable
#  So if you change something, be sure to change it in both locations
#  and BTW: the path to fidoinpost.awk should be better stored in a variable too 

/^\#\! rnews/	\
	{	close ("awk -f /usr/local/lib/fidogate/fidoinpost.awk -| /usr/lib/news/inews -h -S");
		next
	}

# pipe input into fidoinpost.awk; the splitting is done with the close command in
	{ print | "awk -f /usr/local/lib/fidogate/fidoinpost.awk -| /usr/lib/news/inews -h -S"}

END	{	close ("awk -f /usr/local/lib/fidogate/fidoinpost.awk -| /usr/lib/news/inews -h -S" ) }
	

--------------------------------------------------------------------------



--------------------------------------------------------------------------
#!/usr/bin/awk -f
# fidoinpost.awk, v0.9
# Wolfgang Bartsch, 28.5.95
# <woba@leo.org>  http://www.leo.org/~bartsch/  (Fido: 2:2480/746)
#
# Copy Policy: you can use and copy this silly small awk script
#	whereever you want. I think you should mention my name,
#	whenever you use a significant part (whatever that means
#	with this <50 lines) of this script.

# Usage:  awk -f [-W lint] fidoinpost.awk < single.article
#    or:  cat single.article | awk -f fidoinpost.awk -

# Important: ftn2rfc produces *newsbatches*, that means files
#	containing several articles; the articles are separated
#	with a "#!rnews" line; you must split this newsbatches
#	with an apropriate script like split_newsbatch.awk

# are this header lines or body lines?
BEGIN	{inheader = 1}


# Read in fido specific kludge lines (see: we need no "next" here):

/^X-Comment-To:/	{ To   = substr($0, 15, length($0) - 14) }
/^X-FTN-Origin:/	{ Orig = substr($0, 15, length($0) - 14) }
/^X-FTN-Tearline:/	{ Tear = substr($0, 17, length($0) - 16) }


#  we will have 4 more lines in the body after processing;

/^Lines:/	\
	{ Lin = $2; Lin = Lin + 4; printf "Lines: %d\n", Lin; next }


# the first empty line is the end of the header:
/^$/	{ if (inheader == 1) \
	  { 	inheader = 0; \
		print; \
		# print a "An:" line as first line of the body
		printf "[An: %s]\n\n", To; \
		next;
	  }
	} 


# Copy whole article to output
	{ print} 


# Print Tearline and Origin to end of body:
END	{ printf "[-- %s]\n[O*: %s]\n", Tear, Orig }


# end of fidoinpost


--------------------------------------------------------------------------


Gr"u"se,   (~\/\/~)
            \_/\_/olfgang

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    <A HREF=http://www.leo.org/~bartsch/>Wolfgang Bartsch</A>
