X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=plugins%2F01checksigsep;fp=plugins%2F01checksigsep;h=fb70cffb9789126f89e3e876b84b5adf2267192f;hb=5fea61b142fcdeaaca2f6640f17e16a0d4e7b5c9;hp=0000000000000000000000000000000000000000;hpb=f96cd91ac242f68bc9c7b14b5e4ef45af00cfe60;p=htag.git diff --git a/plugins/01checksigsep b/plugins/01checksigsep new file mode 100644 index 0000000..fb70cff --- /dev/null +++ b/plugins/01checksigsep @@ -0,0 +1,41 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2000-2003 Simon Huggins +# checksigsep checks for an existing sigsep and allows you to quit without +# adding a new sig. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., 59 +# Temple Place, Suite 330, Boston, MA 02111-1307 USA + +use strict; + +return if ($cfg{'msgfile'} eq "-"); + +my $msg=""; +open(MSG, "<$cfg{'msgfile'}") or return; +while() { + $msg .= $_; +} +close(MSG); +if (grep { /\n-- \n/ } $msg) { + my $oldmsg = $msg; + print STDERR "Looks like this message already has an unquoted sigsep:\n"; + $oldmsg =~ s/.*(-- $)/$1/ms; + print STDERR $oldmsg; + print STDERR "\n\nAdd another? ([N]o/(y)es)\n"; + $_ = ; + return 255 if /^q(?:uit)?$/i; + return 255 if /^(?:no?|\n)$/i; +} +