8 our (@order, @order_final_maybe);
11 # we don't use Getopt::Long because we want to be quick to start up
12 # and we're not really a very user-facing utility
14 while (@ARGV && $ARGV[0] =~ m/^\-/) {
17 $flag{$_}{Result} = 0;
18 push @order_final_maybe, $_;
20 $flag{$_}{Result} = 1;
21 push @order_final_maybe, $_;
27 die "$0: bad option\n";
31 @ARGV==3 or die "$0: bad usage\n";
33 foreach my $ix (qw(0 1 2)) {
34 open F, '<', $ARGV[$ix] or die "$ix $!";
37 $flag{$_}{Input}[$ix] = 1;
39 push @order, $_ unless $ff->{InOrder}++;
45 foreach $_ (@order_final_maybe) {
46 push @order, $_ unless $flag{$_}{InOrder}++;
49 my $current = $ARGV[0];
51 open O, '>', "$current.tmp" or die "$current.tmp $!";
55 if (!defined $ff->{Result}) {
57 foreach my $ix (qw(0 1 2)) {
58 $ff->{Input}[$ix] ||= 0;
59 $s .= $ff->{Input}[$ix];
62 print STDERR "MERGE-LISTS $s $_\n" or die $!;
70 print O "$_\n" or die $!;
75 rename "$current.tmp", "$current" or die "$current $!";