Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!manuel!csc.canberra.edu.au!echo!rpj From: rpj@echo.canberra.edu.au (Ross Johnson) Newsgroups: comp.sys.apollo Subject: Re: Elm mail tools Keywords: Elm, where?, simple on Apollo? Message-ID: Date: 5 Feb 91 02:13:38 GMT References: <1067@eba.eb.ele.tue.nl> <181@numenor.gtephx.UUCP> Sender: news@csc.canberra.edu.au Organization: Info Sci & Eng, University of Canberra Lines: 152 >In article <1067@eba.eb.ele.tue.nl> wjw@ebs.eb.ele.tue.nl (Willem Jan Withagen) writes: >I'm trying to look into Elm (That's a set of mail tools). >But before doing anything drastic, I would like to inquire on the net: >1) if there's anybody who has ported this baby to SR10.x > (If it needed porting) >2) Where did he get the sources? >3) Was it much effort? As others have said, it's straight forward. If you use Elm's "newmail" utility for background notification of new mail then you'll want to make some changes to the source. The supplied newmail holds your mailboxes open permanently which means that on Apollos sendmail won't be able to append new mail to them. The following diffs are relative to Elm 2.3 PL11 and should fix that problem. Cheers, +----------------------+---+ | Ross Johnson | | E-Mail: rpj@ise.canberra.edu.au | Info Sciences and Eng|___| | University of Canberra | UUCP : uunet!munnari!ise.canberra.edu.au!rpj | PO Box 1 | JANET : rpj%au.edu.canberra.ise@EAN-RELAY | Belconnen ACT 2616 | BITNET: rpj%ise.canberra.edu.au@relay.cs.net | AUSTRALIA | +--------------------------+ -------------------------------------snip----------------------------------- *** newmail.c.old Sun Dec 23 21:38:56 1990 --- newmail.c Tue Dec 25 15:32:43 1990 *************** *** 83,88 **** --- 83,89 ---- #include #include #include + #include #include "defs.h" *************** *** 226,244 **** if (debug) printf("[checking folder #%d: %s]\n", i, folders[i].foldername); ! if (folders[i].fd == (FILE *) NULL) { ! ! if ((folders[i].fd = fopen(folders[i].foldername,"r")) == NULL) ! if (errno == EACCES) { ! fprintf(stderr, "\nPermission to monitor %s denied!\n\n", ! folders[i].foldername); ! sleep(5); ! exit(1); ! } } if ((newsize = bytes(folders[i].foldername)) > folders[i].filesize) { /* new mail has arrived! */ if (debug) printf( --- 227,242 ---- if (debug) printf("[checking folder #%d: %s]\n", i, folders[i].foldername); ! if (access(folders[i].foldername,R_OK) == -1) { ! fprintf(stderr, "\nPermission to monitor %s denied!\n\n", ! folders[i].foldername); ! sleep(5); ! exit(1); } if ((newsize = bytes(folders[i].foldername)) > folders[i].filesize) { /* new mail has arrived! */ + int retries; if (debug) printf( *************** *** 245,250 **** --- 243,268 ---- "\tnew mail has arrived! old size = %ld, new size=%ld\n", folders[i].filesize, newsize); + /* The following retry loop is there just in case + the folder is being updated just when we try to read + from it. It tries 3 times to open it, with 5 seconds + between attempts - then terminates newmail with a message. + + Hopefully other programs which access the folder + will do likewise. + */ + for (retries = 0; + (folders[i].fd = fopen(folders[i].foldername,"r")) == NULL && + retries++ < 3;) { + sleep(5); + } + if (folders[i].fd == NULL && errno == EACCES) { + fprintf(stderr, "\nPermission to read %s denied!\n\n", + folders[i].foldername); + sleep(5); + exit(1); + } + /* skip what we've read already... */ if (fseek(folders[i].fd, folders[i].filesize, *************** *** 256,268 **** /* read and display new mail! */ if (read_headers(i) && ! in_window) printf("\n\r"); } else if (newsize != folders[i].filesize) { /* file SHRUNK! */ folders[i].filesize = bytes(folders[i].foldername); - (void) fclose(folders[i].fd); /* close it and ... */ - folders[i].fd = (FILE *) NULL; /* let's reopen the file */ - lastsize = folders[i].filesize; done = 0; --- 274,285 ---- /* read and display new mail! */ if (read_headers(i) && ! in_window) printf("\n\r"); + + fclose(folders[i].fd); } else if (newsize != folders[i].filesize) { /* file SHRUNK! */ folders[i].filesize = bytes(folders[i].foldername); lastsize = folders[i].filesize; done = 0; *************** *** 708,714 **** if (stat(name, &buffer) != 0) if (errno != 2) { ! fprintf(stderr,"Error %d attempting fstat on %s", errno, name); exit(1); } else --- 725,731 ---- if (stat(name, &buffer) != 0) if (errno != 2) { ! fprintf(stderr,"Error %d attempting stat on %s", errno, name); exit(1); } else