1# *************************************************************************** 2# * _ _ ____ _ 3# * Project ___| | | | _ \| | 4# * / __| | | | |_) | | 5# * | (__| |_| | _ <| |___ 6# * \___|\___/|_| \_\_____| 7# * 8# * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. 9# * 10# * This software is licensed as described in the file COPYING, which 11# * you should have received as part of this distribution. The terms 12# * are also available at http://curl.haxx.se/docs/copyright.html. 13# * 14# * You may opt to use, copy, modify, merge, publish, distribute and/or sell 15# * copies of the Software, and permit persons to whom the Software is 16# * furnished to do so, under the terms of the COPYING file. 17# * 18# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19# * KIND, either express or implied. 20# * 21# *************************************************************************** 22# awk script which fetches curl / ares version number and string from input 23# file and writes them to STDOUT. Here you can get an awk version for Win32: 24# http://www.gknw.net/development/prgtools/awk-20070501.zip 25# 26BEGIN { 27 if (match (ARGV[1], /curlver.h/)) { 28 while ((getline < ARGV[1]) > 0) { 29 if (match ($0, /^#define LIBCURL_COPYRIGHT "[^"]+"$/)) { 30 libcurl_copyright_str = substr($0, 28, length($0)-28); 31 } 32 else if (match ($0, /^#define LIBCURL_VERSION "[^"]+"$/)) { 33 libcurl_ver_str = substr($3, 2, length($3)-2); 34 } 35 else if (match ($0, /^#define LIBCURL_VERSION_MAJOR [0-9]+$/)) { 36 libcurl_ver_major = substr($3, 1, length($3)); 37 } 38 else if (match ($0, /^#define LIBCURL_VERSION_MINOR [0-9]+$/)) { 39 libcurl_ver_minor = substr($3, 1, length($3)); 40 } 41 else if (match ($0, /^#define LIBCURL_VERSION_PATCH [0-9]+$/)) { 42 libcurl_ver_patch = substr($3, 1, length($3)); 43 } 44 } 45 libcurl_ver = libcurl_ver_major "," libcurl_ver_minor "," libcurl_ver_patch; 46 print "LIBCURL_VERSION = " libcurl_ver ""; 47 print "LIBCURL_VERSION_STR = " libcurl_ver_str ""; 48 print "LIBCURL_COPYRIGHT_STR = " libcurl_copyright_str ""; 49 } 50 if (match (ARGV[1], /ares_version.h/)) { 51 while ((getline < ARGV[1]) > 0) { 52 if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) { 53 libcares_copyright_str = substr($0, 25, length($0)-25); 54 } 55 else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) { 56 libcares_ver_str = substr($3, 2, length($3)-2); 57 } 58 else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) { 59 libcares_ver_major = substr($3, 1, length($3)); 60 } 61 else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) { 62 libcares_ver_minor = substr($3, 1, length($3)); 63 } 64 else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) { 65 libcares_ver_patch = substr($3, 1, length($3)); 66 } 67 } 68 libcares_ver = libcares_ver_major "," libcares_ver_minor "," libcares_ver_patch; 69 print "LIBCARES_VERSION = " libcares_ver ""; 70 print "LIBCARES_VERSION_STR = " libcares_ver_str ""; 71 print "LIBCARES_COPYRIGHT_STR = " libcares_copyright_str ""; 72 } 73} 74 75 76