summaryrefslogtreecommitdiffstats
path: root/fb
diff options
context:
space:
mode:
Diffstat (limited to 'fb')
-rwxr-xr-xfb26
1 files changed, 20 insertions, 6 deletions
diff --git a/fb b/fb
index a5ffb92..3925fc1 100755
--- a/fb
+++ b/fb
@@ -11,7 +11,7 @@
# Optional: xclip
#----------------------------------------------------
-VERSION="0.6.6.1"
+VERSION="0.6.7"
DELETE=
EXTENSION=""
@@ -20,6 +20,7 @@ PASTEBIN="http://paste.xinu.at"
WARNSIZE=10485760
USERAGENT="fb-client/$VERSION"
CLIPBOARD=""
+EXITCODE=0
do_upload() {
local EXTRA=""
@@ -31,10 +32,14 @@ do_upload() {
WARNSIZE=`curl -s "$PASTEBIN/file/get_max_size"`
if [ `stat -c %s "$1"` -gt "$WARNSIZE" ]; then
echo "Warning: Your upload is too big and would be rejected. Maximum size is: $WARNSIZE bytes. Skipping..." >&2
- return
+ EXITCODE=1
+ return 1
fi
fi
- curl -# -n -L -A $USERAGENT $EXTRA -F "file=@$1" "$PASTEBIN/file/do_upload" > $TMPFILE
+ if ! curl -# -n -L -A $USERAGENT $EXTRA -F "file=@$1" "$PASTEBIN/file/do_upload" > $TMPFILE; then
+ EXITCODE=1
+ return 1
+ fi
sed '$d' $TMPFILE >&2
URL=`tail -1 $TMPFILE`
echo $URL
@@ -85,12 +90,19 @@ if [ $# -eq 0 ]; then
else
for i in "$@"; do
if [ "$DELETE" ]; then
- curl -n -L -A $USERAGENT "$PASTEBIN/file/delete/$i"
+ if ! curl -n -L -A $USERAGENT "$PASTEBIN/file/delete/$i"; then
+ EXITCODE=1
+ fi
elif [ "$GET" ]; then
- curl -s -o - -A $USERAGENT "$PASTEBIN/$i"
+ if ! curl -s -o - -A $USERAGENT "$PASTEBIN/$i"; then
+ EXITCODE=1
+ fi
elif echo "$i" | grep -qE "^(f|ht)tp(s)?://.+"; then
cd $TMPDIR
- curl -# -A $USERAGENT -O "$i"
+ if ! curl -# -A $USERAGENT -O "$i"; then
+ EXITCODE=1
+ continue
+ fi
for f in *; do
do_upload "$f" && rm -f "$f"
done
@@ -101,3 +113,5 @@ else
fi
[ "`which xclip 2>/dev/null`" ] && echo -n $CLIPBOARD | nohup xclip >/dev/null 2>&1
+
+exit $EXITCODE