diff options
author | robot-contrib <[email protected]> | 2025-05-14 06:53:03 +0300 |
---|---|---|
committer | robot-contrib <[email protected]> | 2025-05-14 07:05:42 +0300 |
commit | 286dbc77293811055ff4f9303cd376eff9e50104 (patch) | |
tree | a50eea3eb2b824c7c68e15b4cc3e127731776d32 /contrib/restricted/aws/aws-c-common/source/posix/environment.c | |
parent | 0bf9db6399352012396e7791bcfd762e944b33c2 (diff) |
Update contrib/restricted/aws/aws-c-common to 0.12.2
commit_hash:fc6e67f9b12b0b888c90bb97bf2b1cbfcd74a044
Diffstat (limited to 'contrib/restricted/aws/aws-c-common/source/posix/environment.c')
-rw-r--r-- | contrib/restricted/aws/aws-c-common/source/posix/environment.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/environment.c b/contrib/restricted/aws/aws-c-common/source/posix/environment.c index f4b69caea25..ba1f8bb4425 100644 --- a/contrib/restricted/aws/aws-c-common/source/posix/environment.c +++ b/contrib/restricted/aws/aws-c-common/source/posix/environment.c @@ -8,6 +8,26 @@ #include <aws/common/string.h> #include <stdlib.h> +struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name) { + + const char *value = getenv(name); + if (value == NULL) { + return NULL; + } + + return aws_string_new_from_c_str(allocator, value); +} + +struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name) { + + const char *value = getenv(name); + if (value == NULL || value[0] == '\0') { + return NULL; + } + + return aws_string_new_from_c_str(allocator, value); +} + int aws_get_environment_value( struct aws_allocator *allocator, const struct aws_string *variable_name, |