target.pl 437 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/perl
  2. use File::Temp;
  3. my @o;
  4. for(reverse @ARGV) {
  5. my $i = 0;
  6. for my $a (split /:/) {
  7. if(length $a > 0) {
  8. @o = () if($i == 0 && $o[$i] && $o[$i] ne $a);
  9. $o[$i] = $a;
  10. }
  11. $i++;
  12. }
  13. }
  14. #print join(':', map { $_ eq "" ? "-" : $_ } @o);
  15. my $i = 0;
  16. my ($fh, $tempfile) = File::Temp::tempfile();
  17. binmode($fh, ":utf8");
  18. for(@o) {
  19. print $fh "export __THEOS_TARGET_ARG_$i := $_\n";
  20. ++$i;
  21. }
  22. close($fh);
  23. print $tempfile,$/;