diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-12-11 13:41:52 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-12-11 13:41:52 +0100 |
commit | 41488c9750b7675dcb544a36e2efb9b00aad6209 (patch) | |
tree | 403cb01e5f45a88cf74eabdbb1391e0ff09e6cc2 /fb-helper.sh.in | |
parent | bdff0e2faab98b13f9d54bf489ea537ca5e75d6e (diff) |
add bash version of fb-helper.c
Using the bash helper can be forced by running "make LIBCURL=".
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb-helper.sh.in')
-rw-r--r-- | fb-helper.sh.in | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fb-helper.sh.in b/fb-helper.sh.in new file mode 100644 index 0000000..3a4e3b2 --- /dev/null +++ b/fb-helper.sh.in @@ -0,0 +1,20 @@ +#!/bin/sh + +mode=$1 +url=$2 +file=$3 + +USERAGENT="fb-client/shell-@VERSION@" +CURLOPTS="-n -L -A $USERAGENT" + +if [ "$mode" = "u" ]; then + basefilename=`basename -- "$file"` + if [ `stat -c %s -- "$file"` -eq "0" ] || echo "$basefilename" | grep -F -q ","; then + basefilename=`echo "$basefilename" | tr -d ,` + curl $CURLOPTS -F "file=@-;filename=$basefilename" "$url" < "$file" -o /dev/stdout + else + curl $CURLOPTS -F "file=@$file" "$url" -o /dev/stdout + fi +else + curl $CURLOPTS "$url" +fi |