diff options
Diffstat (limited to 'src/cmd/upas/misc')
-rw-r--r-- | src/cmd/upas/misc/gone.fishing | 9 | ||||
-rw-r--r-- | src/cmd/upas/misc/gone.msg | 4 | ||||
-rw-r--r-- | src/cmd/upas/misc/mail.c | 51 | ||||
-rwxr-xr-x | src/cmd/upas/misc/mail.rc | 12 | ||||
-rw-r--r-- | src/cmd/upas/misc/mail.sh | 12 | ||||
-rw-r--r-- | src/cmd/upas/misc/makefile | 44 | ||||
-rw-r--r-- | src/cmd/upas/misc/mkfile | 39 | ||||
-rw-r--r-- | src/cmd/upas/misc/namefiles | 2 | ||||
-rwxr-xr-x | src/cmd/upas/misc/omail.rc | 14 | ||||
-rwxr-xr-x | src/cmd/upas/misc/qmail | 6 | ||||
-rwxr-xr-x | src/cmd/upas/misc/remotemail | 7 | ||||
-rw-r--r-- | src/cmd/upas/misc/rewrite | 20 |
12 files changed, 220 insertions, 0 deletions
diff --git a/src/cmd/upas/misc/gone.fishing b/src/cmd/upas/misc/gone.fishing new file mode 100644 index 00000000..a304271c --- /dev/null +++ b/src/cmd/upas/misc/gone.fishing @@ -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 +} diff --git a/src/cmd/upas/misc/gone.msg b/src/cmd/upas/misc/gone.msg new file mode 100644 index 00000000..9eb1e5a6 --- /dev/null +++ b/src/cmd/upas/misc/gone.msg @@ -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. diff --git a/src/cmd/upas/misc/mail.c b/src/cmd/upas/misc/mail.c new file mode 100644 index 00000000..20cf2397 --- /dev/null +++ b/src/cmd/upas/misc/mail.c @@ -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); +} + diff --git a/src/cmd/upas/misc/mail.rc b/src/cmd/upas/misc/mail.rc new file mode 100755 index 00000000..6913d743 --- /dev/null +++ b/src/cmd/upas/misc/mail.rc @@ -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 $* +} diff --git a/src/cmd/upas/misc/mail.sh b/src/cmd/upas/misc/mail.sh new file mode 100644 index 00000000..a41519ae --- /dev/null +++ b/src/cmd/upas/misc/mail.sh @@ -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 diff --git a/src/cmd/upas/misc/makefile b/src/cmd/upas/misc/makefile new file mode 100644 index 00000000..e00c4f7e --- /dev/null +++ b/src/cmd/upas/misc/makefile @@ -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 + diff --git a/src/cmd/upas/misc/mkfile b/src/cmd/upas/misc/mkfile new file mode 100644 index 00000000..0bbd8a5a --- /dev/null +++ b/src/cmd/upas/misc/mkfile @@ -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 diff --git a/src/cmd/upas/misc/namefiles b/src/cmd/upas/misc/namefiles new file mode 100644 index 00000000..ab3853b1 --- /dev/null +++ b/src/cmd/upas/misc/namefiles @@ -0,0 +1,2 @@ +names.local +names.global diff --git a/src/cmd/upas/misc/omail.rc b/src/cmd/upas/misc/omail.rc new file mode 100755 index 00000000..ed64f38c --- /dev/null +++ b/src/cmd/upas/misc/omail.rc @@ -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 $* +} diff --git a/src/cmd/upas/misc/qmail b/src/cmd/upas/misc/qmail new file mode 100755 index 00000000..77a3d228 --- /dev/null +++ b/src/cmd/upas/misc/qmail @@ -0,0 +1,6 @@ +#!/bin/rc +sender=$1 +shift +addr=$1 +shift +qer /mail/queue mail $sender $addr $* && runq /mail/queue /mail/lib/remotemail diff --git a/src/cmd/upas/misc/remotemail b/src/cmd/upas/misc/remotemail new file mode 100755 index 00000000..312ee587 --- /dev/null +++ b/src/cmd/upas/misc/remotemail @@ -0,0 +1,7 @@ +#!/bin/rc +shift +sender=$1 +shift +addr=$1 +shift +/bin/upas/smtp -g research.research.bell-labs.com $addr $sender $* diff --git a/src/cmd/upas/misc/rewrite b/src/cmd/upas/misc/rewrite new file mode 100644 index 00000000..fd724eb1 --- /dev/null +++ b/src/cmd/upas/misc/rewrite @@ -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'" |