Back to index

courier  0.68.2
pcpacl.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2001 Double Precision, Inc.  See COPYING for
00003 ** distribution information.
00004 */
00005 
00006 
00007 #include "config.h"
00008 #include <stdlib.h>
00009 #include <string.h>
00010 #include "pcp.h"
00011 
00012 void pcp_acl_name(int flags, char *buf)
00013 {
00014 #define NAME(n,s) if (flags & (n)) {if (*buf) strcat(buf, " "); strcat(buf,s);}
00015 
00016        NAME(PCP_ACL_MODIFY, "MODIFY");
00017        NAME(PCP_ACL_CONFLICT, "CONFLICT");
00018        NAME(PCP_ACL_LIST, "LIST");
00019        NAME(PCP_ACL_RETR, "RETR");
00020        NAME(PCP_ACL_NONE, "NONE");
00021 #undef NAME
00022 }
00023 
00024 int pcp_acl_num(const char *c)
00025 {
00026 #define NAME(n,s) if (strcasecmp(c, s) == 0) return (n)
00027 
00028        NAME(PCP_ACL_MODIFY, "MODIFY");
00029        NAME(PCP_ACL_CONFLICT, "CONFLICT");
00030        NAME(PCP_ACL_LIST, "LIST");
00031        NAME(PCP_ACL_RETR, "RETR");
00032        NAME(PCP_ACL_NONE, "NONE");
00033 #undef NAME
00034        return (0);
00035 }
00036