lots
This commit is contained in:
parent
8c9529a7ba
commit
7f88127116
1 changed files with 42 additions and 28 deletions
|
@ -1,11 +1,11 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <errno.h>
|
||||
#include <curl/curl.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "options.h"
|
||||
#include "clainsafecli.h"
|
||||
|
@ -129,6 +129,11 @@ main(int argc, char **argv)
|
|||
/* Form parameters */
|
||||
|
||||
/* File name */
|
||||
|
||||
/* TODO: make it iterate on args so you can upload multiple files
|
||||
* at once (clainsafecli file1 file2 ... filen)
|
||||
*/
|
||||
|
||||
curl_formadd(&post,&last,
|
||||
CURLFORM_COPYNAME,"file",
|
||||
CURLFORM_FILE,argv[optind],
|
||||
|
@ -153,6 +158,7 @@ main(int argc, char **argv)
|
|||
|
||||
curl_easy_perform(easy_handle);
|
||||
if(!silent_flag) puts("");
|
||||
|
||||
puts(buffer);
|
||||
|
||||
curl_formfree(post);
|
||||
|
@ -168,7 +174,8 @@ main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t static write_data(void *buffer, size_t size, size_t nmemb,
|
||||
static size_t
|
||||
write_data(void *buffer, size_t size, size_t nmemb,
|
||||
void *userp)
|
||||
{
|
||||
memcpy(userp, buffer, nmemb*size);
|
||||
|
@ -178,7 +185,7 @@ size_t static write_data(void *buffer, size_t size, size_t nmemb,
|
|||
void
|
||||
print_usage()
|
||||
{
|
||||
printf("USAGE: clainsafecli [--tor|--i2p] [--server] file\n");
|
||||
printf("USAGE: clainsafecli [--tor|--i2p] [-6|-4] [--server] file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,9 +206,13 @@ store_link(const char *path, const char *buf)
|
|||
void
|
||||
print_help()
|
||||
{
|
||||
printf("--server <server>: specifies the lainsafe server\n%s\n%s",
|
||||
"--tor: uses tor",
|
||||
"--help: print this message\n");
|
||||
printf("--server <server>: specifies the lainsafe server\n%s\n%s\n%s\n%s\n%s\%s",
|
||||
"--tor: uses tor.",
|
||||
"--i2p: uses i2p.",
|
||||
"-6|--ipv6: uses IPv6 only.",
|
||||
"-4|--ipv6: uses IPv4 only.",
|
||||
"--silent: doesn't print progress.",
|
||||
"--help: print this message.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -212,6 +223,9 @@ progress(void *clientp,
|
|||
double ultotal,
|
||||
double ulnow)
|
||||
{
|
||||
clientp = NULL;
|
||||
dltotal = 0;
|
||||
dlnow = 0;
|
||||
printf("\r%0.f uploaded of %0.f (%0.f%%)",ulnow,ultotal,
|
||||
ulnow*100/ultotal);
|
||||
fflush(stdout);
|
||||
|
|
Loading…
Add table
Reference in a new issue