pci: don't do sanity check for missing pci bus, the check can misfire.
[minix.git] / commands / bzip2-1.0.3 / format.pl
blob8ab47acd3846324d51375f9d6b7131a265e6ef8d
1 #!/usr/bin/perl -w
2 use strict;
4 # get command line values:
5 if ( $#ARGV !=1 ) {
6 die "Usage: $0 xml_infile xml_outfile\n";
9 my $infile = shift;
10 # check infile exists
11 die "Can't find file \"$infile\""
12 unless -f $infile;
13 # check we can read infile
14 if (! -r $infile) {
15 die "Can't read input $infile\n";
17 # check we can open infile
18 open( INFILE,"<$infile" ) or
19 die "Can't input $infile $!";
21 #my $outfile = 'fmt-manual.xml';
22 my $outfile = shift;
23 #print "Infile: $infile, Outfile: $outfile\n";
24 # check we can write to outfile
25 open( OUTFILE,">$outfile" ) or
26 die "Can't output $outfile $! for writing";
28 my ($prev, $curr, $str);
29 $prev = ''; $curr = '';
30 while ( <INFILE> ) {
32 print OUTFILE $prev;
33 $prev = $curr;
34 $curr = $_;
35 $str = '';
37 if ( $prev =~ /<programlisting>$|<screen>$/ ) {
38 chomp $prev;
39 $curr = join( '', $prev, "<![CDATA[", $curr );
40 $prev = '';
41 next;
43 elsif ( $curr =~ /<\/programlisting>|<\/screen>/ ) {
44 chomp $prev;
45 $curr = join( '', $prev, "]]>", $curr );
46 $prev = '';
47 next;
50 print OUTFILE $curr;
51 close INFILE;
52 close OUTFILE;
53 exit;