Code Search for Developers
 
 
  

format.pl from MaNGOS at Krugle


Show format.pl syntax highlighted

#!/usr/bin/perl -w
use strict;

# get command line values:
if ( $#ARGV !=1 ) {
    die "Usage:  $0 xml_infile xml_outfile\n";
}

my $infile = shift;
# check infile exists
die "Can't find file \"$infile\""
  unless -f $infile;
# check we can read infile
if (! -r $infile) {
    die "Can't read input $infile\n";
}
# check we can open infile
open( INFILE,"<$infile" ) or 
    die "Can't input $infile $!";

#my $outfile = 'fmt-manual.xml';
my $outfile = shift;
#print "Infile: $infile, Outfile: $outfile\n";
# check we can write to outfile
open( OUTFILE,">$outfile" ) or 
    die "Can't output $outfile $! for writing";

my ($prev, $curr, $str);
$prev = ''; $curr = '';
while ( <INFILE> ) {

		print OUTFILE $prev;
    $prev = $curr;
    $curr = $_;
    $str = '';

    if ( $prev =~ /<programlisting>$|<screen>$/ ) {
        chomp $prev;
        $curr = join( '', $prev, "<![CDATA[", $curr );
				$prev = '';
        next;
    }
    elsif ( $curr =~ /<\/programlisting>|<\/screen>/ ) {
        chomp $prev;
        $curr = join( '', $prev, "]]>", $curr );
				$prev = '';
        next;
    }
}
print OUTFILE $curr;
close INFILE;
close OUTFILE;
exit;




See more files for this project here

MaNGOS

MaNGOS is an object-oriented Massively Multiplayer Online Role-Playing Game Server (MMORPGS). It\'s an educational project, to help developers get familar with large scale C++ and C# development projects.

Project homepage: http://sourceforge.net/projects/mangos
Programming language(s): C,C++,SQL
License: gpl2

  CHANGES
  LICENSE
  Makefile
  Makefile-libbz2_so
  README
  README.COMPILATION.PROBLEMS
  README.XML.STUFF
  Y2K_INFO
  blocksort.c
  bz-common.xsl
  bz-fo.xsl
  bz-html.xsl
  bzdiff
  bzdiff.1
  bzgrep
  bzgrep.1
  bzip.css
  bzip2.1
  bzip2.1.preformatted
  bzip2.c
  bzip2.txt
  bzip2recover.c
  bzlib.c
  bzlib.h
  bzlib_private.h
  bzmore
  bzmore.1
  compress.c
  crctable.c
  decompress.c
  dlltest.c
  dlltest.dsp
  entities.xml
  format.pl
  huffman.c
  libbz2.def
  libbz2.dsp
  makefile.msc
  manual.html
  manual.pdf
  manual.ps
  manual.xml
  mk251.c
  randtable.c
  sample1.bz2
  sample1.ref
  sample2.bz2
  sample2.ref
  sample3.bz2
  sample3.ref
  spewG.c
  unzcrash.c
  words0
  words1
  words2
  words3
  xmlproc.sh