summaryrefslogtreecommitdiffstats
path: root/src/sed/testsuite/distrib.sh
blob: dbadbdcf7bf47275b04669df5a07e239a6043dc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/sh
#
#   This is stolen from C News
# 


#
# All this does is massage the headers so they look like what news
# software expects.  To:, Cc: and Resent-*: headers are masked.
# Reply-To: is turned into references, which is questionable (could
# just as well be dropped.
#
# The From: line is rewritten to use the "address (comments)" form
# instead of "phrase <route>" form our mailer uses.  Also, addresses
# with no "@domainname" are assumed to originate locally, and so are
# given a domain.
#
# The Sender: field below reflects the address of the person who
# maintains our mailing lists.  The Approved: field is in a special
# form, so that we can do bidirectional gatewaying.  Any message
# in a newsgroup that bears this stamp will not be fed into the
# matching mailing list.

sed=${1-sed}

$sed -n -e "1{i\\
Path: mailnewsgateway
	}" \
    -e ":a
	/^[Rr]eceived:/b r
	/^[Nn]ewsgroups:/b r
	/^[Pp]ath:/b r
	/^[Tt][Oo]:/s/^/Original-/
	/^[Cc][Cc]:/s/^/Original-/
	/^[Rr][Ee][Ss][Ee][Nn][Tt]-.*/s/^/Original-/
	/^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/s/@/.alt.buddha.fat.short.guy@/
	s/^[Ii]n-[Rr]eply-[Tt]o:/References:/
	/^From:/{
		s/<\([^@]*\)>\$/<\1@$thissite>/
		s/^From:[ 	][	]*\(.*\)  *<\(.*\)>\$/From: \2 (\1)/
		}
	s/-[Ii]d:/-ID:/
	s/^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[ 	]*$/Subject: (none)/
	s/^\([^:]*:\)[	 ]*/\1 /
	/^\$/{i\\
Newsgroups: alt.buddha.short.fat.guy\\
Distribution: world\\
Sender: news@cygnus.com\\
Approved: alt.buddha.short.fat.guy@cygnus.com
	b e
	}
	p
	n
	b a
	:r
	s/.*//g
	n
	/^[ 	]/b r
	b a
	:e
	p
	n
	b e"