summaryrefslogtreecommitdiff
path: root/src/os_posix/os_getenv.c
blob: 7a086145ceeae9135c251d833441bf1c2859c7ef (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
/*-
 * 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)
{
	const char *temp;

	*envp = NULL;

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

	return (WT_NOTFOUND);
}