]> Pileus Git - ~andy/fetchmail/blob - contrib/toprocmail
Remove comment that confuses splint.
[~andy/fetchmail] / contrib / toprocmail
1 #!/usr/bin/perl
2
3 # fetchmail -> procmail pretti-fier proxy thingamajig
4 # ver. 2000-04-01
5 #
6 # John Lim Eng Hooi <jleh@mail.com>
7 #
8
9 # Where's procmail located?
10 $proc_path = '/usr/bin/procmail';
11
12 # Define your ANSI color codes here, I've only bothered to define
13 # those I use :)
14 $ANSI_green = "\e[0;32m";
15 $ANSI_b_white = "\e[1;37m";
16 $ANSI_normal = "\e[0;39m";
17
18 # Open up procmail
19 open (PROCPIPE, "|$proc_path") || die "Can't open procmail pipe!";
20
21 # Analyze the message line by line
22 while (<STDIN>) {
23
24    # Suck up the lines we want, in this case I just want From: and Subject:
25    if (/^From:/) {
26      $from = $_;
27    }
28
29    if (/^Subject:/) {
30      $subj = $_;
31    }
32
33    # Stuff it out to the pipe too
34    print PROCPIPE;
35 }
36
37 # Print it out
38 print "\n";
39 print $ANSI_green, "  ", $from;
40 print $ANSI_b_white, "  ", $subj, $ANSI_normal;
41
42 # fetchmail's status is appended after this
43 print "  -->";
44
45 # We're done
46 close (PROCPIPE);