diff options
-rw-r--r-- | fb-helper.c | 9 | ||||
-rw-r--r-- | fb.1 | 2 | ||||
-rw-r--r-- | fb.in | 13 |
3 files changed, 22 insertions, 2 deletions
diff --git a/fb-helper.c b/fb-helper.c index 56f9429..11d115e 100644 --- a/fb-helper.c +++ b/fb-helper.c @@ -48,6 +48,7 @@ struct progressData { }; struct options { + int debug; char *url; char *file; }; @@ -238,12 +239,14 @@ int main(int argc, char *argv[]) int opt; struct options options = { + .debug = 0, .file = NULL, .url = NULL }; - while ((opt = getopt(argc, argv, "u:f:m:")) != -1) { + while ((opt = getopt(argc, argv, "Du:f:m:")) != -1) { switch (opt) { + case 'D': options.debug = 1; break; case 'u': options.url = optarg; break; @@ -268,6 +271,10 @@ int main(int argc, char *argv[]) goto cleanup; } + if (options.debug > 0) { + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + } + /* if we have a file to upload, add it as a POST request */ if (options.file) { struct stat statbuf; @@ -83,6 +83,8 @@ Upload a tar file containing all files and directories specified on the command line. .It Fl v Display the client version. +.It Fl D +Display debugging information. .El .Sh CONFIGURATION FILES .Bl -tag @@ -46,6 +46,7 @@ compress=0 display_history= clipboard="" exitcode=0 +debug= base64_encode() { if type base64 2>&1 >/dev/null; then @@ -68,6 +69,10 @@ request_helper() { if [ -x "$libdir/fb-helper" ]; then helperopts="" + if [ "$debug" ]; then + helperopts="$helperopts -D" + fi + if [ "$mode" = "d" ]; then $libdir/fb-helper $helperopts -u "$url" fi @@ -79,6 +84,10 @@ request_helper() { useragent="fb-client/shell-$version" curlopts="-# -n -L -A $useragent --speed-time 30 --speed-limit 1 --connect-timeout 10" + if [ "$debug" ]; then + curlopts="$curlopts -v" + fi + if [ "$mode" = "d" ]; then curlopts="$curlopts -s" fi @@ -222,6 +231,7 @@ usage: [cat |] `basename "$0"` [switches] [options] [<file(s)|ID(s)|folder(s)>] -t upload a tar file containing all files (and directories) -c compress the file being uploaded with gz or xz if used 2 times When used in conjunction with -g this decompresses the download + -D show debugging information ! } @@ -230,7 +240,7 @@ if ! type getopts >/dev/null 2>&1; then exit 1 fi -while getopts "e:gdhHtcv" option; do +while getopts "e:gdhHtcvD" option; do case $option in e) extension="$OPTARG";; g) get=1;; @@ -239,6 +249,7 @@ while getopts "e:gdhHtcv" option; do d) delete=1;; H) display_history=1;; v) printf "%s\n" "$version"; exit 0;; + D) debug=1;; h|\?) help; exit 0;; esac done |