Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bu-cs!bucsb!eap From: eap@bucsb.UUCP (Eric Pearce) Newsgroups: comp.unix.questions Subject: Re: q: being notified of new mail Message-ID: <1308@bucsb.UUCP> Date: Fri, 4-Dec-87 10:03:10 EST Article-I.D.: bucsb.1308 Posted: Fri Dec 4 10:03:10 1987 Date-Received: Wed, 9-Dec-87 02:48:34 EST References: <4350001@wdl1.UUCP> <3600001@hpiacla.HP.COM> <4516@pyr.gatech.EDU> <1987Dec3.000951.15189@lsuc.uucp> Reply-To: eap@bucsb.UUCP (Eric Pearce) Organization: BD&HR (Beer Drinkers & Hell Raisers) Lines: 44 In article <1987Dec3.000951.15189@lsuc.uucp> dave@lsuc.UUCP (David Sherman) writes: >In article <4516@pyr.gatech.EDU> ccoprrd@pyr.gatech.EDU (Richard Dervan) writes: >>Well, the 'biff' command also works. In your .login or .profile, >>That should arrive you when mail arrives. The only thing is that it will >>even tell you if you're in vi or something like that. The thing about it >>is that it will tell you who the mail is from in addition to just saying >>"Hey! You got some new mail!" > >If you don't have tra(1) but have good C programming skills, >you can probably write it in 10 minutes. It just sits and >watches a file's size, displaying anything that's been added >to the file's tail every time it grows. I wrote something of this sort as a part of another program. Somebody might find this useful, so here it is. #include#include #include #define MAILFILE "/usr/spool/mail/yourname" #define SLEEP 30 main() { struct stat st; char path[50]; int old_size=0,new_size=0; while(1) { old_size = new_size; if (!stat(sprintf(path, "%s", MAILFILE), &st)) new_size = st.st_size; if (old_size < new_size) fprintf(stderr,"You have new mail.\n"); sleep(SLEEP); } } Actually displaying the new mail seems like something best left to your mail program, but that's just an opinion ... -eap -- **** .signature reduced in length due to space considerations ***************** | UUCP : ..!harvard!bu-cs!bucsb!eap | ARPANET: eap@bucsb.bu.edu | | CSNET : eap%bucsb@bu-cs | BITNET : cscc8vc@bostonu |