Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "rtl/ustring.hxx"
21 : #include "uno/environment.h"
22 : #include "env_subst.hxx"
23 :
24 :
25 14664 : CPPU_DLLPUBLIC void SAL_CALL uno_getEnvironment(uno_Environment ** ppEnv,
26 : rtl_uString * pEnvDcp,
27 : void * pContext)
28 : SAL_THROW_EXTERN_C()
29 : {
30 14664 : rtl::OUString envDcp(pEnvDcp);
31 :
32 14664 : rtl::OString a_envName("UNO_ENV_SUBST:");
33 14664 : a_envName += rtl::OUStringToOString(envDcp, RTL_TEXTENCODING_ASCII_US);
34 14664 : char * c_value = getenv(a_envName.getStr());
35 14664 : if (c_value && *c_value)
36 : {
37 0 : rtl::OString a_envDcp(a_envName.copy(a_envName.indexOf(':') + 1));
38 :
39 : OSL_TRACE("UNO_ENV_SUBST \"%s\" -> \"%s\"", a_envDcp.getStr(), c_value);
40 :
41 0 : envDcp = rtl::OUString::createFromAscii(c_value);
42 : }
43 :
44 14664 : uno_direct_getEnvironment(ppEnv, envDcp.pData, pContext);
45 14664 : }
46 :
47 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|