summaryrefslogtreecommitdiffstats
path: root/pcp/pcpacl.c
blob: ff40b76dab6c7f9ca118b3e3b374d15e3454174e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
** Copyright 2001 Double Precision, Inc.  See COPYING for
** distribution information.
*/


#include "config.h"
#include <stdlib.h>
#include <string.h>
#include "pcp.h"

void pcp_acl_name(int flags, char *buf)
{
#define NAME(n,s) if (flags & (n)) {if (*buf) strcat(buf, " "); strcat(buf,s);}

	NAME(PCP_ACL_MODIFY, "MODIFY");
	NAME(PCP_ACL_CONFLICT, "CONFLICT");
	NAME(PCP_ACL_LIST, "LIST");
	NAME(PCP_ACL_RETR, "RETR");
	NAME(PCP_ACL_NONE, "NONE");
#undef NAME
}

int pcp_acl_num(const char *c)
{
#define NAME(n,s) if (strcasecmp(c, s) == 0) return (n)

	NAME(PCP_ACL_MODIFY, "MODIFY");
	NAME(PCP_ACL_CONFLICT, "CONFLICT");
	NAME(PCP_ACL_LIST, "LIST");
	NAME(PCP_ACL_RETR, "RETR");
	NAME(PCP_ACL_NONE, "NONE");
#undef NAME
	return (0);
}