1# fetch libssh2 version number from input file and write them to STDOUT 2BEGIN { 3 while ((getline < ARGV[1]) > 0) { 4 if (match ($0, /^#define LIBSSH2_COPYRIGHT "[^"]+"$/)) { 5 my_copyright_str = substr($0, 28, length($0)-28); 6 } 7 else if (match ($0, /^#define LIBSSH2_VERSION[ |\t]+"[^"]+"/)) { 8 my_ver_str = substr($3, 2, length($3) - 2); 9 split(my_ver_str, v, "."); 10 if (v[3]) 11 gsub("[^0-9].*$", "", v[3]); 12 else 13 v[3] = 0; 14 if (v[2]) 15 gsub("[^0-9].*$", "", v[2]); 16 else 17 v[2] = 0; 18 my_ver = v[1] "," v[2] "," v[3]; 19 } 20 } 21 print "LIBSSH2_VERSION = " my_ver ""; 22 print "LIBSSH2_VERSION_STR = " my_ver_str ""; 23 print "LIBSSH2_COPYRIGHT_STR = " my_copyright_str ""; 24} 25