Debian Codegraph @

suser/xmlformat

raw
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use IPC::Open2;
6
7 local(*CIN, *COUT);
8
9 foreach my $file (@ARGV) {
10 my $pid = open2(\*CIN, undef, "xmllint", "--format", $file);
11 @_ = <CIN>;
12 waitpid($pid, 0);
13 my $status = $? >> 8;
14 if ($status != 0) {
15 die "xmllint exited with status $status\n";
16 }
17 if (!open(COUT, "> $file")) {
18 die "Could not open $file for writing: $!\n";
19 }
20 print COUT @_;
21 close COUT;
22 }