]> git.pond.sub.org Git - empserver/blob - scripts/mapper/param.pl
Import of Empire 4.2.12
[empserver] / scripts / mapper / param.pl
1 #!/usr/local/bin/perl
2
3 open(FRAMES_FH, 'frames') || die 'Cannot open file "frames".';
4
5
6 # modify the INPUT stanza of a mpeg param file to reflect the actual input
7
8 $[ = 1;                 # set array base to 1
9 $, = ' ';               # set output field separator
10 $\ = "\n";              # set output record separator
11
12 line: while (<>) {
13     chop;       # strip record separator
14     @Fld = split(' ', $_, 9999);
15     if (/^INPUT$/ .. /^END_INPUT$/) {
16         next line;
17     }
18
19     print $_;
20 }
21
22 printf (("INPUT\n"));
23 $_ = &Getline2('FRAMES_FH');
24 $frames = $Fld[1];
25 for ($i = 0; $i <= $frames; $i++) {
26     $file = sprintf('map-%d.gif', $i);
27     $size = -s $file;
28     if ($size>300 && $size<10000) {
29         printf "%s\n", $file;
30     }
31 }
32 printf (("END_INPUT\n"));
33
34 sub Getline2 {
35     ($fh) = @_;
36     if ($getline_ok = (($_ = <$fh>) ne '')) {
37         chop;   # strip record separator
38         @Fld = split(' ', $_, 9999);
39     }
40     $_;
41 }