Thanks to John Cummings.

This commit is contained in:
rsc 2005-10-29 16:26:44 +00:00
parent cd37451963
commit 5cdb17983a
94 changed files with 26853 additions and 0 deletions

View file

@ -0,0 +1,9 @@
#!/bin/sh
PATH=/bin:/usr/bin
message=${1-/usr/lib/upas/gone.msg}
return=`sed '2,$s/^From[ ]/>&/'|tee -a $HOME/gone.mail|sed -n '1s/^From[ ]\([^ ]*\)[ ].*$/\1/p'`
echo '' >>$HOME/gone.mail
grep "^$return" $HOME/gone.addrs >/dev/null 2>/dev/null || {
echo $return >>$HOME/gone.addrs
mail $return < $message
}

View file

@ -0,0 +1,4 @@
This is a recorded message. I am currently out of contact with my
computer system. Your message to me has been saved and will be
read upon my return. This is the last time you will receive this
message during my absence. Thank you.

51
src/cmd/upas/misc/mail.c Normal file
View file

@ -0,0 +1,51 @@
/*
* #!/bin/sh
* case $1 in
* -n)
* exit 0 ;;
* -m*|-f*|-r*|-p*|-e*|"")
* exec /usr/lib/upas/edmail $*
* exit $? ;;
* *)
* exec /usr/lib/upas/send $*
* exit $? ;;
* esac
*/
extern *UPASROOT;
#define EDMAIL "edmail"
#define SEND "send"
main (argc, argv)
int argc;
char **argv;
{
char *progname = SEND;
char realprog[500];
if (argc > 1) {
if (argv[1][0] == '-') {
switch (argv[1][1]) {
case 'n':
exit (0);
case 'm':
case 'f':
case 'r':
case 'p':
case 'e':
case '\0':
progname = EDMAIL;
}
}
} else
progname = EDMAIL;
sprint(realprog, "%s/%s", UPASROOT, progname);
execv (realprog, argv);
perror (realprog);
exit (1);
}

12
src/cmd/upas/misc/mail.rc Executable file
View file

@ -0,0 +1,12 @@
#!/bin/rc
switch($#*){
case 0
exec upas/nedmail
}
switch($1){
case -f* -r* -c* -m*
exec upas/nedmail $*
case *
exec upas/marshal $*
}

12
src/cmd/upas/misc/mail.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh
case $1 in
-n)
exec LIBDIR/notify
exit $? ;;
-m*|-f*|-r*|-p*|-e*|"")
exec LIBDIR/edmail $*
exit $? ;;
*)
exec LIBDIR/send $*
exit $? ;;
esac

View file

@ -0,0 +1,44 @@
LIB=/usr/lib/upas
CFLAGS=${UNIX} -g -I. -I../libc -I../common -I/usr/include -I/usr/include/sys
LFLAGS=-g
HOSTNAME=cat /etc/whoami
.c.o: ; $(CC) -c $(CFLAGS) $*.c
all: mail
sedfile:
echo 's+LIBDIR+$(LIB)+g' >sed.file
echo 's+HOSTNAME+$(HOSTNAME)+g' >>sed.file
install: sedfile install.fish install.mail.sh
install.fish:
cp gone.msg $(LIB)
sed -f sed.file gone.fishing >$(LIB)/gone.fishing
-chmod 775 $(LIB)/gone.fishing
-chown bin $(LIB)/gone.fishing $(LIB)/gone.msg
install.mail.sh:
sed -f sed.file mail.sh >/bin/mail
-chown bin /bin/mail
-chmod 775 /bin/mail
install.notify: notify
cp notify $(LIB)/notify
-chmod 775 $(LIB)/notify
-chown bin $(LIB)/notify
install.mail: mail
cp mail /bin
strip /bin/mail
notify: notify.o
cc $(LFLAGS) notify.o -o notify
mail: mail.o ../config/config.o
cc $(LFLAGS) mail.o ../config/config.o -o mail
clean:
-rm -f *.[oOa] core a.out *.sL notify
-rm -f sed.file mail

39
src/cmd/upas/misc/mkfile Normal file
View file

@ -0,0 +1,39 @@
RCFILES=mail.rc\
all:Q:
;
installall:Q: install
;
install:V:
cp mail.rc /rc/bin/mail
safeinstall:V:
cp mail.rc /rc/bin/mail
safeinstallall:V:
cp mail.rc /rc/bin/mail
clean:Q:
;
nuke:V:
rm /rc/bin/mail
UPDATE=\
gone.fishing\
gone.msg\
mail.c\
mail.rc\
mail.sh\
makefile\
mkfile\
namefiles\
omail.rc\
qmail\
remotemail\
rewrite\
update:V:
update $UPDATEFLAGS $UPDATE

View file

@ -0,0 +1,2 @@
names.local
names.global

14
src/cmd/upas/misc/omail.rc Executable file
View file

@ -0,0 +1,14 @@
#!/bin/rc
switch($#*){
case 0
exec upas/edmail -m
}
switch($1){
case -F* -m* -f* -r* -p* -e* -c* -D*
exec upas/edmail -m $*
case '-#'* -a*
exec upas/sendmail $*
case *
exec upas/sendmail $*
}

6
src/cmd/upas/misc/qmail Executable file
View file

@ -0,0 +1,6 @@
#!/bin/rc
sender=$1
shift
addr=$1
shift
qer /mail/queue mail $sender $addr $* && runq /mail/queue /mail/lib/remotemail

7
src/cmd/upas/misc/remotemail Executable file
View file

@ -0,0 +1,7 @@
#!/bin/rc
shift
sender=$1
shift
addr=$1
shift
/bin/upas/smtp -g research.research.bell-labs.com $addr $sender $*

20
src/cmd/upas/misc/rewrite Normal file
View file

@ -0,0 +1,20 @@
# case conversion for postmaster
pOsTmAsTeR alias postmaster
# local mail
[^!@]+ translate "/bin/upas/aliasmail '&'"
local!(.*) >> /mail/box/\1/mbox
\l!(.*) alias \1
(helix|helix.bell-labs.com)!(.*) alias \2
# we can be just as complicated as BSD sendmail...
# convert source domain address to a chain a@b@c@d...
@([^@!,]*):([^!@]*)@([^!]*) alias \2@\3@\1
@([^@!]*),([^!@,]*):([^!@]*)@([^!]*) alias @\1:\3@\4@\2
# convert a chain a@b@c@d... to ...d!c!b!a
([^@]+)@([^@]+)@(.+) alias \2!\1@\3
([^@]+)@([^@]+) alias \2!\1
# /mail/lib/remotemail will take care of gating to systems we don't know
([^!]*)!(.*) | "/mail/lib/qmail '\s' 'net!\1'" "'\2'"