// Copyright (c) 2005-2007 Andre Merzky (andre@merzky.net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include "shell.hpp" void shell::c_set (std::string args) { std::string key = args; std::string val = args; size_t idx = args.find (" "); if ( idx != 0 && idx != std::string::npos ) { key.erase (idx); val.erase (0, idx + 1); } else { carp ("format: set "); return; } if ( key != "verbose" ) { carp ("Unknown setting: " + key); return; } std::string tmp; if ( key == "verbose" ) { tmp = "SAGA_VERBOSE"; tmp += "="; tmp += val; } char* env = ::strdup (tmp.c_str ()); if (NULL == env) { throw std::bad_alloc("Out of memory during strdup"); } ::putenv (env); return; }