merge the formfield patch from ooo-build
[ooovba.git] / tools / bootstrp / appdef.cxx
blobf8c16f6d0dd2896bc9f1c791b0b9fe29e131b8f2
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.6 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_tools.hxx"
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <string.h>
38 #include "bootstrp/appdef.hxx"
40 const char* GetDefStandList()
42 char* pRet;
43 char* pEnv = getenv("STAR_STANDLST");
44 if ( pEnv )
46 int nLen = strlen( pEnv );
47 pRet = ( char *) malloc( nLen + 1 );
48 (void) strcpy( pRet, pEnv );
50 else
52 int nLen = strlen( _DEF_STAND_LIST );
53 pRet = ( char *) malloc( nLen + 1 );
54 (void) strcpy( pRet, _DEF_STAND_LIST );
56 return pRet;
60 const char* GetIniRoot()
62 char* pRet;
63 char* pEnv = getenv("STAR_INIROOT");
64 if ( pEnv )
66 int nLen = strlen( pEnv );
67 pRet = ( char *) malloc( nLen + 1 );
68 (void) strcpy( pRet, pEnv );
70 else
72 int nLen = strlen( _INIROOT );
73 pRet = ( char *) malloc( nLen + 1 );
74 (void) strcpy( pRet, _INIROOT );
76 return pRet;
79 const char* GetIniRootOld()
81 char* pRet;
82 char* pEnv = getenv("STAR_INIROOTOLD");
83 if ( pEnv )
85 int nLen = strlen( pEnv );
86 pRet = ( char *) malloc( nLen + 1 );
87 (void) strcpy( pRet, pEnv );
89 else
91 int nLen = strlen( _INIROOT_OLD );
92 pRet = ( char *) malloc( nLen + 1 );
93 (void) strcpy( pRet, _INIROOT_OLD );
95 return pRet;
98 const char* GetSSolarIni()
100 char* pRet;
101 char* pEnv = getenv("STAR_SSOLARINI");
102 if ( pEnv )
104 int nLen = strlen( pEnv );
105 pRet = ( char *) malloc( nLen + 1 );
106 (void) strcpy( pRet, pEnv );
108 else
110 int nLen = strlen( _DEF_SSOLARINI );
111 pRet = ( char *) malloc( nLen + 1 );
112 (void) strcpy( pRet, _DEF_SSOLARINI );
114 return pRet;
118 const char* GetSSCommon()
120 char* pRet;
121 char* pEnv = getenv("STAR_SSCOMMON");
122 if ( pEnv )
124 int nLen = strlen( pEnv );
125 pRet = ( char *) malloc( nLen + 1 );
126 (void) strcpy( pRet, pEnv );
128 else
130 int nLen = strlen( _DEF_SSCOMMON );
131 pRet = ( char *) malloc( nLen + 1 );
132 (void) strcpy( pRet, _DEF_SSCOMMON );
134 return pRet;
138 const char* GetBServerRoot()
140 char* pRet;
141 char* pEnv = getenv("STAR_BSERVERROOT");
142 if ( pEnv )
144 int nLen = strlen( pEnv );
145 pRet = ( char *) malloc( nLen + 1 );
146 (void) strcpy( pRet, pEnv );
148 else
150 int nLen = strlen( B_SERVER_ROOT );
151 pRet = ( char *) malloc( nLen + 1 );
152 (void) strcpy( pRet, B_SERVER_ROOT );
154 return pRet;
157 const char* GetEnv( const char *pVar )
159 char const *pRet = getenv( pVar );
160 if ( !pRet )
161 pRet = "";
162 return pRet;
165 const char* GetEnv( const char *pVar, const char *pDefault )
167 char *pRet = getenv( pVar );
168 if ( !pRet )
169 return pDefault;
170 return pRet;