X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Fget_ver.awk;h=e8c4552b9828d61f2038746434d1d34b5fc550f1;hp=5abc22ba43e4c8659a0c4e56c9bcc91f3404cd0d;hb=f0a82ae15cafb6ad47ea0c9f74754820e92e2078;hpb=b2888c0b073f406517d5f77b5d869b160f08d8b7 diff --git a/src/get_ver.awk b/src/get_ver.awk index 5abc22b..e8c4552 100644 --- a/src/get_ver.awk +++ b/src/get_ver.awk @@ -1,19 +1,40 @@ -# fetch rrdtool version number from input file and write them to STDOUT -BEGIN { - while ((getline < ARGV[1]) > 0) { - if (match ($0, /^PACKAGE_VERSION=/)) { - split($1, t, "="); - my_ver_str = substr(t[2],2,length(t[2])-2); - split(my_ver_str, v, "."); - gsub("[^0-9].*$", "", v[3]); - my_ver = v[1] "," v[2] "," v[3]; - } - if (match ($0, /^NUMVERS=/)) { - split($1, t, "="); - my_num_ver = t[2]; - } - } - print "RRD_VERSION = " my_ver ""; - print "RRD_VERSION_STR = " my_ver_str ""; - print "RRD_NUMVERS = " my_num_ver ""; -} +# **************************************************************************** +# RRDtool 1.2.19 Copyright by Tobi Oetiker, 1997-2007 +# **************************************************************************** +# get_ver.awk AWK Script for non-configure builds +# **************************************************************************** +# $Id: get_ver.awk 1000 2007-14-02 05:51:34Z oetiker $ +# **************************************************************************** +BEGIN { + # fetch rrdtool version number from input file and write them to STDOUT + while ((getline < ARGV[1]) > 0) { + if (match ($0, /^AC_INIT/)) { + split($1, t, ","); + my_ver_str = substr(t[2],2,length(t[2])-3); + split(my_ver_str, v, "."); + gsub("[^0-9].*$", "", v[3]); + my_ver = v[1] "," v[2] "," v[3]; + } + if (match ($0, /^NUMVERS=/)) { + split($1, t, "="); + my_ver_num = t[2]; + } + } + # read from from input file, replace placeholders, and write to STDOUT + if (ARGV[2]) { + while ((getline < ARGV[2]) > 0) { + if (match ($0, /@@NUMVERS@@/)) { + gsub("@@NUMVERS@@", my_ver_num, $0); + } + if (match ($0, /@@PACKAGE_VERSION@@/)) { + gsub("@@PACKAGE_VERSION@@", "" my_ver_str "", $0); + } + print; + } + } else { + print "RRD_VERSION = " my_ver ""; + print "RRD_VERSION_STR = " my_ver_str ""; + print "RRD_NUMVERS = " my_ver_num ""; + } +} +