meyer@cambium.uoregon.edu (David M. Meyer) (12/18/90)
Does anyone have a script that they like for injecting news from a mailing list (e.g., an alias) into a local news group (i.e., that does the "right" thing with headers, subject lines, etc)? Thanks, Dave ------------------------------------------------------------------------------- David M. Meyer Voice: 503/346-4394 Network Systems Analyst Internet: meyer@oregon.uoregon.edu Office of University Computing Bitnet: meyer@oregon University of Oregon UUCP: ...!uoregon!meyer 1225 Kincaid FAX: 503/346-4397 Eugene, OR 97403 -- ------------------------------------------------------------------------------- David M. Meyer Voice: 503/346-4394 Network Systems Analyst Internet: meyer@oregon.uoregon.edu Office of University Computing Bitnet: meyer@oregon University of Oregon UUCP: ...!uoregon!meyer 1225 Kincaid FAX: 503/346-4397 Eugene, OR 97403
]) (12/20/90)
In article <MEYER.90Dec17124939@cambium.uoregon.edu> meyer@cambium.uoregon.edu (David M. Meyer) writes: > Does anyone have a script that they like for injecting > news from a mailing list (e.g., an alias) into a local > news group (i.e., that does the "right" thing with > headers, subject lines, etc)? > > Thanks, > Dave In its simplest form, all the program needs to do is strip the leading 'From ' header (without a colon) and feed it into inews -h... -- # Replace "newslist" with the phantom username that's on the mailing list # Replace "news.group" with the newsgroup name aliases: (for sendmail) newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -n news.group" aliases: (for smail) newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -f\"$SENDER\" -n news.group" -- I tend to lean a little harder on it by stripping out a few other headers, and thus use awk instead of sed. If the awk script is in /usr/lib/news... -- # Replace "newslist" with the phantom username that's on the mailing list # Replace "news.group" with the newsgroup name aliases: (for sendmail) newslist:"|/bin/awk -f /usr/lib/news/mail2news.awk | /usr/lib/news/inews -h -n news.group" aliases: (for smail) newslist:"|/bin/awk -f /usr/lib/news/mail2news.awk | /usr/lib/news/inews -h -f\"$SENDER\" -n news.group" -- -- cut into mail2news.awk -- # %W% %G% %U% # # mail2news.awk -- a utility to handle the headers in a mailfile for # posting as news # BEGIN { mysite = "your_uucp_node_name_here" # Tailor this line!! nuke[1] = "[Tt][Oo]:" nuke[2] = "[Cc][Cc]:" nuke[3] = "[Bb][Cc][Cc]:" nuke[4] = "[Rr][Ee][Cc][Ee][Ii][Vv][Ee][Dd]" nuke[5] = "[Ss][Tt][Aa][Tt][Uu][Ss]:" nuke[6] = ".*[Mm][Aa][Ii][Ll][Ee][Rr]" nuke[7] = "[Dd][Aa][Tt][Ee]:" nukes = 7 cont_nuke = 0 inheader = 1 # Until we get a null line } # # Once we're out of the header, just print the lines # inheader == 0 { print next } # # End of header? # $0 == "" { inheader = 0 print next } # # Delete mail's leading 'From ' header # NR == 1 && match($0, "[Ff][Rr][Oo][Mm] ") == 1 { print "Path:", mysite "!nobody" next } # # Continuation of a nuked header? # cont_nuke == 1 { first = substr($0, 1, 1) if ( first == " " || first == "\t" ) { next # Skip it -- it's a continuation } cont_nuke = 0 # Otherwise, turn off cont_nuke flag } # # Lines to cut? # { for ( i = 1; i <= nukes; i++ ) { if ( match($1, nuke[i]) == 1 ) { cont_nuke = 1 # Set cont_nuke flag for next line next # Don't print this one } } print } -- cut into mail2news.awk -- ...Kris -- Kristopher Stephens, | (408-746-6047) | krs@uts.amdahl.com | KC6DFS Amdahl Corporation | | | [The opinions expressed above are mine, solely, and do not ] [necessarily reflect the opinions or policies of Amdahl Corp. ]
nrd@redwood22.cray.com (Neal Dalton) (12/20/90)
In article <d4a=02WLf9wm01@amdahl.uts.amdahl.com>, krs@uts.amdahl.com (Kris Stephens [Hail Eris!]) writes: |> > Does anyone have a script that they like for injecting |> > news from a mailing list (e.g., an alias) into a local |> > news group (i.e., that does the "right" thing with |> > headers, subject lines, etc)? |> > |> > Thanks, |> > Dave |> |> In its simplest form, all the program needs to do is strip the leading |> 'From ' header (without a colon) and feed it into inews -h... |> |> -- |> # Replace "newslist" with the phantom username that's on the mailing list |> # Replace "news.group" with the newsgroup name |> aliases: (for sendmail) |> newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -n news.group" |> aliases: (for smail) |> newslist:"|/bin/sed 1d | /usr/lib/news/inews -h -f\"$SENDER\" -n news.group" |> -- This wouldn't work on my site, because we have (the "brain-dead" :) inews that came with the NNTP release (I guess). It doesn't know any of the normal inews flags. So I got recnews from the B-news stuff and hack it until it worked. What I did in end I found out, for some reason our site needs the PATH: field. So I regerated the mail for News with recnews and piped it into inews. What may work is a awk/sed script that added the Newsgroup field and the Path: `whoami` to the mail headers piped into inews -h. If you have problems with the previous post make sure which inews you have and if you need Path:. Good luck and keep us informed of problem/solutions. ---- Neal /\ / _ / \|||/ Neal Dalton / \ / _ _\ / / \ Cray Research, inc / \/_</_(_/\_/ ( o o ) _________ 655-F Lone Oak Dr. \ ^ / / \ Eagan, MN 55121 \ 0 / < OH NO, ) Internet: nrd@cray.com \_/ \ not him!/ Fax: (612) 683-5599 uucp: uunet!cray!nrd \_______/ Phone: (612) 683-5607
news@spectrum.CMC.COM (12/20/90)
In article <MEYER.90Dec17124939@cambium.uoregon.edu> meyer@cambium.uoregon.edu (David M. Meyer) writes: > Does anyone have a script that they like for injecting > news from a mailing list (e.g., an alias) into a local > news group (i.e., that does the "right" thing with > headers, subject lines, etc)? In /usr/lib/aliases, I have a line like this to make a two-way gateway to a local newsgroup: ietf-hosts: "|grep -v '^From '|/usr/news/bin/inject/inews -h -n ietf.hosts -a Automatically" Reflector: (defined in /usr/news/lib/mailpaths) "ietf.hosts ietf-hosts@nnsc.nsf.net" Local incoming alias, see above. The grep command removed the unix-header line, which is not RFC-822. Works really well.
cluther@supernet.haus.com (Clay Luther) (12/20/90)
nrd@redwood22.cray.com (Neal Dalton) writes: >In article <d4a=02WLf9wm01@amdahl.uts.amdahl.com>, krs@uts.amdahl.com (Kris Stephens [Hail Eris!]) writes: >|> > Does anyone have a script that they like for injecting >|> > news from a mailing list (e.g., an alias) into a local >|> > news group (i.e., that does the "right" thing with >|> > headers, subject lines, etc)? >Good luck and keep us informed of problem/solutions. I have posted our scripts that do this very thing to alt.sources. Package is called Gate. -- Clay Luther, Postmaster cluther@supernet.haus.com Harris Adacom Corporation cluther@enigma.haus.com Voice: 214/386-2356 MS 23, PO Box 809022, Dallas, Tx 75380-9022 Fax: 214/386-2159 Your mileage may vary. Void where prohibited.
]) (12/20/90)
In article <1990Dec19.230106.13613@spectrum.CMC.COM> news@spectrum.CMC.COM writes: >In /usr/lib/aliases, I have a line like this to make a two-way gateway to >a local newsgroup: > >ietf-hosts: "|grep -v '^From '|/usr/news/bin/inject/inews -h -n ietf.hosts -a Automatically" Watch out on this. It assumes that the inbound mail has no non-header lines starting with 'From ', which is not guaranteed. 'sed 1d' is the better approach since the first line will be the 'From ' in question. For true assuredness, awk ' $1 == "From" && NR == 1 { next } { print }' remembering, of course, to escape the $ and " characters inside the awk program for use in the aliases file. As an aside, I believe it's the rmail/smail/sendmail program with the task of appending a /usr/mail/$user file which inserts a > in front of '^From ' when it appears other than as line 1 of the header. That's certainly the case with smail, configured in the directors file by setting 'unix_from_hack'. Were it the sending-mail-engine's responsibility, it would wreck data mailed into programs, where the inserted character would alter the inbound data stream. (That last is, I admit, conjecture.) ..Kris -- Kristopher Stephens, | (408-746-6047) | krs@uts.amdahl.com | KC6DFS Amdahl Corporation | | | [The opinions expressed above are mine, solely, and do not ] [necessarily reflect the opinions or policies of Amdahl Corp. ]
gary@proa.sv.dg.com (Gary Bridgewater) (12/21/90)
In article <1990Dec19.230106.13613@spectrum.CMC.COM> news@spectrum.CMC.COM writes: >In /usr/lib/aliases, I have a line like this to make a two-way gateway to >a local newsgroup: >ietf-hosts: "|grep -v '^From '|/usr/news/bin/inject/inews -h -n ietf.hosts -a Automatically" From time to time, do you notice articles with missing lines? From that do you draw any conclusions? From now on, you might consider the version posted by another user. From the heart - no flame intended. -- Gary Bridgewater, Data General Corporation, Sunnyvale California gary@sv.dg.com or {amdahl,aeras,amdcad}!dgcad!gary C++ - it's the right thing to do.
rsalz@bbn.com (Rich Salz) (12/22/90)
In <1990Dec19.230106.13613@spectrum.CMC.COM> news@spectrum.CMC.COM writes: >In /usr/lib/aliases, I have a line like this to make a two-way gateway to >a local newsgroup: > >ietf-hosts: "|grep -v '^From '|/usr/news/bin/inject/inews -h -n ietf.hosts -a Automatically" From my point of view, that is not a very good way to do things! This message shows why. -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.