summaryrefslogtreecommitdiff
path: root/src/tool_setopt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_setopt.h')
-rw-r--r--src/tool_setopt.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/tool_setopt.h b/src/tool_setopt.h
index d01c9eb24..fcd60f856 100644
--- a/src/tool_setopt.h
+++ b/src/tool_setopt.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -23,28 +23,47 @@
***************************************************************************/
#include "setup.h"
-CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
- const char *name, CURLoption tag, ...);
-
/*
* Macros used in operate()
*/
-#define my_setopt(x,y,z) do { \
- res = tool_setopt(x, FALSE, config, #y, y, z); \
+#define SETOPT_CHECK(v) do { \
+ res = (v); \
if(res) \
goto show_error; \
} WHILE_FALSE
-#define my_setopt_str(x,y,z) do { \
- res = tool_setopt(x, TRUE, config, #y, y, z); \
- if(res) \
- goto show_error; \
-} WHILE_FALSE
+#ifndef CURL_DISABLE_LIBCURL_OPTION
+
+/* Intercept setopt calls for --libcurl */
+
+CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
+ const char *name, CURLoption tag, ...);
+
+#define my_setopt(x,y,z) \
+ SETOPT_CHECK(tool_setopt(x, FALSE, config, #y, y, z))
+
+#define my_setopt_str(x,y,z) \
+ SETOPT_CHECK(tool_setopt(x, TRUE, config, #y, y, z))
#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, config, #y, y, z)
-#endif /* HEADER_CURL_TOOL_SETOPT_H */
+#else
+
+/* No --libcurl, so pass options directly to library */
+
+#define my_setopt(x,y,z) \
+ SETOPT_CHECK(curl_easy_setopt(x, y, z))
+#define my_setopt_str(x,y,z) \
+ SETOPT_CHECK(curl_easy_setopt(x, y, z))
+
+#define res_setopt(x,y,z) curl_easy_setopt(x,y,z)
+
+#define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)
+
+#endif /* CURL_DISABLE_LIBCURL_OPTION */
+
+#endif /* HEADER_CURL_TOOL_SETOPT_H */