8 our (@order, @order_final_maybe);
13 # we don't use Getopt::Long because we want to be quick to start up
14 # and we're not really a very user-facing utility
16 while (@ARGV && $ARGV[0] =~ m/^\-/) {
19 $flag{$_}{ForceResult} = 1;
20 $flag{$_}{Result} = undef;
21 push @order_final_maybe, $_;
23 $flag{$_}{ForceResult} = 1;
24 $flag{$_}{Result} = '';
25 push @order_final_maybe, $_;
30 } elsif (m/^-M(\d+)$/) {
35 die "$0: bad option\n";
39 @ARGV==3 or die "$0: bad usage\n";
41 foreach my $ix (qw(0 1 2)) {
42 open F, '<', $ARGV[$ix] or die "$ix $!";
45 ($propsmode && m/ /) or m/$/;
46 $flag{$`}{Input}[$ix] = $'; #';
47 push @order, $` unless $flag{$`}{InOrder}++;
53 foreach $_ (@order_final_maybe) {
54 push @order, $_ unless $flag{$_}{InOrder}++;
57 my $current = $ARGV[0];
59 open O, '>', "$current.tmp" or die "$current.tmp $!";
62 print O $_[0] x $marker, "\n" or die $!;
66 print O $v,"\n" or die $! if defined $v;
72 sub verb ($) { print STDERR "MERGE_LISTS $f @_\n" or die $!; }
82 if (defined $ff->{ForceResult}) {
85 my @in = @{ $ff->{Input} };
86 verb(defined ? "DEF $_": "U") foreach @in;
87 if (iseq($in[0], $in[2])) {
90 } elsif (iseq($in[0], $in[1])) {
92 $ff->{Result} = $in[2];
93 } elsif (iseq($in[2], $in[1])) {
95 $ff->{Result} = $in[0];
107 prval($ff->{Result});
111 rename "$current.tmp", "$current" or die "$current $!";
112 exit $conficts ? 1 :0;