merged tag ooo/OOO330_m14
[LibreOffice.git] / soldep / bootstrp / appdef.cxx
blob8ce7778887819f67b141c903b56cd54f824502a1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include <stdlib.h>
29 #include <stdio.h>
30 #include <string.h>
32 #include <appdef.hxx>
34 const char* GetDefStandList()
36 char* pRet;
37 char* pEnv = getenv("STAR_STANDLST");
38 if ( pEnv )
40 int nLen = strlen( pEnv );
41 pRet = ( char *) malloc( nLen + 1 );
42 (void) strcpy( pRet, pEnv );
44 else
46 int nLen = strlen( _DEF_STAND_LIST );
47 pRet = ( char *) malloc( nLen + 1 );
48 (void) strcpy( pRet, _DEF_STAND_LIST );
50 return pRet;
54 const char* GetIniRoot()
56 char* pRet;
57 char* pEnv = getenv("STAR_INIROOT");
58 if ( pEnv )
60 int nLen = strlen( pEnv );
61 pRet = ( char *) malloc( nLen + 1 );
62 (void) strcpy( pRet, pEnv );
64 else
66 int nLen = strlen( _INIROOT );
67 pRet = ( char *) malloc( nLen + 1 );
68 (void) strcpy( pRet, _INIROOT );
70 return pRet;
73 const char* GetIniRootOld()
75 char* pRet;
76 char* pEnv = getenv("STAR_INIROOTOLD");
77 if ( pEnv )
79 int nLen = strlen( pEnv );
80 pRet = ( char *) malloc( nLen + 1 );
81 (void) strcpy( pRet, pEnv );
83 else
85 int nLen = strlen( _INIROOT_OLD );
86 pRet = ( char *) malloc( nLen + 1 );
87 (void) strcpy( pRet, _INIROOT_OLD );
89 return pRet;
92 const char* GetSSolarIni()
94 char* pRet;
95 char* pEnv = getenv("STAR_SSOLARINI");
96 if ( pEnv )
98 int nLen = strlen( pEnv );
99 pRet = ( char *) malloc( nLen + 1 );
100 (void) strcpy( pRet, pEnv );
102 else
104 int nLen = strlen( _DEF_SSOLARINI );
105 pRet = ( char *) malloc( nLen + 1 );
106 (void) strcpy( pRet, _DEF_SSOLARINI );
108 return pRet;
112 const char* GetSSCommon()
114 char* pRet;
115 char* pEnv = getenv("STAR_SSCOMMON");
116 if ( pEnv )
118 int nLen = strlen( pEnv );
119 pRet = ( char *) malloc( nLen + 1 );
120 (void) strcpy( pRet, pEnv );
122 else
124 int nLen = strlen( _DEF_SSCOMMON );
125 pRet = ( char *) malloc( nLen + 1 );
126 (void) strcpy( pRet, _DEF_SSCOMMON );
128 return pRet;
132 const char* GetBServerRoot()
134 char* pRet;
135 char* pEnv = getenv("STAR_BSERVERROOT");
136 if ( pEnv )
138 int nLen = strlen( pEnv );
139 pRet = ( char *) malloc( nLen + 1 );
140 (void) strcpy( pRet, pEnv );
142 else
144 int nLen = strlen( B_SERVER_ROOT );
145 pRet = ( char *) malloc( nLen + 1 );
146 (void) strcpy( pRet, B_SERVER_ROOT );
148 return pRet;
151 const char* GetEnv( const char *pVar )
153 char *pRet = getenv( pVar );
154 if ( !pRet )
155 pRet = "";
156 return pRet;
159 const char* GetEnv( const char *pVar, const char *pDefault )
161 char *pRet = getenv( pVar );
162 if ( !pRet )
163 return pDefault;
164 return pRet;