get_ver.awk 1.2 KB

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