[notmuch] [PATCH] notmuch-new: Test if directory looks like Maildir before skipping tmp.
Jan Janak
jan at ryngle.com
Wed Nov 25 13:21:24 PST 2009
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
More information about the notmuch
mailing list