unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jan Janak <jan@ryngle.com>
To: Scott Robinson <scott@quadhome.com>
Cc: notmuch <notmuch@notmuchmail.org>
Subject: Re: [PATCH] notmuch-new: Test if directory looks like	Maildir before skipping tmp.
Date: Wed, 25 Nov 2009 22:21:24 +0100	[thread overview]
Message-ID: <20091125212124.GE25119@ryngle.com> (raw)
In-Reply-To: <1259179778-sup-5382@lisa>

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

  reply	other threads:[~2009-11-25 21:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 19:43 [PATCH] notmuch-new: Test if directory looks like Maildir before skipping tmp Jan Janak
2009-11-25 20:12 ` Scott Robinson
2009-11-25 21:21   ` Jan Janak [this message]
2009-11-25 21:11 ` Jan Janak
2009-11-28  3:41   ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091125212124.GE25119@ryngle.com \
    --to=jan@ryngle.com \
    --cc=notmuch@notmuchmail.org \
    --cc=scott@quadhome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).