home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / sviluppo / sed-3.02 / testsuite / distrib.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-12-26  |  2KB  |  64 lines

  1. #! /bin/sh
  2. #
  3. #   This is stolen from C News
  4.  
  5.  
  6. #
  7. # All this does is massage the headers so they look like what news
  8. # software expects.  To:, Cc: and Resent-*: headers are masked.
  9. # Reply-To: is turned into references, which is questionable (could
  10. # just as well be dropped.
  11. #
  12. # The From: line is rewritten to use the "address (comments)" form
  13. # instead of "phrase <route>" form our mailer uses.  Also, addresses
  14. # with no "@domainname" are assumed to originate locally, and so are
  15. # given a domain.
  16. #
  17. # The Sender: field below reflects the address of the person who
  18. # maintains our mailing lists.  The Approved: field is in a special
  19. # form, so that we can do bidirectional gatewaying.  Any message
  20. # in a newsgroup that bears this stamp will not be fed into the
  21. # matching mailing list.
  22.  
  23. sed=${1-sed}
  24.  
  25. $sed -n -e "1{i\\
  26. Path: mailnewsgateway
  27.     }" \
  28.     -e ":a
  29.     /^[Rr]eceived:/b r
  30.     /^[Nn]ewsgroups:/b r
  31.     /^[Pp]ath:/b r
  32.     /^[Tt][Oo]:/s/^/Original-/
  33.     /^[Cc][Cc]:/s/^/Original-/
  34.     /^[Rr][Ee][Ss][Ee][Nn][Tt]-.*/s/^/Original-/
  35.     /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:/s/@/.alt.buddha.fat.short.guy@/
  36.     s/^[Ii]n-[Rr]eply-[Tt]o:/References:/
  37.     /^From:/{
  38.         s/<\([^@]*\)>\$/<\1@$thissite>/
  39.         s/^From:[     ][    ]*\(.*\)  *<\(.*\)>\$/From: \2 (\1)/
  40.         }
  41.     s/-[Ii]d:/-ID:/
  42.     s/^[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:[     ]*$/Subject: (none)/
  43.     s/^\([^:]*:\)[     ]*/\1 /
  44.     /^\$/{i\\
  45. Newsgroups: alt.buddha.short.fat.guy\\
  46. Distribution: world\\
  47. Sender: news@cygnus.com\\
  48. Approved: alt.buddha.short.fat.guy@cygnus.com
  49.     b e
  50.     }
  51.     p
  52.     n
  53.     b a
  54.     :r
  55.     s/.*//g
  56.     n
  57.     /^[     ]/b r
  58.     b a
  59.     :e
  60.     p
  61.     n
  62.     b e"
  63.