summaryrefslogtreecommitdiff
path: root/src/os_posix/os_getenv.c
blob: f779f90aceeef79b3a4daf916239c810d7601ec3 (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-2016 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 (WT_NOTFOUND);
}