From 2b7f6dd91002a2a252755ea15a4c7bbc856ddc98 Mon Sep 17 00:00:00 2001 From: fbt Date: Sat, 4 Oct 2014 12:33:23 +0400 Subject: [PATCH] wtf --- sup | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sup b/sup index 9b32edf..bf4688c 100755 --- a/sup +++ b/sup @@ -1,6 +1,26 @@ #!/usr/bin/env bash -# fbt -# A script for uploading files to zfh.so. +# Copyright (c) 2012 fbt +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# About: +# A simple upload script for ZFH (http://zerofiles.org) cfg_url_regex='^[A-Za-z]([A-Za-z0-9+.-]+)?://.+' cfg_tmp_dir="/tmp/$USER/sup"; TEMPDIR="$cfg_tmp_dir" @@ -56,7 +76,6 @@ sup.scrot() { [[ "$flag_scrot_fullscreen" ]] || { scrot_args+=( '-s' ); } [[ "$cfg_scrot_delay" ]] && { scrot_args+=( "-d $cfg_scrot_delay" ); } -<<<<<<< HEAD until [[ ! -e "${cfg_tmp_dir}/${tmp_file_name}" ]]; do tmp_file_name="${RANDOM}${RANDOM}.${cfg_screenshot_ext}" done @@ -67,10 +86,6 @@ sup.scrot() { } echo "${cfg_tmp_dir}/$tmp_file_name" -======= - file=`sup.mktemp "$cfg_tmp_dir/sup_tmp_$$.png"` - scrot "${scrot_args[@]}" "$file" ->>>>>>> 1f00542683c0e9756a46582b7c62429adb2212f6 } sup.exclude() { @@ -80,7 +95,6 @@ sup.exclude() { sup.if_url() { echo "$1" | grep -oE "$cfg_url_regex" &>/dev/null; } -<<<<<<< HEAD main() { while [[ "$1" ]]; do case "$1" in @@ -90,12 +104,7 @@ main() { -s|--screenshot) flag_scrot='1';; -F|--fullscreen) flag_scrot_fullscreen='1';; -D|--screenshot-delay) cfg_scrot_delay="$2"; shift;; -======= -while getopts "pRsFD:h" option; do - case "$option" in - p) flag_private='true';; ->>>>>>> 1f00542683c0e9756a46582b7c62429adb2212f6 - + -h|--help|--usage) sup.usage; return;; --) break;; @@ -112,17 +121,8 @@ while getopts "pRsFD:h" option; do else target="${args[0]}"; [[ "$target" ]] || { sup.usage; exit 1; } -<<<<<<< HEAD sup.if_url "$target" && { file=`mktemp "$cfg_tmp_dir/sup_tmp_XXXXXX"` -======= -[[ "$flag_scrot" ]] && { - sup.scrot -} || { - sup.if_url "$1" && { - file=`sup.mktemp "$cfg_tmp_dir/sup_tmp_$$"` - [[ "$file_title" ]] || { file_title="Source: $file; $cfg_default_title"; } ->>>>>>> 1f00542683c0e9756a46582b7c62429adb2212f6 curl -s "$target" > "$file" || { sup.err "Could not download file."