2 ** Copyright 2002-2009 Double Precision, Inc. See COPYING for
3 ** distribution information.
7 #include "courier_auth_config.h"
22 int auth_getoptionenvint(const char *keyword
)
24 char *p
= auth_getoptionenv(keyword
);
31 if (i
== 0 && strchr("tTyY", *p
))
32 i
=1; /* Convert 'true', 'TRUE', 'yes', 'YES' to 1 */
37 char *auth_getoptionenv(const char *keyword
)
39 return auth_getoption(getenv("OPTIONS"), keyword
);
42 char *auth_getoption(const char *options
, const char *keyword
)
44 size_t keyword_l
=strlen(keyword
);
49 if (strncmp(options
, keyword
, keyword_l
) == 0)
51 if (options
[keyword_l
] == 0 ||
52 options
[keyword_l
] == ',')
55 if (options
[keyword_l
] == '=')
62 options
[keyword_l
] != ',';
66 if (!(p
=malloc(keyword_l
+1)))
68 memcpy(p
, options
, keyword_l
);
74 options
=strchr(options
, ',');