]> granicus.if.org Git - curl/commitdiff
fixes
authorDaniel Stenberg <daniel@haxx.se>
Thu, 12 Dec 2002 13:40:16 +0000 (13:40 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 12 Dec 2002 13:40:16 +0000 (13:40 +0000)
tests/libtest/first.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/test.h [new file with mode: 0644]

index 303766fc890d6e2bfb59e31091493abc56b4abec..4f42136a0328f5052ef3da993e5d0d77bde82bda 100644 (file)
@@ -1,10 +1,26 @@
 #include <curl/curl.h>
 
+#ifdef MALLOCDEBUG
+/* provide a proto for this debug function */
+extern void curl_memdebug(const char *);
+#endif
+
+/* test is provided in the test code file */
+CURLcode test(char *url);
+
 int main(int argc, char **argv)
 {
+  char *URL;
   if(argc< 2 ) {
     fprintf(stderr, "Pass URL as argument please\n");
     return 1;
   }
+  URL = argv[1]; /* provide this to the rest */
+
+  fprintf(stderr, "URL: %s\n", URL);
 
+#ifdef MALLOCDEBUG
   curl_memdebug("memdump");
+#endif
+  return test(URL);
+}
index a825b930c54013b910a8b3c8851424303d37007a..f78ab55618251b4ce70756570765b9d521ad4d52 100644 (file)
@@ -1,12 +1,13 @@
-#include "first.c"
+#include "test.h"
 
-fprintf(stderr, "URL: %s\n", argv[1]);
+CURLcode test(char *URL)
+{
+  CURLcode res;
+  CURL *curl = curl_easy_init();
+  curl_easy_setopt(curl, CURLOPT_URL, URL);
+  curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
+  res = curl_easy_perform(curl);
+  curl_easy_cleanup(curl);  
+  return res;
+}
 
-CURL *curl;
-curl = curl_easy_init();
-curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
-curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
-curl_easy_perform(curl);
-curl_easy_cleanup(curl);
-
-#include "last.c"
index 4199598fadf7afafc4dd9724e9354880ffae5869..2ed1a9ae4c100194bad17aab9f5f2e8c43758035 100644 (file)
@@ -1,13 +1,14 @@
-#include "first.c"
+#include "test.h"
 
-fprintf(stderr, "URL: %s\n", argv[1]);
+CURLcode test(char *URL)
+{
+  CURLcode res;
+  CURL *curl = curl_easy_init();
 
-CURL *curl;
-CURLcode res;
-curl = curl_easy_init();
-curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
-res = curl_easy_perform(curl);
-curl_easy_cleanup(curl);
+  (void)URL; /* we don't use this */
+  curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
+  res = curl_easy_perform(curl);
+  curl_easy_cleanup(curl);
+  return res;
+}
 
-return res;
-#include "last.c"
diff --git a/tests/libtest/test.h b/tests/libtest/test.h
new file mode 100644 (file)
index 0000000..959270a
--- /dev/null
@@ -0,0 +1,3 @@
+#include <curl/curl.h>
+#include <stdio.h>
+