aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-10-26 07:06:52 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-10-26 07:06:52 +0000
commit68c231e1b0a7d73ec053688763ac5b82cc5049db (patch)
treef7754a29dbfd91a3e79da43c20db5080099120f8
parent949eaf8ad4a2221b91926de06dbc244a9f7f65ae (diff)
Kevin P Roth's idea of supporting multiple -d options was turned into reality
-rw-r--r--src/main.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/src/main.c b/src/main.c
index d997d7b6b..d9bbd7c73 100644
--- a/src/main.c
+++ b/src/main.c
@@ -686,28 +686,43 @@ static int getparameter(char *flag, /* f or -long-flag */
break;
case 'd':
/* postfield data */
- if('@' == *nextarg) {
- /* the data begins with a '@' letter, it means that a file name
- or - (stdin) follows */
- FILE *file;
- char *ptr;
-
- nextarg++; /* pass the @ */
-
- if(strequal("-", nextarg))
- file = stdin;
- else
- file = fopen(nextarg, "r");
+ {
+ char *postdata=NULL;
+
+ if('@' == *nextarg) {
+ /* the data begins with a '@' letter, it means that a file name
+ or - (stdin) follows */
+ FILE *file;
+ char *ptr;
+
+ nextarg++; /* pass the @ */
+
+ if(strequal("-", nextarg))
+ file = stdin;
+ else
+ file = fopen(nextarg, "r");
+
+ if(subletter == 'b') /* forced binary */
+ postdata = file2memory(file, &config->postfieldsize);
+ else
+ postdata = file2string(file);
+ if(file && (file != stdin))
+ fclose(stdin);
+ }
+ else {
+ GetStr(&postdata, nextarg);
+ }
- if(subletter == 'b') /* forced binary */
- config->postfields = file2memory(file, &config->postfieldsize);
+ if(config->postfields && *config->postfields) {
+ /* we already have a string, we append this one
+ with a separating &-letter */
+ char *oldpost=config->postfields;
+ config->postfields=maprintf("%s&%s", oldpost, postdata);
+ free(oldpost);
+ free(postdata);
+ }
else
- config->postfields = file2string(file);
- if(file && (file != stdin))
- fclose(stdin);
- }
- else {
- GetStr(&config->postfields, nextarg);
+ config->postfields=postdata;
}
if(config->postfields)
config->conf |= CONF_POST;