| 
#!/bin/rc
# altalias guest-domain user - look up aliases in a names file for a guest domain
# To use:
#	• Make an "namefiles.alt" containing only "names.local".
#	• Make a names.<whatever>, in the same format as names.local.
#	• Tell /mail/lib/rewrite to use altalias to translate that domain, eg:
#	(kremvax\.org)!(.+)		translate	"/mail/lib/altalias '\1' '\2'"
# use only the guest names file (and not the user's!)
rfork n
bind /mail/lib/namefiles.alt /mail/lib/namefiles
bind /mail/lib/names.`{echo $1 | tr A-Z a-z} /mail/lib/names.local
bind /n/none /mail/box
# bounce unknown addresses and make the guest domain the default
upas/aliasmail $2 | sed '
	s/^local!/error!/
	s/^here!/local!/
	s/^[^!@]+$/'$1'!&/
'
 |