aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/init.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-11 01:01:38 +0000
committerlloyd <[email protected]>2008-11-11 01:01:38 +0000
commit88f4327ef993dfc15f1483e14df042a83bb459b7 (patch)
tree98782cb2f6af3a7fb7c864552c93ecae16ddcaf1 /src/libstate/init.cpp
parent5e340b886319bb21f269520af2d62789df3467d4 (diff)
Change LibraryInitializer back to accepting a std::string for backwards
compatability.
Diffstat (limited to 'src/libstate/init.cpp')
-rw-r--r--src/libstate/init.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/libstate/init.cpp b/src/libstate/init.cpp
index 0256d70dc..890871411 100644
--- a/src/libstate/init.cpp
+++ b/src/libstate/init.cpp
@@ -4,6 +4,7 @@
*/
#include <botan/init.h>
+#include <botan/parsing.h>
#include <botan/libstate.h>
namespace Botan {
@@ -11,8 +12,37 @@ namespace Botan {
/*************************************************
* Library Initialization *
*************************************************/
-void LibraryInitializer::initialize(bool thread_safe)
+void LibraryInitializer::initialize(const std::string& arg_string)
{
+ bool thread_safe = true;
+
+ const std::vector<std::string> arg_list = split_on(arg_string, ' ');
+ for(u32bit j = 0; j != arg_list.size(); ++j)
+ {
+ if(arg_list[j].size() == 0)
+ continue;
+
+ std::string name, value;
+
+ if(arg_list[j].find('=') == std::string::npos)
+ {
+ name = arg_list[j];
+ value = "true";
+ }
+ else
+ {
+ std::vector<std::string> name_and_value = split_on(arg_list[j], '=');
+ name = name_and_value[0];
+ value = name_and_value[1];
+ }
+
+ bool is_on =
+ (value == "1" || value == "true" || value == "yes" || value == "on");
+
+ if(name == "thread_safe")
+ thread_safe = is_on;
+ }
+
try
{
/*