Blame src/pod2c.pl

Packit cb6d3d
#!/usr/bin/perl
Packit cb6d3d
# $Id: pod2c.pl,v 1.4 2008/06/19 15:44:31 flameeyes Exp $
Packit cb6d3d
# Utility to turn pieces of pod text to help text.
Packit cb6d3d
use File::Basename;
Packit cb6d3d
Packit cb6d3d
die "Expecting exactly one argument, a filename" if @ARGV != 1;
Packit cb6d3d
$filename = shift;
Packit cb6d3d
Packit cb6d3d
($name, $path, $suffix)=fileparse($filename,"\.txt");
Packit cb6d3d
close(STDIN);
Packit cb6d3d
open(STDIN, "<$filename") 
Packit cb6d3d
  || die "Can't open $filename for reading:\n$!";
Packit cb6d3d
Packit cb6d3d
#$outfile="../${filename}.h";
Packit cb6d3d
#open(STDOUT, ">$outfile")
Packit cb6d3d
#  || die "Can't open $outfile for writing:\n$!";
Packit cb6d3d
Packit cb6d3d
print "/*
Packit cb6d3d
  Copyright (C) 1999, 2005, 2007, 2008 Rocky Bernstein
Packit cb6d3d
   
Packit cb6d3d
  This program is free software: you can redistribute it and/or modify
Packit cb6d3d
  it under the terms of the GNU General Public License as published by
Packit cb6d3d
  the Free Software Foundation, either version 3 of the License, or
Packit cb6d3d
  (at your option) any later version.
Packit cb6d3d
Packit cb6d3d
  This program is distributed in the hope that it will be useful,
Packit cb6d3d
  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit cb6d3d
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit cb6d3d
  GNU General Public License for more details.
Packit cb6d3d
Packit cb6d3d
  You should have received a copy of the GNU General Public License
Packit cb6d3d
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit cb6d3d
*/
Packit cb6d3d
static const char ${name}_help[] =\n";
Packit cb6d3d
while(<STDIN>) {
Packit cb6d3d
  s/["]/\\"/g; 
Packit cb6d3d
  # Change POD'ed items to quoted items, e.g. See L<y> and L<z> becomes
Packit cb6d3d
  # See "y" and "z" (with \'s around the quotes)
Packit cb6d3d
  s/[C,L,I,B,F]<(.+?)>/\\"$1\\"/g; 
Packit cb6d3d
  chomp;
Packit cb6d3d
  if ( $^O eq "cygwin" ) {
Packit cb6d3d
     s/\
Packit cb6d3d
//
Packit cb6d3d
  }
Packit cb6d3d
  print "\"$_\\n\"\n";
Packit cb6d3d
}
Packit cb6d3d
print ";\n";