dropbear/libtommath/filter.pl

35 lines
643 B
Perl
Raw Normal View History

2017-06-24 14:37:14 +00:00
#!/usr/bin/perl
# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
2018-02-08 15:11:40 +00:00
use strict;
use warnings;
2017-06-24 14:37:14 +00:00
2018-02-08 15:11:40 +00:00
open(my $src, '<', shift);
open(my $ins, '<', shift);
open(my $tmp, '>', 'tmp.delme');
2017-06-24 14:37:14 +00:00
2018-02-08 15:11:40 +00:00
my $l = 0;
while (<$src>) {
2017-06-24 14:37:14 +00:00
if ($_ =~ /START_INS/) {
2018-02-08 15:11:40 +00:00
print {$tmp} $_;
2017-06-24 14:37:14 +00:00
$l = 1;
2018-02-08 15:11:40 +00:00
while (<$ins>) {
print {$tmp} $_;
2017-06-24 14:37:14 +00:00
}
2018-02-08 15:11:40 +00:00
close $ins;
2017-06-24 14:37:14 +00:00
} elsif ($_ =~ /END_INS/) {
2018-02-08 15:11:40 +00:00
print {$tmp} $_;
2017-06-24 14:37:14 +00:00
$l = 0;
} elsif ($l == 0) {
2018-02-08 15:11:40 +00:00
print {$tmp} $_;
2017-06-24 14:37:14 +00:00
}
}
2018-02-08 15:11:40 +00:00
close $tmp;
close $src;
2017-06-24 14:37:14 +00:00
2018-02-08 15:11:40 +00:00
# ref: $Format:%D$
# git commit: $Format:%H$
# commit time: $Format:%ai$