2 ** Copyright 2002-2009 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
20 static const char rcsid
[]="$Id: authoption.c,v 1.4 2009/11/22 03:42:48 mrsam Exp $";
23 int auth_getoptionenvint(const char *keyword
)
25 char *p
= auth_getoptionenv(keyword
);
32 if (i
== 0 && strchr("tTyY", *p
))
33 i
=1; /* Convert 'true', 'TRUE', 'yes', 'YES' to 1 */
38 char *auth_getoptionenv(const char *keyword
)
40 return auth_getoption(getenv("OPTIONS"), keyword
);
43 char *auth_getoption(const char *options
, const char *keyword
)
45 size_t keyword_l
=strlen(keyword
);
50 if (strncmp(options
, keyword
, keyword_l
) == 0)
52 if (options
[keyword_l
] == 0 ||
53 options
[keyword_l
] == ',')
56 if (options
[keyword_l
] == '=')
63 options
[keyword_l
] != ',';
67 if (!(p
=malloc(keyword_l
+1)))
69 memcpy(p
, options
, keyword_l
);
75 options
=strchr(options
, ',');