File: prep.pl

package info (click to toggle)
kq 0.99.cvs20070319-1.1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,344 kB
  • ctags: 2,870
  • sloc: ansic: 26,328; sh: 3,737; makefile: 203; perl: 100
file content (30 lines) | stat: -rw-r--r-- 483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl

@kqin = ("../include/itemdefs.h","../include/progress.h");
@d_s = ();
@d_v = ();
$ni = 0;

foreach $a (@kqin)
{
  open (INFILE,$a) or die ("could not open include file");
  while (<INFILE>)
  {
    if (substr($_,0,7) eq "#define")
    {
      @b = split(" ",$_);
      @d_s[$ni] = $b[1];
      @d_v[$ni] = $b[2];
      $ni++;
    }
  }
}

while (<STDIN>)
{
  for $a (0..$ni-1)
  {
    $_ =~ s/\b$d_s[$a]\b/$d_v[$a]/g;
  }
  print $_;
}