Added compilation option for sakisafecli to use strlcpy on Linux systems
This commit is contained in:
parent
955985b825
commit
b39bd3bc5b
3 changed files with 22 additions and 11 deletions
|
@ -1,9 +1,18 @@
|
||||||
PROG = sakisafecli
|
|
||||||
SRCS += funcs.c sakisafecli.c config.c
|
PROG += sakisafecli
|
||||||
MAN = sakisafecli.1 sakisafeclirc.5
|
SRCS += funcs.c sakisafecli.c config.c
|
||||||
LDADD = -lssl -lz -lpthread -lnghttp2 -lcurl -lconfig -lcrypto -L/usr/local/lib
|
MAN += sakisafecli.1 sakisafeclirc.5
|
||||||
|
LDADD += -lssl -lz -lpthread -lnghttp2 -lcurl -lconfig -lcrypto -L/usr/local/lib
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
||||||
|
# Use libbsd features if wanted
|
||||||
|
use-libbsd ?= no
|
||||||
|
.if ${use-libbsd} == "yes"
|
||||||
|
CFLAGS += -Duse_libbsd
|
||||||
|
LDADD += -lbsd
|
||||||
|
.endif
|
||||||
|
|
||||||
|
BINMODE = 755
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
MANDIR = $(PREFIX)/man/man
|
MANDIR = $(PREFIX)/man/man
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ print_help()
|
||||||
"server\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
"server\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
|
||||||
"-t|--token: Authentication token (https://u.kalli.st)",
|
"-t|--token: Authentication token (https://u.kalli.st)",
|
||||||
"-P|--http-proxy: http proxy to use e.g. http://127.0.0.1:4444",
|
"-P|--http-proxy: http proxy to use e.g. http://127.0.0.1:4444",
|
||||||
"-p|--socks-proxy: SOCK proxy to use e.g. 127.0.0.1:9050",
|
"-p|--socks-proxy: SOCK proxy to use e.g.I 127.0.0.1:9050",
|
||||||
"-6|--ipv6: uses IPv6 only",
|
"-6|--ipv6: uses IPv6 only",
|
||||||
"-4|--ipv6: uses IPv4 only",
|
"-4|--ipv6: uses IPv4 only",
|
||||||
"-S|--silent: doesn't print progress",
|
"-S|--silent: doesn't print progress",
|
||||||
"-x|--paste: read file from stdin",
|
"-x|--paste: read file from stdin",
|
||||||
"-C: print current settings",
|
"-C: print current settings",
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifdef use_libbsd
|
||||||
|
#include <bsd/string.h>
|
||||||
|
#endif
|
||||||
#include "curl/easy.h"
|
#include "curl/easy.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -56,7 +58,7 @@ main(int argc, char **argv)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#if defined(__OpenBSD__) || defined(__FreeBSD__)
|
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(use_libbsd)
|
||||||
strlcpy(config_location, sakisafeclirc_env, 512);
|
strlcpy(config_location, sakisafeclirc_env, 512);
|
||||||
#else /* Linux sucks! */
|
#else /* Linux sucks! */
|
||||||
strncpy(config_location, sakisafeclirc_env, 512);
|
strncpy(config_location, sakisafeclirc_env, 512);
|
||||||
|
@ -236,11 +238,11 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
char path[256];
|
char path[256];
|
||||||
char *filename = argv[optind];
|
char *filename = argv[optind];
|
||||||
|
|
||||||
curl_easy_setopt(easy_handle, CURLOPT_UPLOAD, true);
|
curl_easy_setopt(easy_handle, CURLOPT_UPLOAD, true);
|
||||||
FILE *fp = fopen(filename, "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if(fp == NULL) {
|
if(fp == NULL) {
|
||||||
fprintf(stderr, "%s",strerror(errno));
|
fprintf(stderr, "%s", strerror(errno));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +258,7 @@ main(int argc, char **argv)
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
fprintf(stderr, "%i: %s\n", ret, curl_easy_strerror(ret));
|
fprintf(stderr, "%i: %s\n", ret, curl_easy_strerror(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
puts("Unsupported protocol");
|
puts("Unsupported protocol");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue