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

# cat for fifos: open them all at the start so that other processes don't get blocked on open

$| = 1;

my $block_size = 64*1024;

my (@fd) = map { open my $fd, "<", $_; $fd } @ARGV;
my $i = 0;
for my $fd (@fd) {
	++$i;
	my $count;
	while ($count = sysread $fd, my $buf, $block_size) {
		print $buf;
	}
	defined $count
		or die "failed: read: $!";
}

