#!/usr/bin/perl
# `pages-jf' utility
# join files - this one joins files with ^L character for pages, and puts the filename at top

use strict;

my $sep = "\f\n"; # FF NL

use IO::File;

my @src = @ARGV;

while (my $src = shift @src) {
	chomp $src;

	my $srcfh = new IO::File($src)
		or die "cannot open $src";
	print $src, "\n\n";
	while (my $line = <$srcfh>) {
		unless (substr($line, length($line)-1) eq "\n") {
			# oh no, doesn't end in a newline
			print STDERR "Oh no, doesn't end in a newline! adding one\n";
			$line.="\n";
		}
		print $line;
	}
	print $sep;
}
