]> granicus.if.org Git - apache/blob - build/nw_ver.awk
868dd1520b08ffdba4a56deb574b49ae9e5780dd
[apache] / build / nw_ver.awk
1 BEGIN {
2
3   # fetch Apache version numbers from input file and writes them to STDOUT
4
5   while ((getline < ARGV[1]) > 0) {
6     if (match ($0, /^#define AP_SERVER_MAJORVERSION "[^"]+"/)) {
7       ver_major = substr($3, 2, length($3) - 2);
8     }
9     else if (match ($0, /^#define AP_SERVER_MINORVERSION "[^"]+"/)) {
10       ver_minor = substr($3, 2, length($3) - 2);
11     }
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); 
16       }
17     }
18   }
19   ver = ver_major "," ver_minor "," ver_patch;
20   ver_str = ver_major "." ver_minor "." ver_str_patch;
21
22   print "VERSION = " ver "";
23   print "VERSION_STR = " ver_str "";
24
25 }