Re: Converting pegasus glue to soup (Combined)

From: Howard Schwartz (theo@ccnet.com)
Date: Thu, 30 Dec 99 19:32:50

Andrew Wrote:
> *** Start of quoted message #1 ***
> OK thanks howard for that, what about converting a soup reply packet
> (mail only) to a pegasus glue file?? I cannot use ypost for this task.

> Basicly, I have a program on the network called Mercury which if you put
> glue files into a queue directory, you can send the files out directly,
> without having to use an smtp server clone to do it

And Steve Washam wrote:
> *** Start of quoted message #2 ***
> Andrew Morrow has a utility PM-GLUE which works for this.

> He's at andrew@packet.org if I recall correctly. Note that
> this is not the same as PMGLUE which I think is by David
> Harris. Andrew was very helpful in modifying this so I
> could use merc32 with yarn.

> I unzip the packet, then apply PM-GLUE in a FOR loop to
> each *.OUT file.

I think there may be some confusion here. Soup packets like the one
created by yarn, put many different messages in one file (e.g., the
file MAIL.MSG). Therefore, in converting a soup packet to Pegasus type,
glue headers there are 2 tasks:
o Convert the header of each message from soup format to glue
format.
o Split the message file in the soup packet into several files
so that there is one file per message.

I dont know about the program, PM-GLUE, but from Steve's remarks it
converts files, with an ``out'' suffix, one at a time, to glue header
files. I suspect this is a conversion of one type of Pegasus format
to another, since yarn or other soup files are not called, file.out.
However, PM-GLUE clearly does not break a single soup file up onto
separate files, one file per message.

I wrote a small awk script that converts each message in a Soup packet
to Glue format and then writes each converted message to a separate
file. I include the script below. I suggest using the Delorie 32-bit
version of gawk (freeware) to run ths script.

--------------------------Begin awk script----------------------------------
BEGIN{RS=nn"....To: *" ; FS="\n"; OFS="\n"; path="C\:\\pegasus\\spool\\mail"
}
{print RT}
NR == 1 {nn = "\n"; next}
{print ("\$\$ <theo@ccnet.com\nT "$1) >> path (++aa) ".msg"
sub(/^.*$/,nn"To: &",$1)
for (i = 2;i < 6; i++)
{
if ($i ~ /^(To|C[cC]|B[cC]+)\:/) {
bb = gensub(/^(.).*\: *(.*)$/,"\\1 \\2 ",1,$i)
print (bb) >> path (aa) ".msg"
}
}
print ("\n" $0) >> path (aa) ".msg"
}
-------------------------End awk script---------------------------------------