11cb0ef41Sopenharmony_ci# *************************************************************************** 21cb0ef41Sopenharmony_ci# * Project: c-ares 31cb0ef41Sopenharmony_ci# * 41cb0ef41Sopenharmony_ci# * Copyright (C) The c-ares project and its contributors 51cb0ef41Sopenharmony_ci# * SPDX-License-Identifier: MIT 61cb0ef41Sopenharmony_ci# *************************************************************************** 71cb0ef41Sopenharmony_ci# awk script which fetches c-ares version number and string from input 81cb0ef41Sopenharmony_ci# file and writes them to STDOUT. Here you can get an awk version for Win32: 91cb0ef41Sopenharmony_ci# http://www.gknw.net/development/prgtools/awk-20100523.zip 101cb0ef41Sopenharmony_ci# 111cb0ef41Sopenharmony_ciBEGIN { 121cb0ef41Sopenharmony_ci while ((getline < ARGV[1]) > 0) { 131cb0ef41Sopenharmony_ci sub("\r", "") # make MSYS gawk work with CRLF header input. 141cb0ef41Sopenharmony_ci if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) 151cb0ef41Sopenharmony_ci copyright_string = substr($0, 25, length($0)-25) 161cb0ef41Sopenharmony_ci else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) 171cb0ef41Sopenharmony_ci version_string = substr($3, 2, length($3)-2) 181cb0ef41Sopenharmony_ci else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) 191cb0ef41Sopenharmony_ci version_major = $3 201cb0ef41Sopenharmony_ci else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) 211cb0ef41Sopenharmony_ci version_minor = $3 221cb0ef41Sopenharmony_ci else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) 231cb0ef41Sopenharmony_ci version_patch = $3 241cb0ef41Sopenharmony_ci } 251cb0ef41Sopenharmony_ci print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch 261cb0ef41Sopenharmony_ci print "LIBCARES_VERSION_STR = " version_string 271cb0ef41Sopenharmony_ci print "LIBCARES_COPYRIGHT_STR = " copyright_string 281cb0ef41Sopenharmony_ci} 291cb0ef41Sopenharmony_ci 30