]> the.earth.li Git - htag.git/blobdiff - plugins/01checksigsep
Import Upstream version 0.0.23
[htag.git] / plugins / 01checksigsep
diff --git a/plugins/01checksigsep b/plugins/01checksigsep
new file mode 100644 (file)
index 0000000..fb70cff
--- /dev/null
@@ -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>) {
+       $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";
+       $_ = <STDIN>;
+       return 255      if /^q(?:uit)?$/i;
+       return 255      if /^(?:no?|\n)$/i;
+}
+