Path: utzoo!attcan!uunet!samsung!usc!zaphod.mps.ohio-state.edu!sunybcs!uhura.cc.rochester.edu!ee.rochester.edu!deke From: deke@ee.rochester.edu (Dikran Kassabian) Newsgroups: comp.sys.next Subject: Re: is there any way to Message-ID: <1990Mar28.214917.5409@ee.rochester.edu> Date: 28 Mar 90 21:49:17 GMT References: <22303@netnews.upenn.edu> <1990Mar28.153439.6841@ee.rochester.edu> Reply-To: deke@ee.rochester.edu (Dikran Kassabian) Distribution: na Organization: University of Rochester Department of Electrical Engineering Lines: 77 In article <1990Mar28.153439.6841@ee.rochester.edu> I (Dikran Kassabian) write: robertl@bucsf.bu.edu (Robert La Ferla) writes: <>I like that idea. I hope NeXT will incorporate it as an optional feature in <>Preferences. The obvious default aural alert is the English lady saying <>"You have new mail." < #include #include #include #define TIMER 2*60 #define SOUND "sndplay /home/galaxy2/staff/deke/mail.snd" #define MAILPATH "/usr/spool/mail/%s" extern char *getenv(); main (argc, argv, envp) register int argc; register char **argv; char **envp; { char *path, *user, *sys_buf; void *malloc(); struct stat *buf; long tmp_time=0; if( (user = getenv("USER"))==0 ){ /* get user name */ fprintf(stderr,"Who are you?"); exit(1); } path=malloc(sizeof(MAILPATH)+10); /* allocate storage */ buf=malloc(1024); /* allocate storage */ (void) sprintf(path,MAILPATH,user); /* setup path */ sys_buf=malloc(sizeof(SOUND)); /* allocate storage */ (void) sprintf(sys_buf,SOUND); /* setup shell command */ while(1){ /* forever... */ if( stat(path,buf)!=0 ){ /* stat path */ perror(path); exit(1); } if(( buf->st_mtime > buf->st_atime) && ((buf->st_mtime > tmp_time))){ system(sys_buf); tmp_time=buf->st_mtime; } sleep(TIMER); } /*endwhile*/ }