#!/bin/bash
# This script is used with test-gnupg-process
# Needs to be run with /bin/bash in order to handle two digit
# file descriptor redirects
set -euf
SFD=
AFD=
# Not real 'long' option parsing, but good enough for this
while [ $# -gt 1 ]; do
if [ "$1" = --status-fd ]; then
SFD=$2
shift
elif [ "$1" = --attribute-fd ]; then
AFD=$2
shift
fi
shift
done
# No FD passed :(
if [ -z "$AFD" ]; then
exit 22
fi
if [ -z "$SFD" ]; then
exit 23
fi
echo -n "1lc923g4laoeurc23rc2" >&$AFD
echo "[GNUPG:] SCHEMA one two three four " >&$SFD
echo -n "41lcg2r23c4gr3" >&$AFD