summaryrefslogtreecommitdiffstats
path: root/maildir/maildirflags.c
blob: ef168acc93d949327dc751a966fedf7a7dec18ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
** Copyright 2000-2002 Double Precision, Inc.
** See COPYING for distribution information.
*/

#include	"config.h"
#include	<sys/types.h>
#include	<string.h>


int maildir_hasflag(const char *filename, char flag)
{
	const char *p=strrchr(filename, '/');

	if (p)
		filename=p+1;

	p=strrchr(filename, MDIRSEP[0]);
	if (p && strncmp(p, MDIRSEP "2,", 3) == 0 &&
	    strchr(p+3, flag))
		return (1);
	return (0);
}