#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; } // string to set environment from std::string tmp; if ( key == "VERBOSE" ) { tmp = "SAGA_VERBOSE=" + val; } else if ( key == "HOME" ) { tmp = "SAGA_SHELL_HOME=" + val; } else if ( key == "CONTACT" ) { tmp = "SAGA_SHELL_CONTACT=" + val; } else { tmp = key + "=" + val; } // set new environment char* env = ::strdup (tmp.c_str ()); ::putenv (env); // update shell settings with new environment init (); return; }