1 # *************************************************************************** 2 # * _ _ ____ _ 3 # * Project ___| | | | _ \| | 4 # * / __| | | | |_) | | 5 # * | (__| |_| | _ <| |___ 6 # * \___|\___/|_| \_\_____| 7 # * 8 # * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel (at] 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 function symbols from public header input 23 # files and write 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 add_symbol("curl_strequal") 28 add_symbol("curl_strnequal") 29 } 30 31 function add_symbol(sym_name) { 32 sub(" ", "", sym_name) 33 exports[++idx] = sym_name 34 } 35 36 37 /^CURL_EXTERN .* [*]?curl_.*[(]/ { 38 sub("[(].*", "") 39 sub("^.* ", "") 40 sub("^[*]", "") 41 add_symbol($0) 42 } 43 44 END { 45 printf("Added %d symbols to export list.\n", idx) > "/dev/stderr" 46 # sort symbols with shell sort 47 increment = int(idx / 2) 48 while (increment > 0) { 49 for (i = increment+1; i <= idx; i++) { 50 j = i 51 temp = exports[i] 52 while ((j >= increment+1) && (exports[j-increment] > temp)) { 53 exports[j] = exports[j-increment] 54 j -= increment 55 } 56 exports[j] = temp 57 } 58 if (increment == 2) 59 increment = 1 60 else 61 increment = int(increment*5/11) 62 } 63 # print the array 64 if (EXPPREFIX) { 65 printf(" (%s)\n", EXPPREFIX) 66 } 67 while (x < idx - 1) { 68 printf(" %s,\n", exports[++x]) 69 } 70 printf(" %s\n", exports[++x]) 71 } 72 73