File: get_ver.awk

package info (click to toggle)
mrtg 2.17.10-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,332 kB
  • sloc: perl: 25,747; ansic: 4,568; sh: 1,518; php: 227; awk: 225; makefile: 196; csh: 49; exp: 16
file content (13 lines) | stat: -rw-r--r-- 446 bytes parent folder | download | duplicates (9)
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 "";
}