get_ver.awk 757 B

123456789101112131415161718192021
  1. # fetch libcurl version number from input file and write them to STDOUT
  2. BEGIN {
  3. while ((getline < ARGV[1]) > 0) {
  4. if (match ($0, /^#define LIBCURL_VERSION_MAJOR [^"]+/)) {
  5. libcurl_ver_major = substr($3, 1, length($3));
  6. }
  7. else if (match ($0, /^#define LIBCURL_VERSION_MINOR [^"]+/)) {
  8. libcurl_ver_minor = substr($3, 1, length($3));
  9. }
  10. else if (match ($0, /^#define LIBCURL_VERSION_PATCH [^"]+/)) {
  11. libcurl_ver_patch = substr($3, 1, length($3));
  12. }
  13. }
  14. libcurl_ver = libcurl_ver_major "," libcurl_ver_minor "," libcurl_ver_patch;
  15. libcurl_ver_str = libcurl_ver_major "." libcurl_ver_minor "." libcurl_ver_patch;
  16. print "LIBCURL_VERSION = " libcurl_ver "";
  17. print "LIBCURL_VERSION_STR = " libcurl_ver_str "";
  18. }