3 RP500=%LIBEXECDIR%/rp500
6 if [ -z "$NAME" ]; then
7 echo "usage: xrpcomp name [arguments for comp]" 2>&1
12 if [ ! -s "$DB" ]; then
15 if [ ! -s "$DB" ]; then
16 echo "unable to read $DB" 2>&1
20 C=/tmp/rp$$.comp S=/tmp/rp$$.sh O=/tmp/rp$$.orig
21 trap "rm -f $C $S $O" 0 1 2 3 13 15
24 gawk -v NAME="$NAME" -v S="$S" -v O="$O" '
27 for (l = length(f); l > 0; l--)
28 s = s "." substr(f, l, 1)
29 return substr(s, 2, length(s) - 1)
38 gsub("Recipient[ ]*:", "Originator:", from);
40 for (i = 3; i <= NF; i++)
41 orig = orig "\r\n" $i;
42 printf orig "\r\n" > O
47 for (i = 2; i <= NF; i++) {
48 if (match($i, "Facsimile[ ]*:") > 0) {
49 fax = substr($i, RSTART+RLENGTH)
50 gsub("[ +-]", "", fax)
52 printf "ADDR=\"remote-printer@%s.tpc.int\"\n", rev(fax) > S
53 printf "To: remote-printer@%s.tpc.int\n", rev(fax)
56 printf "#<application/remote-printing\n"
59 for (i = 3; i <= NF; i++)
60 recip = recip "\r\n" $i;
61 printf "%s\r\n%s\r\n", recip, orig
69 if [ -z "$ADDR" ]; then
70 echo "recipient \"$NAME\" not in $DB, checking X.500..." 2>&1
75 elif [ $RC = 0 ]; then
79 echo "error searching X.500" 2>&1
85 comp -form $C $* -editor rpprompter