]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/support/general/pgpshow.sh
Simplify folder_exists() to just testing stat(2)'s return value.
[nmh] / docs / historical / mh-6.8.5 / support / general / pgpshow.sh
1 : run this script through /bin/sh
2 : $Id: pgpshow.sh,v 1.4 1996/02/09 01:32:45 jromine Exp $
3
4 CMD=$1 SHOW=more REFILE=N
5
6 X=$2.tmp Y=$2.out Z=$2
7 trap "rm -f $X $Y" 0 1 2 3 13 15
8
9 shift; shift
10 for A in $*; do
11 A="`echo $A | tr '[A-Z]' '[a-z]'`"
12 case "$A" in
13 format=*)
14 if [ "$A" = "format=mime" ]; then
15 SHOW="show -file"
16 REFILE=T
17 fi
18 ;;
19
20 x-*)
21 ;;
22
23 *) echo "usage: pgpshow -store/-show file"
24 exit 1
25 ;;
26 esac
27 done
28
29 case "$CMD" in
30 -show) rm -f $X $Y
31 if pgp $Z -o $X | tee $Y; then
32 PGP_SIGNATURE=`grep "^Good signature from user " $Y | sed -e 's%^Good signature from user "\(.*\)".$%\1%'`
33 export PGP_SIGNATURE
34 $SHOW $X
35 else
36 exit 1
37 fi
38 ;;
39
40 -store) cat > $X
41 pgp $X -o $Z
42 if [ "$REFILE" = "T" ]; then
43 refile -file $Z +inbox
44 fi
45 ;;
46
47 *) echo "usage: pgpshow -store/-show file"
48 exit 1
49 ;;
50 esac
51
52 exit 0