3 # fetch Apache version numbers from input file and writes them to STDOUT
5 while ((getline < ARGV[1]) > 0) {
6 if (match ($0, /^#define AP_SERVER_MAJORVERSION "[^"]+"/)) {
7 ver_major = substr($3, 2, length($3) - 2);
9 else if (match ($0, /^#define AP_SERVER_MINORVERSION "[^"]+"/)) {
10 ver_minor = substr($3, 2, length($3) - 2);
12 else if (match ($0, /^#define AP_SERVER_PATCHLEVEL/)) {
13 ver_str_patch = substr($3, 2, length($3) - 2);
14 if (match (ver_str_patch, /[0-9][0-9]*/)) {
15 ver_patch = substr(ver_str_patch, RSTART, RLENGTH);
19 ver = ver_major "," ver_minor "," ver_patch;
20 ver_str = ver_major "." ver_minor "." ver_str_patch;
22 print "VERSION = " ver "";
23 print "VERSION_STR = " ver_str "";