From 0a8145685d8d13da0c12e61b034a2323a22f46e2 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 29 Aug 2014 17:58:28 +0200 Subject: Support multipastes Signed-off-by: Florian Pritz --- fb-helper.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'fb-helper.c') diff --git a/fb-helper.c b/fb-helper.c index b550887..261d3b8 100644 --- a/fb-helper.c +++ b/fb-helper.c @@ -221,11 +221,12 @@ void display_help() printf("Usage: fb-helper \n"); printf("\n"); printf("Options:\n"); - printf(" -D Print debugging information\n"); - printf(" -h This help\n"); - printf(" -u URL of pastebin or URL to download\n"); - printf(" -f File to upload to URL\n"); - printf(" -a Path to API key file\n"); + printf(" -D Print debugging information\n"); + printf(" -h This help\n"); + printf(" -u URL of pastebin or URL to download\n"); + printf(" -f File to upload to URL\n"); + printf(" -F key=value Post key=value\n"); + printf(" -a Path to API key file\n"); } int main(int argc, char *argv[]) @@ -264,7 +265,7 @@ int main(int argc, char *argv[]) exit(0); } - while ((opt = getopt(argc, argv, "Du:f:m:a:h")) != -1) { + while ((opt = getopt(argc, argv, "Du:f:F:m:a:h")) != -1) { switch (opt) { case 'D': options.debug = 1; break; @@ -272,6 +273,20 @@ int main(int argc, char *argv[]) case 'f': options.file = optarg; break; + case 'F': + { + char *save = NULL; + char *key = strtok_r(optarg, "=", &save); + char *value = strtok_r(save, "=", &save); + + curl_formadd(&formpost, + &lastptr, + CURLFORM_COPYNAME, key, + CURLFORM_PTRCONTENTS, value, + CURLFORM_END); + } + break; + case 'a': options.apikeyfile = optarg; break; case 'h': -- cgit v1.2.3-24-g4f1b