[comp.sys.apollo] mail_alarm

wcwang@iuvax.UUCP (04/28/87)

From dennis@cod.nosc.mil Tue Apr 28 10:13:17 1987
Received: by cod.nosc.mil (5.54/1.14)
	id AA27770; Tue, 28 Apr 87 08:10:17 PDT
Date: Tue, 28 Apr 87 08:10:17 PDT
From: dennis@cod.nosc.mil (Dennis Cottel)
Message-Id: <8704281510.AA27770@cod.nosc.mil>
To: wcwang@iuvax.cs.indiana.edu
Subject: Re: mail notification on Apollo
Cc: apollo@yale.edu
Status: R

Using Berkeley Mail on the Apollo, you can arrange to get an alarm
window containing the Subject and Sender each time a new message
arrives.

All you need to do is to set up a .forward file in your home directory
that looks like this:

\dennis
"|/user/local/com/mail_alarm dennis"

where the MAIL_ALARM command is the shell script below.

       Dennis Cottel  Naval Ocean Systems Center, San Diego, CA  92152
       (619) 225-2406     dennis@NOSC.MIL       sdcsvax!noscvax!dennis

--------------------------------cut here-------------------------
#!/com/sh
# $Header: //pumpkin_patch/local/source/mail_alarm/mail_alarm,v 1.6 87/04/08 13:30:37 dennis Exp $

# Mail notification using Send_Alarm

# Called from .forward by Sendmail with the notificee
# given as an argument, i.e. "mail_alarm dennis".
  
eon

#-----------------------------------------------------------------
#  Explanation for the following command:
#
#  The FPAT command returns a line for each of the arguments.  In
#  order to limit the total argument of SEND_ALARM to 80 characters
#  (to keep it from quitting), I use the trick of
#  sending the line through FMC with a line length of 80.  Therefore,
#  the output of FPAT has to be changed into one line first.  The
#  first EDSTR command changes any CRs to a hash mark, and the
#  second EDSTR command changes just the first one back after the
#  line has been truncated if necessary.  Whew!
#-----------------------------------------------------------------

sender := ^"fpat '%From: ' '%Subject: ' | edstr s/@n/#/ | fmc -c 1 -w 79 | edstr -e s/#/@n/ -e s/#/@ /g"

if eqs ^sender then # didn't find a From: or Subject: line
    sender := "Mail arrived from unknown user."
endif
  
username := ^"lusr -ppo ^1 >?/dev/null"

if not eqs ^username then # adressee is on-line
    /com/send_alarm ^sender -user ^1
endif