1/*************************************************************************** 2 * _ _ ____ _ 3 * Project ___| | | | _ \| | 4 * / __| | | | |_) | | 5 * | (__| |_| | _ <| |___ 6 * \___|\___/|_| \_\_____| 7 * 8 * Copyright (C) 1998 - 2011, 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 http://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 23#include "test.h" 24 25#include "memdebug.h" 26 27static int new_fnmatch(const char *pattern, const char *string) 28{ 29 (void)pattern; 30 (void)string; 31 return CURL_FNMATCHFUNC_MATCH; 32} 33 34int test(char *URL) 35{ 36 int res; 37 CURL *curl; 38 39 if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { 40 fprintf(stderr, "curl_global_init() failed\n"); 41 return TEST_ERR_MAJOR_BAD; 42 } 43 44 if ((curl = curl_easy_init()) == NULL) { 45 fprintf(stderr, "curl_easy_init() failed\n"); 46 curl_global_cleanup(); 47 return TEST_ERR_MAJOR_BAD; 48 } 49 50 test_setopt(curl, CURLOPT_URL, URL); 51 test_setopt(curl, CURLOPT_WILDCARDMATCH, 1L); 52 test_setopt(curl, CURLOPT_FNMATCH_FUNCTION, new_fnmatch); 53 54 res = curl_easy_perform(curl); 55 if(res) { 56 fprintf(stderr, "curl_easy_perform() failed %d\n", res); 57 goto test_cleanup; 58 } 59 res = curl_easy_perform(curl); 60 if(res) { 61 fprintf(stderr, "curl_easy_perform() failed %d\n", res); 62 goto test_cleanup; 63 } 64 65test_cleanup: 66 curl_easy_cleanup(curl); 67 curl_global_cleanup(); 68 return res; 69} 70