summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/os_posix/os_getenv.c
blob: 5a8bb067361a02dbf8a357dbdf860e847871af3f (plain)
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
/*-
 * Copyright (c) 2014-present MongoDB, Inc.
 * Copyright (c) 2008-2014 WiredTiger, Inc.
 *	All rights reserved.
 *
 * See the file LICENSE for redistribution information.
 */

#include "wt_internal.h"

/*
 * __wt_getenv --
 *     Get a non-NULL, greater than zero-length environment variable.
 */
int
__wt_getenv(WT_SESSION_IMPL *session, const char *variable, const char **envp)
  WT_GCC_FUNC_ATTRIBUTE((visibility("default")))
{
    const char *temp;

    *envp = NULL;

    if (((temp = getenv(variable)) != NULL) && strlen(temp) > 0)
        return (__wt_strdup(session, temp, envp));

    return (0);
}