aboutsummaryrefslogtreecommitdiff
path: root/mail/coolmail
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2009-04-11 08:09:54 +0000
committerMartin Wilke <miwi@FreeBSD.org>2009-04-11 08:09:54 +0000
commitacf18bc5f983a824d4224ade4425e4912b2ec09e (patch)
treee1bdfa21a2e1ef2e25aac8ae4cb927d8e841b3ef /mail/coolmail
parent52f2e4b1f0bd530e0a05b0fecf5ef592b771914f (diff)
downloadports-acf18bc5f983a824d4224ade4425e4912b2ec09e.tar.gz
ports-acf18bc5f983a824d4224ade4425e4912b2ec09e.zip
Notes
Diffstat (limited to 'mail/coolmail')
-rw-r--r--mail/coolmail/Makefile2
-rw-r--r--mail/coolmail/files/patch-Makefile50
-rw-r--r--mail/coolmail/files/patch-aa358
-rw-r--r--mail/coolmail/files/patch-coolmail.c287
-rw-r--r--mail/coolmail/files/patch-coolmail.man32
-rw-r--r--mail/coolmail/files/patch-display_list.c46
6 files changed, 416 insertions, 359 deletions
diff --git a/mail/coolmail/Makefile b/mail/coolmail/Makefile
index 3d8635625800..741e7a8e6843 100644
--- a/mail/coolmail/Makefile
+++ b/mail/coolmail/Makefile
@@ -7,7 +7,7 @@
PORTNAME= coolmail
PORTVERSION= 1.3
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SUNSITE}
MASTER_SITE_SUBDIR=system/mail/biffs
diff --git a/mail/coolmail/files/patch-Makefile b/mail/coolmail/files/patch-Makefile
new file mode 100644
index 000000000000..6e664b91ad5d
--- /dev/null
+++ b/mail/coolmail/files/patch-Makefile
@@ -0,0 +1,50 @@
+--- Makefile.orig Thu Jan 11 11:55:40 1996
++++ Makefile Mon Oct 12 17:55:05 1998
+@@ -22,31 +22,38 @@
+ # your linker where to find the libraries it will need, and BINDIR and
+ # MANDIR specify the places to install the binary executable and manpage
+ # files for coolmail when you type `make install'.
+-CFLAGS =
++CFLAGS = -DNO_CUSERID
+ LINK = $(CC)
+-INCLUDES = -I/usr/X11R5/include
+-LIB_DIRS = -L/usr/X11R5/lib
++INCLUDES = -I$(LOCALBASE)/include
++LIB_DIRS = -L$(LOCALBASE)/lib
+ BINDIR = /usr/local/bin
+ MANDIR = /usr/local/man/man1
+
+ # Comment these out if you can't or don't want to use the digitized audio
+ # feature.
+-AUDIO = -DAUDIO
+-AUDIO_MODULE = audio.o
++# AUDIO = -DAUDIO
++# AUDIO_MODULE = audio.o
++
++# Comment these out if you don't want Maildir support
++MAILDIR = -DSUPPORT_MAILDIR
++# for debugging:
++#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_DEBUG
++# normally ignores non-regular files in the Maildir; uncomment to change
++#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_STRICTER
+
+ #### You really don't need to read past this point. ####
+
+ LIBS = $(LIB_DIRS) -lXt -lX11 -lm -lXext
+-COPTS = $(CFLAGS) $(AUDIO)
++LIBS += -Wl,-rpath,$(LOCALBASE)/lib
++COPTS = $(CFLAGS) $(AUDIO) $(MAILDIR)
+
+ all: coolmail
+ # Done.
+
+-new:
+- rm -f *.o coolmail core
++new: clean all
+
+ clean:
+- rm -f *.o core
++ rm -f *.o core coolmail
+
+ install:
+ @if [ -w $(BINDIR) ] ; then \
diff --git a/mail/coolmail/files/patch-aa b/mail/coolmail/files/patch-aa
deleted file mode 100644
index 4600d9ee82ec..000000000000
--- a/mail/coolmail/files/patch-aa
+++ /dev/null
@@ -1,358 +0,0 @@
---- Makefile.orig Thu Jan 11 11:55:40 1996
-+++ Makefile Mon Oct 12 17:55:05 1998
-@@ -22,31 +22,38 @@
- # your linker where to find the libraries it will need, and BINDIR and
- # MANDIR specify the places to install the binary executable and manpage
- # files for coolmail when you type `make install'.
--CFLAGS =
-+CFLAGS = -DNO_CUSERID
- LINK = $(CC)
--INCLUDES = -I/usr/X11R5/include
--LIB_DIRS = -L/usr/X11R5/lib
-+INCLUDES = -I$(LOCALBASE)/include
-+LIB_DIRS = -L$(LOCALBASE)/lib
- BINDIR = /usr/local/bin
- MANDIR = /usr/local/man/man1
-
- # Comment these out if you can't or don't want to use the digitized audio
- # feature.
--AUDIO = -DAUDIO
--AUDIO_MODULE = audio.o
-+# AUDIO = -DAUDIO
-+# AUDIO_MODULE = audio.o
-+
-+# Comment these out if you don't want Maildir support
-+MAILDIR = -DSUPPORT_MAILDIR
-+# for debugging:
-+#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_DEBUG
-+# normally ignores non-regular files in the Maildir; uncomment to change
-+#MAILDIR = $(MAILDIR) -DSUPPORT_MAILDIR_STRICTER
-
- #### You really don't need to read past this point. ####
-
- LIBS = $(LIB_DIRS) -lXt -lX11 -lm -lXext
--COPTS = $(CFLAGS) $(AUDIO)
-+LIBS += -Wl,-rpath,$(LOCALBASE)/lib
-+COPTS = $(CFLAGS) $(AUDIO) $(MAILDIR)
-
- all: coolmail
- # Done.
-
--new:
-- rm -f *.o coolmail core
-+new: clean all
-
- clean:
-- rm -f *.o core
-+ rm -f *.o core coolmail
-
- install:
- @if [ -w $(BINDIR) ] ; then \
-diff -rc coolmail-1.3.org/audio.c coolmail-1.3/audio.c
-*** coolmail-1.3.org/audio.c Thu Jan 11 18:56:40 1996
---- coolmail-1.3/audio.c Fri Jul 3 08:47:51 1998
-***************
-*** 128,133 ****
---- 128,134 ----
- INIT_FD;
- audiofd = open( "/dev/audio", O_WRONLY | O_NDELAY );
- if (audiofd < 0) {
-+ perror("/dev/audio");
- fprintf(stderr, "%s: Problem opening /dev/audio.\n",
- "Coolmail");
- END_FD;
-diff -rc coolmail-1.3.org/coolmail.c coolmail-1.3/coolmail.c
-*** coolmail-1.3.org/coolmail.c Thu Jan 11 18:57:24 1996
---- coolmail-1.3/coolmail.c Fri Jul 3 09:01:05 1998
-***************
-*** 25,32 ****
---- 25,34 ----
- #include <sys/wait.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-+ #include <dirent.h>
- #include <fcntl.h>
-
-+
- #ifdef AUDIO
- #include <string.h>
- #endif
-***************
-*** 34,41 ****
- #include "render1.h"
- #include "mailbox.h"
-
-! #define DEFAULT_MAIL_DIR "/var/spool/mail/"
-! #define DEFAULT_COMMAND "xterm -n Elm -e mail\0"
- #define DEFAULT_INTERVAL 30
- #define DEFAULT_FRAMES 15
-
---- 36,44 ----
- #include "render1.h"
- #include "mailbox.h"
-
-! #define DEFAULT_MAIL_DIR "/var/mail/"
-!
-! #define DEFAULT_COMMAND "xterm -n Elm -e elm\0"
- #define DEFAULT_INTERVAL 30
- #define DEFAULT_FRAMES 15
-
-***************
-*** 96,102 ****
---- 99,107 ----
- int main(int argc, char *argv[])
- {
- int reason;
-+ #ifndef NO_CUSERID
- char username[L_cuserid];
-+ #endif
-
- /* Quickly scan for the -h option -- if it is present don't do anything
- * but print out some help and exit. */
-***************
-*** 104,110 ****
- return(0);
-
- /* Get the username and use it to create a default mailfile name */
-! strcat(mailfile_str, cuserid(username));
-
- /* Initialize the renderer */
- rend_init(&argc, argv, (float)150.0);
---- 109,126 ----
- return(0);
-
- /* Get the username and use it to create a default mailfile name */
-! #ifdef SUPPORT_MAILDIR
-! if (getenv("MAILDIR") && strlen(getenv("MAILDIR"))) {
-! strcpy(mailfile_str,getenv("MAILDIR"));
-! } else if (getenv("MAIL") && strlen(getenv("MAIL"))) {
-! strcpy(mailfile_str,getenv("MAIL"));
-! } else
-! #endif
-! #ifndef NO_CUSERID
-! strcat(mailfile_str, cuserid(username));
-! #else
-! strcat(mailfile_str, getlogin());
-! #endif
-
- /* Initialize the renderer */
- rend_init(&argc, argv, (float)150.0);
-***************
-*** 432,438 ****
- printf(" -e command Specifies a command (usually in quotes) which\n");
- printf(" is used to invoke your favorite mail-reading\n");
- printf(" program.\n\n");
-! printf(" -f filename Watch filename, instead of the default mail\n");
- printf(" file, %s<username>.\n\n", DEFAULT_MAIL_DIR);
- printf(" -fr n Number of frames to generate for each animation.\n");
- printf(" Set to an appropriate value for your machine's.\n");
---- 448,454 ----
- printf(" -e command Specifies a command (usually in quotes) which\n");
- printf(" is used to invoke your favorite mail-reading\n");
- printf(" program.\n\n");
-! printf(" -f filename Watch filename/maildir, instead of the default mail\n");
- printf(" file, %s<username>.\n\n", DEFAULT_MAIL_DIR);
- printf(" -fr n Number of frames to generate for each animation.\n");
- printf(" Set to an appropriate value for your machine's.\n");
-***************
-*** 626,631 ****
---- 642,680 ----
-
- /* Get file modification time */
-
-+
-+ /* Maildir notes (aqua@sonoma.net, Sun Jan 18 19:42:27 PST 1998):
-+ *
-+ * The maildir mail-storage standard is a replacement for the traditional
-+ * 'mbox' format, intended to remove problems with file contention, locking,
-+ * reduce corruption in the case of a program or system crash, etc, etc.
-+ * Fairly detailed description of it can be had as part of the Qmail MTA
-+ * documentation, http://www.qmail.org/qmail-manual-html/man5/maildir.html.
-+ *
-+ * The general gist of the maildir approach is that mail is stored, one
-+ # message per file, in a subtree of ~/Maildir. New mail goes in /new,
-+ * the "spool" goes in /cur, and /tmp is available to MUAs &c. Mail is
-+ * theoretically supposed to be removed from /new immediately by the
-+ * MUA, but I've observed that with mutt 0.88, at least, it isn't if
-+ * the mailfile was generated by an import script (e.g. mbox2maildir)
-+ * rather than the normal delivery agent, presumably due to naming
-+ * differences.
-+ *
-+ * Checking for new mail mostly entails checking the mtime vs. atime of
-+ * every file in /new, and the number of messages in /new; if the latter
-+ * increases, new mail was delivered -- if not, but the files' atimes
-+ * are all later than their mtimes, the MUA read the /new spool.
-+ *
-+ * The specifications suggest skipping over every .file, but reading all
-+ * the others -- I've extended this to include skipping of all non-regular
-+ * files, which seemed to make sense -- define SUPPORT_MAILDIR_STRICTER to
-+ * override this behavior.
-+ *
-+ * This process is more resource-intensive than the old scheme of merely
-+ * calling stat() for a single file -- it's an O(n) rather than O(1)
-+ * operation.
-+ *
-+ */
- void cool_get_inboxstatus(char *filename, int *anymail, int *unreadmail,
- int *newmail)
- {
-***************
-*** 633,670 ****
- off_t newsize;
- struct stat st;
- int fd;
-
-- fd = open (filename, O_RDONLY, 0);
-- if (fd < 0)
-- {
-- *anymail = 0;
-- *newmail = 0;
-- *unreadmail = 0;
-- newsize = 0;
-- }
-- else
-- {
-- fstat(fd, &st);
-- close(fd);
-- newsize = st.st_size;
--
-- if (newsize > 0)
-- *anymail = 1;
-- else
-- *anymail = 0;
--
-- if (st.st_mtime >= st.st_atime && newsize > 0)
-- *unreadmail = 1;
-- else
-- *unreadmail = 0;
-
-! if (newsize > oldsize && *unreadmail)
-! *newmail = 1;
-! else
-! *newmail = 0;
-! }
-!
-! oldsize = newsize;
- }
-
- /*---------------------------------------------------------------------------*/
---- 682,800 ----
- off_t newsize;
- struct stat st;
- int fd;
-+ #ifdef SUPPORT_MAILDIR
-+ DIR *d;
-+ struct dirent *de;
-+ char maildir[256],mfn[256];
-+ #endif
-
-
-! #ifdef SUPPORT_MAILDIR_DEBUG
-! printf("B anymail=%d, newmail=%d, unreadmail=%d, oldsize=%d, newsize=%d\n",
-! *anymail,*newmail,*unreadmail,oldsize,newsize);
-! #endif
-! #ifdef SUPPORT_MAILDIR
-! if (stat(filename,&st)==-1) {
-! *anymail = *newmail = *unreadmail = 0;
-! newsize = oldsize = 0;
-! perror(filename);
-! return;
-! }
-! if (S_ISDIR(st.st_mode)) {
-! /* likely a maildir */
-! strcpy(maildir,filename);
-! if (maildir[strlen(maildir)-1]!='/')
-! strcat(maildir,"/");
-! strcat(maildir,"new");
-! if (stat(maildir,&st)==-1) {
-! perror(maildir);
-! printf("%s is not a maildir (missing/inaccessible %s)\n",filename,maildir);
-! *anymail = *newmail = *unreadmail = 0;
-! newsize = oldsize = 0;
-! return;
-! }
-! if (!S_ISDIR(st.st_mode)) {
-! printf("%s is not a directory (mode %d)\n",maildir,st.st_mode);
-! *anymail = *newmail = *unreadmail = 0;
-! newsize = oldsize = 0;
-! return;
-! }
-! d=opendir(maildir);
-! newsize=0;
-! *unreadmail = 0;
-! while ((de=readdir(d))) {
-! if (de->d_name[0]=='.') /* dotfiles ignored per the maildir specs */
-! continue;
-! strcpy(mfn,maildir);
-! if (mfn[strlen(mfn)-1]!='/')
-! strcat(mfn,"/");
-! strcat(mfn,de->d_name);
-! if (stat(mfn,&st)==-1) {
-! perror(mfn);
-! continue;
-! }
-! #ifndef SUPPORT_MAILDIR_STRICTER
-! if (S_ISREG(st.st_mode))
-! #endif
-! newsize++;
-! if (st.st_mtime>=st.st_atime) {
-! #ifdef SUPPORT_MAILDIR_DEBUG
-! printf("unread: %s mtime = %d, atime = %d\n",de->d_name,st.st_mtime,st.st_atime);
-! #endif
-! *unreadmail = 1;
-! }
-! }
-! closedir(d);
-! if (newsize) {
-! *anymail = 1;
-! if (newsize>oldsize && *unreadmail)
-! *newmail = 1;
-! else
-! *newmail = 0;
-! } else {
-! *anymail = *newmail = *unreadmail = 0;
-! newsize = 0;
-! }
-! #ifdef SUPPORT_MAILDIR_DEBUG
-! printf("A anymail=%d, newmail=%d, unreadmail=%d, oldsize=%d, newsize=%d\n",
-! *anymail,*newmail,*unreadmail,oldsize,newsize);
-! #endif
-! oldsize=newsize;
-! } else {
-! #endif /* SUPPORT_MAILDIR */
-! fd = open (filename, O_RDONLY, 0);
-! if (fd < 0)
-! {
-! *anymail = 0;
-! *newmail = 0;
-! *unreadmail = 0;
-! newsize = 0;
-! }
-! else
-! {
-! fstat(fd, &st);
-! close(fd);
-! newsize = st.st_size;
-!
-! if (newsize > 0)
-! *anymail = 1;
-! else
-! *anymail = 0;
-!
-! if (st.st_mtime >= st.st_atime && newsize > 0)
-! *unreadmail = 1;
-! else
-! *unreadmail = 0;
-!
-! if (newsize > oldsize && *unreadmail)
-! *newmail = 1;
-! else
-! *newmail = 0;
-! }
-! #ifdef SUPPORT_MAILDIR
-! }
-! #endif
-! oldsize = newsize;
- }
-
- /*---------------------------------------------------------------------------*/
diff --git a/mail/coolmail/files/patch-coolmail.c b/mail/coolmail/files/patch-coolmail.c
new file mode 100644
index 000000000000..5f9ff7356a74
--- /dev/null
+++ b/mail/coolmail/files/patch-coolmail.c
@@ -0,0 +1,287 @@
+--- coolmail.c.orig 1996-01-11 18:57:24.000000000 +0100
++++ coolmail.c 2009-04-08 09:14:08.000000000 +0200
+@@ -25,8 +25,10 @@
+ #include <sys/wait.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <dirent.h>
+ #include <fcntl.h>
+
++
+ #ifdef AUDIO
+ #include <string.h>
+ #endif
+@@ -34,14 +36,13 @@
+ #include "render1.h"
+ #include "mailbox.h"
+
+-#define DEFAULT_MAIL_DIR "/var/spool/mail/"
+-#define DEFAULT_COMMAND "xterm -n Elm -e mail\0"
++#define DEFAULT_MAIL_DIR "/var/mail/"
++
++#define DEFAULT_COMMAND "xterm -n Elm -e elm\0"
+ #define DEFAULT_INTERVAL 30
+ #define DEFAULT_FRAMES 15
+
+-#ifdef AUDIO
+ #define DEFAULT_VOLUME 50
+-#endif
+
+ #ifndef PI
+ #define PI 3.1415926536
+@@ -60,9 +61,9 @@
+ unsigned int frames = DEFAULT_FRAMES;
+ int verbose = 0;
+
++int cool_vol = DEFAULT_VOLUME;
+ #ifdef AUDIO
+ char *sndfile = NULL; /* default system sound */
+-int cool_vol = DEFAULT_VOLUME;
+ #endif
+
+ float flag_angle = 0.0;
+@@ -96,7 +97,9 @@
+ int main(int argc, char *argv[])
+ {
+ int reason;
++#ifndef NO_CUSERID
+ char username[L_cuserid];
++#endif
+
+ /* Quickly scan for the -h option -- if it is present don't do anything
+ * but print out some help and exit. */
+@@ -104,7 +107,18 @@
+ return(0);
+
+ /* Get the username and use it to create a default mailfile name */
+- strcat(mailfile_str, cuserid(username));
++#ifdef SUPPORT_MAILDIR
++ if (getenv("MAILDIR") && strlen(getenv("MAILDIR"))) {
++ strcpy(mailfile_str,getenv("MAILDIR"));
++ } else if (getenv("MAIL") && strlen(getenv("MAIL"))) {
++ strcpy(mailfile_str,getenv("MAIL"));
++ } else
++#endif
++#ifndef NO_CUSERID
++ strcat(mailfile_str, cuserid(username));
++#else
++ strcat(mailfile_str, getlogin());
++#endif
+
+ /* Initialize the renderer */
+ rend_init(&argc, argv, (float)150.0);
+@@ -379,7 +393,6 @@
+ {
+ verbose++;
+ }
+-#ifdef AUDIO
+ else if (!strcmp(argv[i], "-vol"))
+ {
+ i++;
+@@ -387,6 +400,7 @@
+ if (cool_vol < 0) cool_vol = 0;
+ else if (cool_vol > 100) cool_vol = 100;
+ }
++#ifdef AUDIO
+ else if (!strcmp(argv[i], "-af"))
+ {
+ i++;
+@@ -432,7 +446,7 @@
+ printf(" -e command Specifies a command (usually in quotes) which\n");
+ printf(" is used to invoke your favorite mail-reading\n");
+ printf(" program.\n\n");
+- printf(" -f filename Watch filename, instead of the default mail\n");
++ printf(" -f filename Watch filename/maildir, instead of the default mail\n");
+ printf(" file, %s<username>.\n\n", DEFAULT_MAIL_DIR);
+ printf(" -fr n Number of frames to generate for each animation.\n");
+ printf(" Set to an appropriate value for your machine's.\n");
+@@ -626,6 +640,39 @@
+
+ /* Get file modification time */
+
++
++/* Maildir notes (aqua@sonoma.net, Sun Jan 18 19:42:27 PST 1998):
++ *
++ * The maildir mail-storage standard is a replacement for the traditional
++ * 'mbox' format, intended to remove problems with file contention, locking,
++ * reduce corruption in the case of a program or system crash, etc, etc.
++ * Fairly detailed description of it can be had as part of the Qmail MTA
++ * documentation, http://www.qmail.org/qmail-manual-html/man5/maildir.html.
++ *
++ * The general gist of the maildir approach is that mail is stored, one
++ # message per file, in a subtree of ~/Maildir. New mail goes in /new,
++ * the "spool" goes in /cur, and /tmp is available to MUAs &c. Mail is
++ * theoretically supposed to be removed from /new immediately by the
++ * MUA, but I've observed that with mutt 0.88, at least, it isn't if
++ * the mailfile was generated by an import script (e.g. mbox2maildir)
++ * rather than the normal delivery agent, presumably due to naming
++ * differences.
++ *
++ * Checking for new mail mostly entails checking the mtime vs. atime of
++ * every file in /new, and the number of messages in /new; if the latter
++ * increases, new mail was delivered -- if not, but the files' atimes
++ * are all later than their mtimes, the MUA read the /new spool.
++ *
++ * The specifications suggest skipping over every .file, but reading all
++ * the others -- I've extended this to include skipping of all non-regular
++ * files, which seemed to make sense -- define SUPPORT_MAILDIR_STRICTER to
++ * override this behavior.
++ *
++ * This process is more resource-intensive than the old scheme of merely
++ * calling stat() for a single file -- it's an O(n) rather than O(1)
++ * operation.
++ *
++ */
+ void cool_get_inboxstatus(char *filename, int *anymail, int *unreadmail,
+ int *newmail)
+ {
+@@ -633,38 +680,119 @@
+ off_t newsize;
+ struct stat st;
+ int fd;
++#ifdef SUPPORT_MAILDIR
++ DIR *d;
++ struct dirent *de;
++ char maildir[256],mfn[256];
++#endif
+
+- fd = open (filename, O_RDONLY, 0);
+- if (fd < 0)
+- {
+- *anymail = 0;
+- *newmail = 0;
+- *unreadmail = 0;
+- newsize = 0;
+- }
+- else
+- {
+- fstat(fd, &st);
+- close(fd);
+- newsize = st.st_size;
+-
+- if (newsize > 0)
+- *anymail = 1;
+- else
+- *anymail = 0;
+-
+- if (st.st_mtime >= st.st_atime && newsize > 0)
+- *unreadmail = 1;
+- else
+- *unreadmail = 0;
+-
+- if (newsize > oldsize && *unreadmail)
+- *newmail = 1;
+- else
+- *newmail = 0;
+- }
+
+- oldsize = newsize;
++#ifdef SUPPORT_MAILDIR_DEBUG
++ printf("B anymail=%d, newmail=%d, unreadmail=%d, oldsize=%d, newsize=%d\n",
++ *anymail,*newmail,*unreadmail,oldsize,newsize);
++#endif
++#ifdef SUPPORT_MAILDIR
++ if (stat(filename,&st)==-1) {
++ *anymail = *newmail = *unreadmail = 0;
++ newsize = oldsize = 0;
++ perror(filename);
++ return;
++ }
++ if (S_ISDIR(st.st_mode)) {
++ /* likely a maildir */
++ strcpy(maildir,filename);
++ if (maildir[strlen(maildir)-1]!='/')
++ strcat(maildir,"/");
++ strcat(maildir,"new");
++ if (stat(maildir,&st)==-1) {
++ perror(maildir);
++ printf("%s is not a maildir (missing/inaccessible %s)\n",filename,maildir);
++ *anymail = *newmail = *unreadmail = 0;
++ newsize = oldsize = 0;
++ return;
++ }
++ if (!S_ISDIR(st.st_mode)) {
++ printf("%s is not a directory (mode %d)\n",maildir,st.st_mode);
++ *anymail = *newmail = *unreadmail = 0;
++ newsize = oldsize = 0;
++ return;
++ }
++ d=opendir(maildir);
++ newsize=0;
++ *unreadmail = 0;
++ while ((de=readdir(d))) {
++ if (de->d_name[0]=='.') /* dotfiles ignored per the maildir specs */
++ continue;
++ strcpy(mfn,maildir);
++ if (mfn[strlen(mfn)-1]!='/')
++ strcat(mfn,"/");
++ strcat(mfn,de->d_name);
++ if (stat(mfn,&st)==-1) {
++ perror(mfn);
++ continue;
++ }
++#ifndef SUPPORT_MAILDIR_STRICTER
++ if (S_ISREG(st.st_mode))
++#endif
++ newsize++;
++ if (st.st_mtime>=st.st_atime) {
++#ifdef SUPPORT_MAILDIR_DEBUG
++ printf("unread: %s mtime = %d, atime = %d\n",de->d_name,st.st_mtime,st.st_atime);
++#endif
++ *unreadmail = 1;
++ }
++ }
++ closedir(d);
++ if (newsize) {
++ *anymail = 1;
++ if (newsize>oldsize && *unreadmail)
++ *newmail = 1;
++ else
++ *newmail = 0;
++ } else {
++ *anymail = *newmail = *unreadmail = 0;
++ newsize = 0;
++ }
++#ifdef SUPPORT_MAILDIR_DEBUG
++ printf("A anymail=%d, newmail=%d, unreadmail=%d, oldsize=%d, newsize=%d\n",
++ *anymail,*newmail,*unreadmail,oldsize,newsize);
++#endif
++ oldsize=newsize;
++ } else {
++#endif /* SUPPORT_MAILDIR */
++ fd = open (filename, O_RDONLY, 0);
++ if (fd < 0)
++ {
++ *anymail = 0;
++ *newmail = 0;
++ *unreadmail = 0;
++ newsize = 0;
++ }
++ else
++ {
++ fstat(fd, &st);
++ close(fd);
++ newsize = st.st_size;
++
++ if (newsize > 0)
++ *anymail = 1;
++ else
++ *anymail = 0;
++
++ if (st.st_mtime >= st.st_atime && newsize > 0)
++ *unreadmail = 1;
++ else
++ *unreadmail = 0;
++
++ if (newsize > oldsize && *unreadmail)
++ *newmail = 1;
++ else
++ *newmail = 0;
++ }
++#ifdef SUPPORT_MAILDIR
++ }
++#endif
++ oldsize = newsize;
+ }
+
+ /*---------------------------------------------------------------------------*/
diff --git a/mail/coolmail/files/patch-coolmail.man b/mail/coolmail/files/patch-coolmail.man
new file mode 100644
index 000000000000..97e9b1112091
--- /dev/null
+++ b/mail/coolmail/files/patch-coolmail.man
@@ -0,0 +1,32 @@
+--- coolmail.man.orig 1996-01-11 18:57:28.000000000 +0100
++++ coolmail.man 2009-04-09 09:00:38.000000000 +0200
+@@ -37,12 +37,9 @@
+ Ring bell when new mail is first detected, but not when more new mail is
+ detected.
+ .TP 8
+--af filename
+-Specifies the audio file to use rather than the standard system beep.
+-.TP 8
+ -vol n
+-Value between 0 and 100 for the volume setting for both the system
+-beep and the sound file. The default is 50.
++Value between 0 and 100 for the volume setting for the system
++beep. The default is 50.
+ .TP 8
+ -v
+ Print version and inbox path.
+@@ -71,12 +68,9 @@
+ .B monochrome (\fPclass\fB Monochrome)
+ A Boolean value that enables monochrome mode when true.
+ .TP 8
+-.B soundFile (\fPclass \fB SoundFile)
+-Specifies the audio file to use rather than the standard system beep.
+-.TP 8
+ .B volume (\fPclass \fB Volume)
+-Value between 0 and 100 for the volume setting for both the system
+-beep and the sound file.
++Value between 0 and 100 for the volume setting for the system
++beep.
+ .SH COPYRIGHT
+ Copyright 1994
+
diff --git a/mail/coolmail/files/patch-display_list.c b/mail/coolmail/files/patch-display_list.c
new file mode 100644
index 000000000000..a2bebdd087ac
--- /dev/null
+++ b/mail/coolmail/files/patch-display_list.c
@@ -0,0 +1,46 @@
+--- coolmail-1.3/system/X11/display_list.c.orig 1996-01-11 19:14:30.000000000 +0100
++++ coolmail-1.3/system/X11/display_list.c 2009-04-08 09:14:08.000000000 +0200
+@@ -41,9 +41,9 @@
+ extern char mailfile_str[]; /* to obtain the command and mail file. */
+ extern unsigned int frames;
+
++extern int cool_vol;
+ #ifdef AUDIO
+ extern char *sndfile; /* same hack as above */
+-extern int cool_vol;
+ void audio_beep(void);
+ #endif
+
+@@ -156,9 +156,9 @@
+ #ifdef AUDIO
+ XtResource soundfile = {"soundFile", "SoundFile", XtRString,
+ sizeof(str), 0, XtRString, sndfile};
++#endif
+ XtResource volume = {"volume", "Volume", XtRInt,
+ sizeof(cool_vol), 0, XtRInt, &cool_vol};
+-#endif
+
+ XtGetApplicationResources(toplevel, &str, &mailcmd, 1, NULL, 0);
+ strcpy(command_str, str);
+@@ -175,11 +175,11 @@
+ XtGetApplicationResources(toplevel, &str, &soundfile, 1, NULL, 0);
+ if(str)
+ sndfile = (char *)strdup(str);
++#endif
+
+ XtGetApplicationResources(toplevel, &cool_vol, &volume, 1, NULL, 0);
+ if (cool_vol < 0) cool_vol = 0;
+ else if (cool_vol > 100) cool_vol = 100;
+-#endif
+
+ }
+
+@@ -308,7 +308,7 @@
+ else /* no sound file chosen then use system bell */
+ XBell(XtDisplay(main_gfx_w), cool_vol);
+ #else
+- XBell(XtDisplay(main_gfx_w), 50);
++ XBell(XtDisplay(main_gfx_w), cool_vol);
+ #endif
+ }
+