cvs commit: perlfaq/bin postfaq splitfaq

[email protected] (brian d foy) 30 Dec 2005 22:29:01 -0000
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     05/12/30 14:29:00

  Modified:    .        Makefile
               bin      postfaq splitfaq
  Log:
  * Fixed splitfaq to include a "quiet" option suitable for non-interactive
  runs
  
  * Added a "splitquiet" target to makefile. It doesn't output anything
  and sets the right switches and doodads to suppress output. It's otherwise
  the same as "split"
  
  Revision  Changes    Path
  1.4       +13 -3     perlfaq/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /cvs/public/perlfaq/Makefile,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile	10 Aug 2005 16:18:00 -0000	1.3
  +++ Makefile	30 Dec 2005 22:29:00 -0000	1.4
  @@ -1,9 +1,11 @@
   # $Id$
   PERL=perl
  +CVS=cvs
   
   CHECK_URLS=bin/check_urls.pl
   TOC_PL=bin/perlfaq_toc.pl
   
  +SPLIT_DIR=faqs
   FILES=perlfaq1.pod perlfaq2.pod perlfaq3.pod perlfaq4.pod perlfaq5.pod \
   	perlfaq6.pod perlfaq7.pod perlfaq8.pod perlfaq9.pod
   TOC=perlfaq.toc
  @@ -20,7 +22,7 @@
   echo:
   	@ echo $(FILES)
   
  -perlfaq.pod: $(FILES)
  +perlfaq.pod:
   	${PERL} ${TOC_PL} > perlfaq.pod
   
   checkurls: 
  @@ -28,8 +30,16 @@
   	@ touch $@
   
   split:
  -	${PERL} bin/splitfaqs ${SPLIT_DIR} ${FILES}
  +	${CVS} update -d
  +	${PERL} bin/splitfaq ${SPLIT_DIR} ${FILES}
  +	rm -f ${SPLIT_DIR}/perlfaq.00.00.txt
   	touch ${SPLIT_DIR}/*
   	
  +splitquiet:
  +	@ ${CVS} update -d
  +	@ ${PERL} bin/splitfaq -q ${SPLIT_DIR} ${FILES}
  +	@ rm -f ${SPLIT_DIR}/perlfaq.00.00.txt
  +	@ touch ${SPLIT_DIR}/*  
  +
   test:
   	${PERL} t/pod.t
  
  
  
  1.7       +1 -1      perlfaq/bin/postfaq
  
  Index: postfaq
  ===================================================================
  RCS file: /cvs/public/perlfaq/bin/postfaq,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- postfaq	7 Jan 2005 05:07:30 -0000	1.6
  +++ postfaq	30 Dec 2005 22:29:00 -0000	1.7
  @@ -124,7 +124,7 @@
   
   my @header                   = get_header( $config, $subject );
   
  -print "@header", "\n", $message;
  +#print "@header", "\n", $message;
   
   $nntp->post( @header, "\n", split /$/m, $message );
   
  
  
  
  1.4       +12 -5     perlfaq/bin/splitfaq
  
  Index: splitfaq
  ===================================================================
  RCS file: /cvs/public/perlfaq/bin/splitfaq,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- splitfaq	27 Mar 2005 08:21:50 -0000	1.3
  +++ splitfaq	30 Dec 2005 22:29:00 -0000	1.4
  @@ -1,8 +1,13 @@
   #!/usr/bin/perl
  -
  +# $Id$
   use strict;
   use warnings;
   
  +use Getopt::Std;
  +
  +my %Opt = ();
  +getopts('q', \%Opt);
  +
   unless( defined $ARGV[0] )
   	{
   	die "Please specify the destination directory\n";
  @@ -19,10 +24,11 @@
   my ($major, $minor, $revision, $subject);
   
   while (<>) {
  -
  -	my $old_major = $major;
  +	my $old_major = $major || 0;
   	($major) = $ARGV =~ /^perlfaq(\d)/g;
   	
  +	next unless defined $major;
  +
   	unless( $old_major == $major )
   		{
   		printfaq( $old_major, $minor );
  @@ -60,11 +66,12 @@
   
   sub printfaq {
   	my( $major, $minor ) = @_;
  +	return unless( defined $major and defined $minor );
   	
       my $faqname = sprintf("perlfaq.%02d.%02d.txt", $major, $minor);
  -    print STDERR "$faqname\n";
  +    print STDERR "$faqname\n" unless $Opt{q};
       open (F, "| pod2text > $dir/$faqname")
  -	or die "$0: can't open output";
  +		or die "$0: can't open output";
       print F $faq;
       close F;
   }