diff options
author | Benji Dial <benji@benjidial.net> | 2024-07-31 17:16:21 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-07-31 17:16:21 -0400 |
commit | e6915fb6dd715e39e37702a6d69c220c0f1798bf (patch) | |
tree | 2e3b59335f70f2725802d254168ceaee85faf891 /kernel/source/application.cpp | |
parent | b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e (diff) | |
download | hilbert-os-e6915fb6dd715e39e37702a6d69c220c0f1798bf.tar.gz |
remove argc, argv; arguments will be passed via environment variables
Diffstat (limited to 'kernel/source/application.cpp')
-rw-r--r-- | kernel/source/application.cpp | 37 |
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( |