07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync/* $Id$ */
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync/** @file
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync * kHlpEnv - Environment Manipulation, IPRT based implementation.
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync */
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2007-2010 Oracle Corporation
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync *
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync * available from http://www.virtualbox.org. This file is free software;
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync */
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync/*******************************************************************************
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync* Header Files *
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync*******************************************************************************/
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync#include <k/kHlpEnv.h>
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync#include <k/kErrors.h>
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync#include <iprt/env.h>
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync#include <iprt/assert.h>
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync#include <iprt/err.h>
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsyncKHLP_DECL(int) kHlpGetEnv(const char *pszVar, char *pszVal, KSIZE cchVal)
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync{
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync int rc = RTEnvGetEx(RTENV_DEFAULT, pszVar, pszVal, cchVal, NULL);
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync switch (rc)
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync {
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync case VINF_SUCCESS: return 0;
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync case VERR_ENV_VAR_NOT_FOUND: return KERR_ENVVAR_NOT_FOUND;
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync case VERR_BUFFER_OVERFLOW: return KERR_BUFFER_OVERFLOW;
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync default: AssertMsgFailedReturn(("%Rrc\n", rc), rc);
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync }
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync}
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync
07ca5489e6fa49b415eb5e0e42567833699a9e57vboxsync