fdwrap/example-gemini.sh

17 lines
373 B
Bash

#!/bin/sh
HOST="${HOST:-localhost}"
PORT="${PORT:-1965}"
while getopts h:p: opt; do
case "$opt" in
h) HOST="$OPTARG";;
p) PORT="$OPTARG";;
*) usage;;
esac
done
shift $((OPTIND - 1))
for x in "$@"; do
fdwrap -f '3>stdin,stdin<stdout' -w \
"openssl s_client -quiet -connect $HOST:$PORT 2>/dev/null" \
sh -c 'printf %s\\r\\n "$1" >&3; cat' sh-gemini "$x"
done