2
0

get_ver.awk 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # ***************************************************************************
  2. # * _ _ ____ _
  3. # * Project ___| | | | _ \| |
  4. # * / __| | | | |_) | |
  5. # * | (__| |_| | _ <| |___
  6. # * \___|\___/|_| \_\_____|
  7. # *
  8. # * Copyright (C) 1998 - 2012, 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 https://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 version number and copyright 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-20100523.zip
  25. #
  26. BEGIN {
  27. while ((getline < ARGV[1]) > 0) {
  28. sub("\r", "") # make MSYS gawk work with CRLF header input.
  29. if (match ($0, /^#define LIBCURL_COPYRIGHT "([^"]+)"$/))
  30. copyright_string = substr($0, 28, length($0)-28)
  31. else if (match ($0, /^#define LIBCURL_VERSION "[^"]+"$/))
  32. version_string = substr($3, 2, length($3)-2)
  33. else if (match ($0, /^#define LIBCURL_VERSION_MAJOR [0-9]+$/))
  34. version_major = $3
  35. else if (match ($0, /^#define LIBCURL_VERSION_MINOR [0-9]+$/))
  36. version_minor = $3
  37. else if (match ($0, /^#define LIBCURL_VERSION_PATCH [0-9]+$/))
  38. version_patch = $3
  39. }
  40. print "LIBCURL_VERSION = " version_major "," version_minor "," version_patch
  41. print "LIBCURL_VERSION_STR = " version_string
  42. print "LIBCURL_COPYRIGHT_STR = " copyright_string
  43. }