]> the.earth.li Git - htag.git/blobdiff - htag.pl
Import Upstream version 0.0.23
[htag.git] / htag.pl
diff --git a/htag.pl b/htag.pl
index 235afef1d0f01f39bd16a4c5868b5325a0ab7c0f..5972d892524ee31e4cc1b2112a8cff202eb47ee2 100755 (executable)
--- a/htag.pl
+++ b/htag.pl
@@ -3,7 +3,7 @@
 use strict;
 
 # htag.pl - a tagline generator, sig manager and over engineered program.
-# Copyright (C) 1999-2001 Simon Huggins
+# Copyright (C) 1999-2003 Project Purple, Simon Huggins
 
 # Simon Huggins <huggie@earth.li>
 # http://www.earth.li/projectpurple/progs/htag.html
@@ -12,8 +12,7 @@ use strict;
  
 # 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.
+# Software Foundation; version 2 of the License only
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -35,9 +34,9 @@ if ($< == 0 or $> == 0 or $( == 0 or $) == 0) {
 # HtagPlugin lying around the system then uncomment the following with the
 # path to your local copy of HtagPlugin
 
-# use lib '/home/huggie/htag/';
+# use lib '/home/huggie/perl/huggietag/htag-0.0.23/HtagPlugin';
 
-use HtagPlugin         0.5;
+use HtagPlugin         0.6;
 use Getopt::Long;
 use POSIX qw/tcgetpgrp/;
 
@@ -57,25 +56,16 @@ my $cfgdebug=0;
 my $infinity = 80;
 
 ### Defines
-$override{'VERSION'} = $cfg{'VERSION'}    = "0.0.19";
+$override{'VERSION'} = $cfg{'VERSION'}    = "0.0.23";
 $override{'HOME'} = $cfg{'HOME'} = $ENV{"HOME"} || $ENV{"LOGDIR"}
        || (getpwuid($<))[7];
+$cfg{'nicedie'} = 1;
 
 # srand(time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
 
-#sub nicedie($) {
-#      my $msg = shift;
-#      warn $msg;
-#      if ($cfg{'nicedie'}) {
-#              warn "Press <RETURN> to continue\n";
-#              my $throwaway=<STDIN>;
-#      }
-#      die "\n";
-#}
-
 sub print_header {
        print STDERR "Htag.pl $cfg{'VERSION'} -  Simon Huggins <huggie\@earth.li>  Released under GPL\n";
-       print STDERR "Copyright (C) 1999-2001 Project Purple. http://www.earth.li/projectpurple/\n\n";
+       print STDERR "Copyright (C) 1999-2002 Project Purple. http://www.earth.li/projectpurple/\n\n";
 }
 
 sub process_options {
@@ -97,7 +87,7 @@ sub process_options {
                        "msgfile=s"     => \$cfg{'msgfile'},
                        "m=s"           => \$cfg{'msgfile'});
        if (not &GetOptions(%getopt)) {
-               print <<'EOF';
+               print STDERR <<'EOF';
 htag.pl - tagline and general sig adder.
  Usage:   htag.pl -t tagfile -c cfgfile -m msgfile
           htag.pl -h gives perldoc
@@ -349,11 +339,13 @@ sub choose_configfile() {
        my $file;
 
        if (defined $cfg{'changeheaders'}) {
-               open(HANDLE, $cfg{'msgfile'});
                my (@headers,$match,@l);
-               while (my $line = <HANDLE>) {
-                       last if ($line =~ /^$/); # end of headers
-                       push @headers, $line;
+               if (open(HANDLE, $cfg{'msgfile'})) {
+                       while (my $line = <HANDLE>) {
+                               last if ($line =~ /^$/); # end of headers
+                               push @headers, $line;
+                       }
+                       close(HANDLE);
                }
                foreach (@{$cfg{'changeheaders'}}) {
                        $file = pop;
@@ -391,7 +383,6 @@ sub choose_configfile() {
 
                        }
                }
-               close(HANDLE);
        }
 }