summaryrefslogtreecommitdiff
path: root/kernel/source/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/source/application.cpp')
-rw-r--r--kernel/source/application.cpp37
1 files changed, 35 insertions, 2 deletions
diff --git a/kernel/source/application.cpp b/kernel/source/application.cpp
index 6df49cd..cd76bd9 100644
--- a/kernel/source/application.cpp
+++ b/kernel/source/application.cpp
@@ -90,9 +90,42 @@ namespace hilbert::kernel::application {
delete memory; //:p
}
- void process::add_environment_variable(
+ process::string_pair *process::find_environment_variable(
+ const utility::string &name) {
+
+ for (auto *n = environment_variables.first; n; n = n->next)
+ if (n->value.a == name)
+ return &n->value;
+
+ return 0;
+
+ }
+
+ void process::set_environment_variable(
utility::string &&name, utility::string &&value) {
- environment_variables.insert_end({.a = name, .b = value});
+
+ auto *sp = find_environment_variable(name);
+ if (sp)
+ sp->b = utility::move(value);
+ else
+ environment_variables.insert_end({
+ .a = utility::move(name),
+ .b = utility::move(value)
+ });
+
+ }
+
+ void process::set_environment_variable(
+ const utility::string &name, const utility::string &value) {
+
+ auto *sp = find_environment_variable(name);
+ if (sp)
+ sp->b = value;
+ else
+ environment_variables.insert_end({
+ .a = name, .b = value
+ });
+
}
utility::string *process::get_environment_variable(