| 1 | #!/bin/sh |
| 2 | # |
| 3 | # nn_elm |
| 4 | # |
| 5 | # 07 Aug 91 V1.0 |
| 6 | # |
| 7 | # Massage a mail message from nn into a form that elm can use |
| 8 | # (c) 1991 Phil Kernick Wizard Software |
| 9 | # |
| 10 | # |
| 11 | # Add the following to ~/.nn/init: |
| 12 | # |
| 13 | # set mailer nn_elm |
| 14 | # unset mailer-pipe-input |
| 15 | # |
| 16 | # Here is nn_elm: |
| 17 | |
| 18 | eval `awk ' |
| 19 | BEGIN { |
| 20 | FS = ":"; |
| 21 | dq = sprintf("%c", 34); |
| 22 | |
| 23 | headers = 0; |
| 24 | to = ""; |
| 25 | subject = ""; |
| 26 | } |
| 27 | |
| 28 | /^.*: / { |
| 29 | headers++; |
| 30 | if($1 == "To") |
| 31 | to = dq substr($0, 5) dq; |
| 32 | if($1 == "Subject") |
| 33 | subject = dq substr($0, 10) dq; |
| 34 | } |
| 35 | |
| 36 | /^$/ { |
| 37 | printf("tail +%d %s | elm -s %s %s > /dev/null\n", headers+2, mail, subject, to); |
| 38 | exit; |
| 39 | }' mail=$1 $1` |
| 40 | |
| 41 | exit $? |