merge the formfield patch from ooo-build
[ooovba.git] / soldep / bootstrp / appdef.cxx
blobec994eb6f65548055c74924fe11a9f29d8047022
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: appdef.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <string.h>
35 #include <appdef.hxx>
37 const char* GetDefStandList()
39 char* pRet;
40 char* pEnv = getenv("STAR_STANDLST");
41 if ( pEnv )
43 int nLen = strlen( pEnv );
44 pRet = ( char *) malloc( nLen + 1 );
45 (void) strcpy( pRet, pEnv );
47 else
49 int nLen = strlen( _DEF_STAND_LIST );
50 pRet = ( char *) malloc( nLen + 1 );
51 (void) strcpy( pRet, _DEF_STAND_LIST );
53 return pRet;
57 const char* GetIniRoot()
59 char* pRet;
60 char* pEnv = getenv("STAR_INIROOT");
61 if ( pEnv )
63 int nLen = strlen( pEnv );
64 pRet = ( char *) malloc( nLen + 1 );
65 (void) strcpy( pRet, pEnv );
67 else
69 int nLen = strlen( _INIROOT );
70 pRet = ( char *) malloc( nLen + 1 );
71 (void) strcpy( pRet, _INIROOT );
73 return pRet;
76 const char* GetIniRootOld()
78 char* pRet;
79 char* pEnv = getenv("STAR_INIROOTOLD");
80 if ( pEnv )
82 int nLen = strlen( pEnv );
83 pRet = ( char *) malloc( nLen + 1 );
84 (void) strcpy( pRet, pEnv );
86 else
88 int nLen = strlen( _INIROOT_OLD );
89 pRet = ( char *) malloc( nLen + 1 );
90 (void) strcpy( pRet, _INIROOT_OLD );
92 return pRet;
95 const char* GetSSolarIni()
97 char* pRet;
98 char* pEnv = getenv("STAR_SSOLARINI");
99 if ( pEnv )
101 int nLen = strlen( pEnv );
102 pRet = ( char *) malloc( nLen + 1 );
103 (void) strcpy( pRet, pEnv );
105 else
107 int nLen = strlen( _DEF_SSOLARINI );
108 pRet = ( char *) malloc( nLen + 1 );
109 (void) strcpy( pRet, _DEF_SSOLARINI );
111 return pRet;
115 const char* GetSSCommon()
117 char* pRet;
118 char* pEnv = getenv("STAR_SSCOMMON");
119 if ( pEnv )
121 int nLen = strlen( pEnv );
122 pRet = ( char *) malloc( nLen + 1 );
123 (void) strcpy( pRet, pEnv );
125 else
127 int nLen = strlen( _DEF_SSCOMMON );
128 pRet = ( char *) malloc( nLen + 1 );
129 (void) strcpy( pRet, _DEF_SSCOMMON );
131 return pRet;
135 const char* GetBServerRoot()
137 char* pRet;
138 char* pEnv = getenv("STAR_BSERVERROOT");
139 if ( pEnv )
141 int nLen = strlen( pEnv );
142 pRet = ( char *) malloc( nLen + 1 );
143 (void) strcpy( pRet, pEnv );
145 else
147 int nLen = strlen( B_SERVER_ROOT );
148 pRet = ( char *) malloc( nLen + 1 );
149 (void) strcpy( pRet, B_SERVER_ROOT );
151 return pRet;
154 const char* GetEnv( const char *pVar )
156 char *pRet = getenv( pVar );
157 if ( !pRet )
158 pRet = "";
159 return pRet;
162 const char* GetEnv( const char *pVar, const char *pDefault )
164 char *pRet = getenv( pVar );
165 if ( !pRet )
166 return pDefault;
167 return pRet;