1 # ***************************************************************************
3 # * Project ___| | | | _ \| |
4 # * / __| | | | |_) | |
5 # * | (__| |_| | _ <| |___
6 # * \___|\___/|_| \_\_____|
8 # * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
18 # * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # * KIND, either express or implied.
21 # * $Id: get_ver.awk,v 1.1.1.1 2008-09-23 16:32:05 hoffman Exp $
22 # ***************************************************************************
23 # awk script which fetches curl / ares version number and string from input
24 # file and writes them to STDOUT. Here you can get an awk version for Win32:
25 # http://www.gknw.net/development/prgtools/awk-20070501.zip
28 if (match (ARGV[1], /curlver.h
/)) {
29 while ((getline < ARGV[1]) > 0) {
30 if (match ($
0, /^
#define LIBCURL_COPYRIGHT "[^"]+"$/)) {
31 libcurl_copyright_str =
substr($
0, 28, length($
0)-28);
33 else if (match ($
0, /^
#define LIBCURL_VERSION "[^"]+"$/)) {
34 libcurl_ver_str =
substr($
3, 2, length($
3)-2);
36 else if (match ($
0, /^
#define LIBCURL_VERSION_MAJOR [0-9]+$/)) {
37 libcurl_ver_major =
substr($
3, 1, length($
3));
39 else if (match ($
0, /^
#define LIBCURL_VERSION_MINOR [0-9]+$/)) {
40 libcurl_ver_minor =
substr($
3, 1, length($
3));
42 else if (match ($
0, /^
#define LIBCURL_VERSION_PATCH [0-9]+$/)) {
43 libcurl_ver_patch =
substr($
3, 1, length($
3));
46 libcurl_ver = libcurl_ver_major
"," libcurl_ver_minor
"," libcurl_ver_patch
;
47 print "LIBCURL_VERSION = " libcurl_ver
"";
48 print "LIBCURL_VERSION_STR = " libcurl_ver_str
"";
49 print "LIBCURL_COPYRIGHT_STR = " libcurl_copyright_str
"";
51 if (match (ARGV[1], /ares_version.h
/)) {
52 while ((getline < ARGV[1]) > 0) {
53 if (match ($
0, /^
#define ARES_COPYRIGHT "[^"]+"$/)) {
54 libcares_copyright_str =
substr($
0, 25, length($
0)-25);
56 else if (match ($
0, /^
#define ARES_VERSION_STR "[^"]+"$/)) {
57 libcares_ver_str =
substr($
3, 2, length($
3)-2);
59 else if (match ($
0, /^
#define ARES_VERSION_MAJOR [0-9]+$/)) {
60 libcares_ver_major =
substr($
3, 1, length($
3));
62 else if (match ($
0, /^
#define ARES_VERSION_MINOR [0-9]+$/)) {
63 libcares_ver_minor =
substr($
3, 1, length($
3));
65 else if (match ($
0, /^
#define ARES_VERSION_PATCH [0-9]+$/)) {
66 libcares_ver_patch =
substr($
3, 1, length($
3));
69 libcares_ver = libcares_ver_major
"," libcares_ver_minor
"," libcares_ver_patch
;
70 print "LIBCARES_VERSION = " libcares_ver
"";
71 print "LIBCARES_VERSION_STR = " libcares_ver_str
"";
72 print "LIBCARES_COPYRIGHT_STR = " libcares_copyright_str
"";