@@ -39,22 +39,6 @@ if echo $KSH_VERSION | grep -q ' 93' && ! local foo 2>/dev/null; then
3939 alias local=typeset
4040fi
4141
42- # any better test not involving either OS matching or actual query?
43- if [ ` uname -s` = OpenBSD ] && [ -x /usr/bin/ftp ]; then
44- curl () {
45- local opt args=" -o -"
46- while getopts " b:s" opt; do
47- case $opt in
48- b) args=" $args -c $OPTARG " ;;
49- s) args=" $args -M -V" ;;
50- * ) echo " internal error: unsupported cURL option '$opt '" >&2 ; exit 1;;
51- esac
52- done
53- shift $(( $OPTIND - 1 ))
54- /usr/bin/ftp $args " $@ "
55- }
56- fi
57-
5842get_query_options ()
5943{
6044 local query=" $* "
144128
145129[ -z " $CHTSH_URL " ] && CHTSH_URL=https://cht.sh
146130
131+ # any better test not involving either OS matching or actual query?
132+ if [ ` uname -s` = OpenBSD ] && [ -x /usr/bin/ftp ]; then
133+ curl () {
134+ local opt args=" -o -"
135+ while getopts " b:s" opt; do
136+ case $opt in
137+ b) args=" $args -c $OPTARG " ;;
138+ s) args=" $args -M -V" ;;
139+ * ) echo " internal error: unsupported cURL option '$opt '" >&2 ; exit 1;;
140+ esac
141+ done
142+ shift $(( $OPTIND - 1 ))
143+ /usr/bin/ftp $args " $@ "
144+ }
145+ else
146+ command -v curl > /dev/null || { echo ' DEPENDENCY: install "curl" to use cht.sh' >&2 ; exit 1; }
147+ _CURL=$( command -v curl)
148+ if [ x" $CHTSH_CURL_OPTIONS " != x ]; then
149+ curl () {
150+ $_CURL ${CHTSH_CURL_OPTIONS} " $@ "
151+ }
152+ fi
153+ fi
154+
155+
147156if [ " $1 " = --read ]; then
148157 read -r a || a=exit
149158 printf " %s\n" " $a "
@@ -200,7 +209,6 @@ if [ "$is_macos" != yes ]; then
200209 command -v xsel > /dev/null || echo ' DEPENDENCY: please install "xsel" for "copy"' >&2
201210fi
202211command -v rlwrap > /dev/null || { echo ' DEPENDENCY: install "rlwrap" to use cht.sh in the shell mode' >&2 ; exit 1; }
203- command -v curl > /dev/null || { echo ' DEPENDENCY: install "curl" to use cht.sh' >&2 ; exit 1; }
204212
205213mkdir -p " $HOME /.cht.sh/"
206214lines=$( tput lines)
0 commit comments