Debian Codegraph @

gcr/fixtures/gnupg-mock/mock-status-and-attribute

raw
1 #!/bin/bash
2
3 # This script is used with test-gnupg-process
4 # Needs to be run with /bin/bash in order to handle two digit
5 # file descriptor redirects
6
7 set -euf
8
9 SFD=
10 AFD=
11
12 # Not real 'long' option parsing, but good enough for this
13 while [ $# -gt 1 ]; do
14 if [ "$1" = --status-fd ]; then
15 SFD=$2
16 shift
17 elif [ "$1" = --attribute-fd ]; then
18 AFD=$2
19 shift
20 fi
21 shift
22 done
23
24 # No FD passed :(
25 if [ -z "$AFD" ]; then
26 exit 22
27 fi
28 if [ -z "$SFD" ]; then
29 exit 23
30 fi
31
32 printf "1lc923g4laoeurc23rc2" >&$AFD
33 echo "[GNUPG:] SCHEMA one two three four " >&$SFD
34 printf "41lcg2r23c4gr3" >&$AFD