File: get_ver.awk

package info (click to toggle)
mrtg 2.16.2-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 5,508 kB
  • ctags: 1,238
  • sloc: perl: 25,056; ansic: 4,560; sh: 1,391; makefile: 244; php: 227; awk: 225; csh: 49; exp: 16
file content (13 lines) | stat: -rw-r--r-- 446 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
# fetch rateup version number from input file and write them to STDOUT
BEGIN {
  while ((getline < ARGV[1]) > 0) {
    if (match ($0, /VERSION = "[^"]+"/)) {
      rateup_ver_str = substr($4, 2, length($4) - 3);
      split(rateup_ver_str, v, ".");
      gsub("[^0-9].*$", "", v[3]);
      rateup_ver = v[1] "," v[2] "," v[3];
    }
  }
  print "RATEUP_VERSION = " rateup_ver "";
  print "RATEUP_VERSION_STR = " rateup_ver_str "";
}