File: xmlformat

package info (click to toggle)
hxtools 20251011-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,468 kB
  • sloc: ansic: 4,384; perl: 3,467; sh: 1,664; cpp: 353; makefile: 90
file content (22 lines) | stat: -rwxr-xr-x 408 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl

use strict;
use warnings;
use IPC::Open2;

local(*CIN, *COUT);

foreach my $file (@ARGV) {
	my $pid = open2(\*CIN, undef, "xmllint", "--format", $file);
	@_ = <CIN>;
	waitpid($pid, 0);
	my $status = $? >> 8;
	if ($status != 0) {
		die "xmllint exited with status $status\n";
	}
	if (!open(COUT, "> $file")) {
		die "Could not open $file for writing: $!\n";
	}
	print COUT @_;
	close COUT;
}