| 1 |
root |
1.1 |
#!/usr/bin/perl |
| 2 |
|
|
|
| 3 |
|
|
# basic |
| 4 |
|
|
|
| 5 |
|
|
$in = $ARGV[0]; |
| 6 |
|
|
$out = $ARGV[1]; |
| 7 |
|
|
sub die { |
| 8 |
|
|
$prog = $0; |
| 9 |
|
|
print STDERR $prog.": ".$_[0]."\n"; |
| 10 |
|
|
exit(1); |
| 11 |
|
|
} |
| 12 |
|
|
|
| 13 |
|
|
open(FOUT,">".$out) || &die("cannot open ".$out); |
| 14 |
|
|
|
| 15 |
|
|
|
| 16 |
|
|
sub include_file { |
| 17 |
|
|
$in = shift; |
| 18 |
|
|
local(*FIN); |
| 19 |
|
|
open(FIN,"<".$in) || &die("cannot open ".$in); |
| 20 |
|
|
while (<FIN>) { |
| 21 |
|
|
if (/^<!--#include file="(.*)"-->$/) { |
| 22 |
|
|
&include_file($1); |
| 23 |
|
|
} |
| 24 |
|
|
else { |
| 25 |
|
|
print FOUT $_; |
| 26 |
|
|
} |
| 27 |
|
|
} |
| 28 |
|
|
close(FIN); |
| 29 |
|
|
} |
| 30 |
|
|
|
| 31 |
|
|
&include_file($in); |
| 32 |
|
|
close(FOUT); |
| 33 |
|
|
|