1# ***************************************************************************
2# *  Project: c-ares
3# *
4# * Copyright (C) The c-ares project and its contributors
5# * SPDX-License-Identifier: MIT
6# ***************************************************************************
7# awk script which fetches c-ares version number and string from input
8# file and writes them to STDOUT. Here you can get an awk version for Win32:
9# http://www.gknw.net/development/prgtools/awk-20100523.zip
10#
11BEGIN {
12  while ((getline < ARGV[1]) > 0) {
13    sub("\r", "") # make MSYS gawk work with CRLF header input.
14    if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/))
15      copyright_string = substr($0, 25, length($0)-25)
16    else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/))
17      version_string = substr($3, 2, length($3)-2)
18    else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/))
19      version_major = $3
20    else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/))
21      version_minor = $3
22    else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/))
23      version_patch = $3
24  }
25  print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch
26  print "LIBCARES_VERSION_STR = " version_string
27  print "LIBCARES_COPYRIGHT_STR = " copyright_string
28}
29
30