diff -ruN ./dbmail-1.2.7b/raw-convert.c ./dbmail-1.2.7b-patch/raw-convert.c
--- ./dbmail-1.2.7b/raw-convert.c	2004-01-04 13:33:44.000000000 -0600
+++ ./dbmail-1.2.7b-patch/raw-convert.c	2004-05-10 14:29:20.773157000 -0600
@@ -23,6 +23,11 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
+
+#if sun
+#include "scandir.h"
+#endif
+
 #include <dirent.h>
 #include <time.h>
 #include <unistd.h>
diff -ruN ./dbmail-1.2.7b/scandir.h ./dbmail-1.2.7b-patch/scandir.h
--- ./dbmail-1.2.7b/scandir.h	1969-12-31 18:00:00.000000000 -0600
+++ ./dbmail-1.2.7b-patch/scandir.h	2004-05-10 14:28:46.846739000 -0600
@@ -0,0 +1,66 @@
+/*******************************************************************************
+*                                                                              *
+*                                   Viewmol                                    *
+*                                                                              *
+*                              S C A N D I R . H                               *
+*                                                                              *
+*                 Copyright (c) Joerg-R. Hill, December 2000                   *
+*                                                                              *
+********************************************************************************
+*
+* $Id: scandir.c,v 1.2 2000/12/10 15:37:02 jrh Exp $
+* $Log: scandir.c,v $
+* Revision 1.2  2000/12/10 15:37:02  jrh
+* Release 2.3
+*
+* Revision 1.1  1999/05/24 01:29:43  jrh
+* Initial revision
+*
+*/
+#include<dirent.h>
+#include<stdlib.h>
+#include<string.h>
+#include<sys/types.h>
+
+/* This function is only required for SunOS, all other supported OS
+   have this function in their system library */
+
+int scandir(const char *dir, struct dirent ***namelist,
+            int (*select)(const struct dirent *),
+            int (*compar)(const struct dirent **, const struct dirent **))
+{
+  DIR *d;
+  struct dirent *entry;
+  register int i=0;
+  size_t entrysize;
+
+  if ((d=opendir(dir)) == NULL)
+     return(-1);
+
+  *namelist=NULL;
+  while ((entry=readdir(d)) != NULL)
+  {
+    if (select == NULL || (select != NULL && (*select)(entry)))
+    {
+      *namelist=(struct dirent **)realloc((void *)(*namelist),
+                 (size_t)((i+1)*sizeof(struct dirent *)));
+	if (*namelist == NULL) return(-1);
+	entrysize=sizeof(struct dirent)-sizeof(entry->d_name)+strlen(entry->d_name)+1;
+	(*namelist)[i]=(struct dirent *)malloc(entrysize);
+	if ((*namelist)[i] == NULL) return(-1);
+	memcpy((*namelist)[i], entry, entrysize);
+	i++;
+    }
+  }
+  if (closedir(d)) return(-1);
+  if (i == 0) return(-1);
+  if (compar != NULL)
+    qsort((void *)(*namelist), (size_t)i, sizeof(struct dirent *), compar);
+    
+  return(i);
+}
+
+int alphasort(const struct dirent **a, const struct dirent **b)
+{
+  return(strcmp((*a)->d_name, (*b)->d_name));
+}
