Git init
[external/curl.git] / tests / libtest / lib574.c
1 /*****************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  */
9
10 #include "test.h"
11
12 #include "memdebug.h"
13
14 static int new_fnmatch(const char *pattern, const char *string)
15 {
16   (void)pattern;
17   (void)string;
18   return CURL_FNMATCHFUNC_MATCH;
19 }
20
21 int test(char *URL)
22 {
23   int res;
24   CURL *curl;
25
26   if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
27     fprintf(stderr, "curl_global_init() failed\n");
28     return TEST_ERR_MAJOR_BAD;
29   }
30
31   if ((curl = curl_easy_init()) == NULL) {
32     fprintf(stderr, "curl_easy_init() failed\n");
33     curl_global_cleanup();
34     return TEST_ERR_MAJOR_BAD;
35   }
36
37   test_setopt(curl, CURLOPT_URL, URL);
38   test_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
39   test_setopt(curl, CURLOPT_FNMATCH_FUNCTION, new_fnmatch);
40
41   res = curl_easy_perform(curl);
42   if(res) {
43     fprintf(stderr, "curl_easy_perform() failed %d\n", res);
44     goto test_cleanup;
45   }
46   res = curl_easy_perform(curl);
47   if(res) {
48     fprintf(stderr, "curl_easy_perform() failed %d\n", res);
49     goto test_cleanup;
50   }
51
52 test_cleanup:
53   curl_easy_cleanup(curl);
54   curl_global_cleanup();
55   return res;
56 }