--- /dev/null
+Return-Path: <Vladimir.Marek@oracle.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id CFC2A414B9A\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 09:32:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -4.999\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-4.999 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_HI=-5, UNPARSEABLE_RELAY=0.001]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id wdaL3BgPyLhz for <notmuch@notmuchmail.org>;\r
+ Mon, 9 Apr 2012 09:32:48 -0700 (PDT)\r
+X-Greylist: delayed 22445 seconds by postgrey-1.32 at olra;\r
+ Mon, 09 Apr 2012 09:32:48 PDT\r
+Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D188C414B96\r
+ for <notmuch@notmuchmail.org>; Mon, 9 Apr 2012 09:32:48 -0700 (PDT)\r
+Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])\r
+ by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with\r
+ ESMTP id q39GWkbT015218\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
+ Mon, 9 Apr 2012 16:32:47 GMT\r
+Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158])\r
+ by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
+ q39GWjGr020006\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\r
+ Mon, 9 Apr 2012 16:32:45 GMT\r
+Received: from abhmt106.oracle.com (abhmt106.oracle.com [141.146.116.58])\r
+ by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id\r
+ q39GWiHW028104; Mon, 9 Apr 2012 11:32:44 -0500\r
+Received: from pub.czech.sun.com (/10.163.20.32)\r
+ by default (Oracle Beehive Gateway v4.0)\r
+ with ESMTP ; Mon, 09 Apr 2012 09:32:44 -0700\r
+From: Vladimir.Marek@oracle.com\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] dirent->d_type not available on Soalris\r
+Date: Mon, 9 Apr 2012 18:32:07 +0200\r
+Message-Id: <1333989127-21523-1-git-send-email-Vladimir.Marek@oracle.com>\r
+X-Mailer: git-send-email 1.7.3.2\r
+In-Reply-To:\r
+ <CAMoJFUvHbSfXLTGKf2ZZnaLpLzZiHJ7W_ZUYZzm70n5mw4r1Kg@mail.gmail.com>\r
+References:\r
+ <CAMoJFUvHbSfXLTGKf2ZZnaLpLzZiHJ7W_ZUYZzm70n5mw4r1Kg@mail.gmail.com>\r
+X-Source-IP: acsinet22.oracle.com [141.146.126.238]\r
+X-CT-RefId: str=0001.0A090203.4F830F30.0012,ss=1,re=0.000,fgs=0\r
+Cc: Vladimir Marek <vlmarek@volny.cz>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 09 Apr 2012 16:32:50 -0000\r
+\r
+From: Vladimir Marek <vlmarek@volny.cz>\r
+\r
+The inspiration was taken from similar issue in mutt:\r
+http://does-not-exist.org/mail-archives/mutt-dev/msg11290.html\r
+\r
+Signed-off-by: Vladimir Marek <vlmarek@volny.cz>\r
+---\r
+ notmuch-new.c | 28 ++++++++++++++++++++++++++++\r
+ 1 files changed, 28 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 4f13535..3d265bd 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -21,6 +21,9 @@\r
+ #include "notmuch-client.h"\r
+ \r
+ #include <unistd.h>\r
++#ifndef _DIRENT_HAVE_D_TYPE\r
++#include <sys/types.h>\r
++#endif\r
+ \r
+ typedef struct _filename_node {\r
+ char *filename;\r
+@@ -167,7 +170,14 @@ _entries_resemble_maildir (struct dirent **entries, int count)\r
+ int i, found = 0;\r
+ \r
+ for (i = 0; i < count; i++) {\r
++#ifdef _DIRENT_HAVE_D_TYPE\r
+ if (entries[i]->d_type != DT_DIR && entries[i]->d_type != DT_UNKNOWN)\r
++#else\r
++ struct stat statbuf;\r
++ if (stat(entries[i]->d_name, &statbuf) == -1)\r
++ continue;\r
++ if (! S_ISDIR(statbuf.st_mode))\r
++#endif\r
+ continue;\r
+ \r
+ if (strcmp(entries[i]->d_name, "new") == 0 ||\r
+@@ -258,6 +268,9 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+ struct stat st;\r
+ notmuch_bool_t is_maildir, new_directory;\r
+ const char **tag;\r
++#ifndef _DIRENT_HAVE_D_TYPE\r
++ struct stat statbuf;\r
++#endif\r
+ \r
+ if (stat (path, &st)) {\r
+ fprintf (stderr, "Error reading directory %s: %s\n",\r
+@@ -328,9 +341,16 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+ * scandir results, then it might be a directory (and if not,\r
+ * then we'll stat and return immediately in the next level of\r
+ * recursion). */\r
++#ifdef _DIRENT_HAVE_D_TYPE\r
+ if (entry->d_type != DT_DIR &&\r
+ entry->d_type != DT_LNK &&\r
+ entry->d_type != DT_UNKNOWN)\r
++#else\r
++ if (stat(entry->d_name, &statbuf) == -1)\r
++ continue;\r
++ if (!(statbuf.st_mode & S_IFDIR) &&\r
++ !(statbuf.st_mode & S_IFLNK))\r
++#endif\r
+ {\r
+ continue;\r
+ }\r
+@@ -427,7 +447,11 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+ *\r
+ * In either case, a stat does the trick.\r
+ */\r
++#ifdef _DIRENT_HAVE_D_TYPE\r
+ if (entry->d_type == DT_LNK || entry->d_type == DT_UNKNOWN) {\r
++#else\r
++ if (stat(entry->d_name, &statbuf) == -1 || statbuf.st_mode & S_IFLNK) {\r
++#endif\r
+ int err;\r
+ \r
+ next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);\r
+@@ -443,7 +467,11 @@ add_files_recursive (notmuch_database_t *notmuch,\r
+ \r
+ if (! S_ISREG (st.st_mode))\r
+ continue;\r
++#ifdef _DIRENT_HAVE_D_TYPE\r
+ } else if (entry->d_type != DT_REG) {\r
++#else\r
++ } else if (statbuf.st_mode & S_IFREG) {\r
++#endif\r
+ continue;\r
+ }\r
+ \r
+-- \r
+1.7.3.2\r
+\r