Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id CC98C431FBC for ; Wed, 25 Nov 2009 13:21:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zTueoMskyLu4 for ; Wed, 25 Nov 2009 13:21:27 -0800 (PST) Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.148]) by olra.theworths.org (Postfix) with ESMTP id 76EF2431FAE for ; Wed, 25 Nov 2009 13:21:27 -0800 (PST) Received: by ey-out-1920.google.com with SMTP id 4so1524624eyg.6 for ; Wed, 25 Nov 2009 13:21:26 -0800 (PST) Received: by 10.216.87.80 with SMTP id x58mr2802803wee.92.1259184086458; Wed, 25 Nov 2009 13:21:26 -0800 (PST) Received: from x61s.janakj ([213.192.30.141]) by mx.google.com with ESMTPS id 5sm3703154eyf.8.2009.11.25.13.21.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 13:21:25 -0800 (PST) Received: by x61s.janakj (Postfix, from userid 1000) id 6242C440655; Wed, 25 Nov 2009 22:21:24 +0100 (CET) Date: Wed, 25 Nov 2009 22:21:24 +0100 From: Jan Janak To: Scott Robinson Message-ID: <20091125212124.GE25119@ryngle.com> References: <1259178195-30324-1-git-send-email-jan@ryngle.com> <1259179778-sup-5382@lisa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1259179778-sup-5382@lisa> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: notmuch Subject: Re: [notmuch] [PATCH] notmuch-new: Test if directory looks like Maildir before skipping tmp. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 21:21:28 -0000 On 25-11 12:12, Scott Robinson wrote: > Excerpts from Jan Janak's message of Wed Nov 25 11:43:15 -0800 2009: > > +/* Test if the directory looks like a Maildir directory. > > + * > > + * Search through the array of directory entries to see if we can find all > > + * three subdirectories typical for Maildir, that is "new", "cur", and "tmp". > > + * > > + * Return 1 if the directory looks like a Maildir and 0 otherwise. > > + */ > > +static int is_maildir (struct dirent **entries, int count) > > +{ > > + int i, found = 0; > > + > > + for (i = 0; i < count; i++) { > > + if (entries[i]->d_type != DT_DIR) continue; > > + if (strcmp(entries[i]->d_name, "new") == 0 || > > + strcmp(entries[i]->d_name, "cur") == 0 || > > + strcmp(entries[i]->d_name, "tmp") == 0) > > + { > > + found++; > > + } > > + } > > + > > + return found >= 3; > > +} > > Maybe put the "found >= 3" in the for loop's stop-condition? You are right, of course. Resubmitted, thanks a lot! -- Jan