comparison libtomcrypt/filter.pl @ 398:59c7938af2bd

merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c' and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:30 +0000
parents 0cbe8f6dbf9e
children
comparison
equal deleted inserted replaced
396:e7c1a77d2921 398:59c7938af2bd
1 #!/usr/bin/perl
2
3 # we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun)
4
5 $dst = shift;
6 $ins = shift;
7
8 open(SRC,"<$dst");
9 open(INS,"<$ins");
10 open(TMP,">tmp.delme");
11
12 $l = 0;
13 while (<SRC>) {
14 if ($_ =~ /START_INS/) {
15 print TMP $_;
16 $l = 1;
17 while (<INS>) {
18 print TMP $_;
19 }
20 close INS;
21 } elsif ($_ =~ /END_INS/) {
22 print TMP $_;
23 $l = 0;
24 } elsif ($l == 0) {
25 print TMP $_;
26 }
27 }
28
29 close TMP;
30 close SRC;