dotfiles/mutt/.mutt/killsig
Frank Villaro-Dixon b9bac31d4a using stow nowe
2016-06-13 12:11:18 +02:00

22 lines
455 B
Perl
Executable file

#!/usr/bin/perl
#
# killsig: delete signature (also "oe-sigs") when quoting emails.
# known patterns: ">-- " , "> -- ", ">--", "> --".
#
# Michael Velten <michael@michnet.de>
open(MAIL, "+<$ARGV[0]") || die "$0: Can't open $ARGV[0]: $!";
while (<MAIL>) {
unless (/^>>? ?-- ?$/) {
push(@purged, $_);
}
else {
while (<MAIL>) {
push(@purged, $_) unless /^>.+/;
}
}
}
truncate(MAIL, 0);
seek(MAIL,0,0);
print MAIL @purged;
close(MAIL);