Added --i2p to the --help message in clainsafecli and improved usage
message starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch master # Your branch is up to date with 'origin/master'. # # Changes to be committed: # modified: clainsafecli.c # # Untracked files: # clainsafecli #
This commit is contained in:
parent
4535b267a9
commit
d2c48dcb66
1 changed files with 16 additions and 15 deletions
|
@ -5,9 +5,8 @@
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
|
||||||
size_t static write_data(void *buffer, size_t size, size_t nmemb,
|
size_t static write_data(void *buffer, size_t size, size_t nmemb,
|
||||||
void *userp)
|
void *userp)
|
||||||
{
|
{
|
||||||
memcpy(userp, buffer, nmemb*size);
|
memcpy(userp, buffer, nmemb*size);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -16,16 +15,18 @@ size_t static write_data(void *buffer, size_t size, size_t nmemb,
|
||||||
void
|
void
|
||||||
print_usage()
|
print_usage()
|
||||||
{
|
{
|
||||||
printf("USAGE: clainsafecli [--server] file\n");
|
printf("USAGE: clainsafecli [--tor|--i2p] [--server] file\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
printf("--server <server>: specifies the lainsafe server\n%s\n%s",
|
printf("--server <server>: specifies the lainsafe server\n%s\n%s\n%s",
|
||||||
"--tor: uses tor",
|
"--tor: uses tor",
|
||||||
"--help: print this message\n");
|
"--help: print this message\n",
|
||||||
|
"--i2p: uses i2p HTTP proxy"
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while((c = getopt_long(argc,argv, "htis:",
|
while((c = getopt_long(argc,argv, "htis:",
|
||||||
long_options,&option_index)) != -1) {
|
long_options,&option_index)) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 's':
|
case 's':
|
||||||
strncpy(server,optarg,256);
|
strncpy(server,optarg,256);
|
||||||
|
@ -105,25 +106,25 @@ main(int argc, char **argv)
|
||||||
} else if(tor_flag) {
|
} else if(tor_flag) {
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_PROXY,"127.0.0.1:9050");
|
curl_easy_setopt(easy_handle,CURLOPT_PROXY,"127.0.0.1:9050");
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_PROXYTYPE,
|
curl_easy_setopt(easy_handle,CURLOPT_PROXYTYPE,
|
||||||
CURLPROXY_SOCKS5_HOSTNAME);
|
CURLPROXY_SOCKS5_HOSTNAME);
|
||||||
} else if(i2p_flag) {
|
} else if(i2p_flag) {
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_PROXY,"127.0.0.1:4444");
|
curl_easy_setopt(easy_handle,CURLOPT_PROXY,"127.0.0.1:4444");
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_PROXYTYPE,
|
curl_easy_setopt(easy_handle,CURLOPT_PROXYTYPE,
|
||||||
CURLPROXY_HTTP);
|
CURLPROXY_HTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Form parameters */
|
/* Form parameters */
|
||||||
|
|
||||||
/* File name */
|
/* File name */
|
||||||
curl_formadd(&post,&last,
|
curl_formadd(&post,&last,
|
||||||
CURLFORM_COPYNAME, "file",
|
CURLFORM_COPYNAME, "file",
|
||||||
CURLFORM_FILE,argv[optind],
|
CURLFORM_FILE,argv[optind],
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
/* Actual file content */
|
/* Actual file content */
|
||||||
curl_formadd(&post,&last,
|
curl_formadd(&post,&last,
|
||||||
CURLFORM_COPYNAME, "file",
|
CURLFORM_COPYNAME, "file",
|
||||||
CURLFORM_COPYCONTENTS,argv[optind],
|
CURLFORM_COPYCONTENTS,argv[optind],
|
||||||
CURLFORM_END);
|
CURLFORM_END);
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle,CURLOPT_HTTPPOST,post);
|
curl_easy_setopt(easy_handle,CURLOPT_HTTPPOST,post);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue