Add option '-V': print version and copyright information.
[usenet/yapfaq.git] / yapfaq.pl
index 5b7160a..084c77e 100644 (file)
--- a/yapfaq.pl
+++ b/yapfaq.pl
@@ -59,9 +59,14 @@ use Getopt::Std;
 my ($TDY, $TDM, $TDD) = Today(); #TD: Today's date
 
 my %Options;
-getopts('hvpdt:f:', \%Options);
+getopts('Vhvpdt:f:', \%Options);
+if ($Options{'V'}) {
+  print "$0 v $Version\nCopyright (c) 2003 Marc Brockschmidt <marc\@marcbrockschmidt.de>\nCopyright (c) 2010 Thomas Hochstein <thh\@inter.net>\n";
+  print "This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.\n";
+  exit(0);
+}
 if ($Options{'h'}) {
-  print "$0 v $Version\nUsage: $0 [-hvpd] [-t <newsgroups>] [-f <faq>]\n";
+  exec ('perldoc', $0);
   exit(0);
 };
 my ($Faq) = $Options{'f'} if ($Options{'f'});
@@ -305,7 +310,7 @@ sub post {
   my $NewsConnection = Net::NNTP->new($NNTPServer, Reader => 1)
     or die "$0: E: Can't connect to news server '$NNTPServer'!\n";
 
-  $NewsConnection->authinfo ($NNTPUser, $NNTPPass);
+  $NewsConnection->authinfo ($NNTPUser, $NNTPPass) if (defined($NNTPUser));
   $NewsConnection->post();
   $NewsConnection->datasend (@$ArticleR);
   $NewsConnection->dataend();
@@ -695,9 +700,13 @@ was posted and the second being the message ID of that incarnation.
 
 =over 3
 
+=item B<-V> (version)
+
+Print out version and copyright information on B<yapfaq> and exit.
+
 =item B<-h> (help)
 
-Print out version and usage information on B<yapfaq> and exit.
+Print this man page and exit.
 
 =item B<-v> (verbose)
 
This page took 0.011133 seconds and 4 git commands to generate.