aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 72ab28868..709f6206a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4069,6 +4069,7 @@ output_expected(const char* url, const char* uploadfile)
#define my_setopt_str(x,y,z) _my_setopt(x, TRUE, config, #y, y, z)
static struct curl_slist *easycode;
+static struct curl_slist *easycode_remarks;
static CURLcode _my_setopt(CURL *curl, bool str, struct Configurable *config,
const char *name, CURLoption tag, ...);
@@ -4131,12 +4132,22 @@ static CURLcode _my_setopt(CURL *curl, bool str, struct Configurable *config,
if(config->libcurl && !skip) {
/* we only use this for real if --libcurl was used */
- bufp = curlx_maprintf("%scurl_easy_setopt(hnd, %s, %s);%s",
- remark?"/* ":"", name, value,
- remark?" [REMARK] */":"");
+ if(remark)
+ bufp = curlx_maprintf("%s set to a %s", name, value);
+ else
+ bufp = curlx_maprintf("curl_easy_setopt(hnd, %s, %s);", name, value);
- if (!bufp || !curl_slist_append(easycode, bufp))
+ if (!bufp)
ret = CURLE_OUT_OF_MEMORY;
+ else {
+ struct curl_slist *list =
+ curl_slist_append(remark?easycode_remarks:easycode, bufp);
+
+ if(remark)
+ easycode_remarks = list;
+ else
+ easycode = list;
+ }
if (bufp)
curl_free(bufp);
}
@@ -4147,8 +4158,7 @@ static CURLcode _my_setopt(CURL *curl, bool str, struct Configurable *config,
static const char * const srchead[]={
"/********* Sample code generated by the curl command line tool **********",
- " * Lines with [REMARK] below might need to be modified to make this code ",
- " * usable. Add error code checking where appropriate.",
+ " * Add error code checking where appropriate!",
" * Compile this with a suitable header include path. Then link with ",
" * libcurl.",
" * If you use any *_LARGE options, make sure your compiler figure",
@@ -4167,7 +4177,7 @@ static const char * const srchead[]={
static void dumpeasycode(struct Configurable *config)
{
- struct curl_slist *ptr = easycode;
+ struct curl_slist *ptr;
char *o = config->libcurl;
if(o) {
@@ -4197,10 +4207,27 @@ static void dumpeasycode(struct Configurable *config)
fprintf(out, "%s\n", c);
}
+ ptr = easycode;
while(ptr) {
fprintf(out, " %s\n", ptr->data);
ptr = ptr->next;
}
+
+ ptr = easycode_remarks;
+ if(ptr) {
+ fprintf(out,
+ "\n /* Here is a list of options the curl code"
+ " used that cannot get generated\n"
+ " as source easily. You may select to either"
+ " not use them or implement\n them yourself.\n"
+ "\n");
+ while(ptr) {
+ fprintf(out, " %s\n", ptr->data);
+ ptr = ptr->next;
+ }
+ fprintf(out, "\n */\n");
+ }
+
fprintf(out,
" return (int)ret;\n"
"}\n"