From 4dcc3606a8e9671ea95f97ece1cbc27a8cac15f1 Mon Sep 17 00:00:00 2001 From: Vadim Zhukov Date: Thu, 16 Aug 2018 13:34:39 +0300 Subject: [PATCH] Use in-base ftp(1) on OpenBSD instead of cURL. --- share/cht.sh.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/share/cht.sh.txt b/share/cht.sh.txt index 7ed1b7c..9d7b8b5 100755 --- a/share/cht.sh.txt +++ b/share/cht.sh.txt @@ -39,6 +39,22 @@ if echo $KSH_VERSION | grep -q ' 93' && ! local foo 2>/dev/null; then alias local=typeset fi +# any better test not involving either OS matching or actual query? +if [ `uname -s` = OpenBSD ] && [ -x /usr/bin/ftp ]; then + curl() { + local opt args="-U curl/7.61.0 -o -" + while getopts "b:s" opt; do + case $opt in + b) args="$args -c $OPTARG";; + s) args="$args -M -V";; + *) echo "internal error: unsupported cURL option '$opt'" >&2; exit 1;; + esac + done + shift $(($OPTIND - 1)) + /usr/bin/ftp $args "$@" + } +fi + get_query_options() { local query="$*"