File: environment.h

package info (click to toggle)
aws-crt-python 0.28.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,428 kB
  • sloc: ansic: 437,955; python: 27,657; makefile: 5,855; sh: 4,289; ruby: 208; java: 82; perl: 73; cpp: 25; xml: 11
file content (65 lines) | stat: -rw-r--r-- 1,858 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef AWS_COMMON_ENVIRONMENT_H
#define AWS_COMMON_ENVIRONMENT_H

/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/common/common.h>

AWS_PUSH_SANE_WARNING_LEVEL

struct aws_string;

/*
 * Simple shims to the appropriate platform calls for environment variable manipulation.
 *
 * Not thread safe to use set/unset unsynced with get.  Set/unset only used in unit tests.
 */
AWS_EXTERN_C_BEGIN

/*
 * Get the value of an environment variable.  If the variable is not set, the output string will be set to NULL.
 * Not thread-safe
 */
AWS_COMMON_API
struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name);

/*
 * Get the value of an environment variable.  If the variable is not set or is empty, the output string will be set to
 * NULL. Not thread-safe
 */
AWS_COMMON_API
struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name);

/*
 * *DEPRECATED*
 * Please use the `aws_get_env` or `aws_get_env_nonempty` instead.
 * Get the value of an environment variable.  If the variable is not set, the output string will be set to NULL.
 * Not thread-safe
 */
AWS_COMMON_API
int aws_get_environment_value(
    struct aws_allocator *allocator,
    const struct aws_string *variable_name,
    struct aws_string **value_out);

/*
 * Set the value of an environment variable.  On Windows, setting a variable to the empty string will actually unset it.
 * Not thread-safe
 */
AWS_COMMON_API
int aws_set_environment_value(const struct aws_string *variable_name, const struct aws_string *value);

/*
 * Unset an environment variable.
 * Not thread-safe
 */
AWS_COMMON_API
int aws_unset_environment_value(const struct aws_string *variable_name);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_ENVIRONMENT_H */