xref: /aoo41x/main/tools/bootstrp/appdef.cxx (revision 89b56da7)
1*89b56da7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*89b56da7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*89b56da7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*89b56da7SAndrew Rist  * distributed with this work for additional information
6*89b56da7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*89b56da7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*89b56da7SAndrew Rist  * "License"); you may not use this file except in compliance
9*89b56da7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*89b56da7SAndrew Rist  *
11*89b56da7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*89b56da7SAndrew Rist  *
13*89b56da7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*89b56da7SAndrew Rist  * software distributed under the License is distributed on an
15*89b56da7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*89b56da7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*89b56da7SAndrew Rist  * specific language governing permissions and limitations
18*89b56da7SAndrew Rist  * under the License.
19*89b56da7SAndrew Rist  *
20*89b56da7SAndrew Rist  *************************************************************/
21*89b56da7SAndrew Rist 
22*89b56da7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_tools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdlib.h>
28cdf0e10cSrcweir #include <stdio.h>
29cdf0e10cSrcweir #include <string.h>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "bootstrp/appdef.hxx"
32cdf0e10cSrcweir 
GetDefStandList()33cdf0e10cSrcweir const char* GetDefStandList()
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	char* pRet;
36cdf0e10cSrcweir 	char* pEnv = getenv("STAR_STANDLST");
37cdf0e10cSrcweir 	if ( pEnv )
38cdf0e10cSrcweir 	{
39cdf0e10cSrcweir 		int nLen = strlen( pEnv );
40cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
41cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
42cdf0e10cSrcweir 	}
43cdf0e10cSrcweir 	else
44cdf0e10cSrcweir 	{
45cdf0e10cSrcweir 		int nLen = strlen( _DEF_STAND_LIST );
46cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
47cdf0e10cSrcweir 		(void) strcpy( pRet, _DEF_STAND_LIST );
48cdf0e10cSrcweir 	}
49cdf0e10cSrcweir 	return pRet;
50cdf0e10cSrcweir }
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
GetIniRoot()53cdf0e10cSrcweir const char* GetIniRoot()
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 	char* pRet;
56cdf0e10cSrcweir 	char* pEnv = getenv("STAR_INIROOT");
57cdf0e10cSrcweir 	if ( pEnv )
58cdf0e10cSrcweir 	{
59cdf0e10cSrcweir 		int nLen = strlen( pEnv );
60cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
61cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
62cdf0e10cSrcweir 	}
63cdf0e10cSrcweir 	else
64cdf0e10cSrcweir 	{
65cdf0e10cSrcweir 		int nLen = strlen( _INIROOT );
66cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
67cdf0e10cSrcweir 		(void) strcpy( pRet, _INIROOT );
68cdf0e10cSrcweir 	}
69cdf0e10cSrcweir 	return pRet;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
GetIniRootOld()72cdf0e10cSrcweir const char* GetIniRootOld()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	char* pRet;
75cdf0e10cSrcweir 	char* pEnv = getenv("STAR_INIROOTOLD");
76cdf0e10cSrcweir 	if ( pEnv )
77cdf0e10cSrcweir 	{
78cdf0e10cSrcweir 		int nLen = strlen( pEnv );
79cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
80cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
81cdf0e10cSrcweir 	}
82cdf0e10cSrcweir 	else
83cdf0e10cSrcweir 	{
84cdf0e10cSrcweir 		int nLen = strlen( _INIROOT_OLD );
85cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
86cdf0e10cSrcweir 		(void) strcpy( pRet, _INIROOT_OLD );
87cdf0e10cSrcweir 	}
88cdf0e10cSrcweir 	return pRet;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
GetSSolarIni()91cdf0e10cSrcweir const char* GetSSolarIni()
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	char* pRet;
94cdf0e10cSrcweir 	char* pEnv = getenv("STAR_SSOLARINI");
95cdf0e10cSrcweir 	if ( pEnv )
96cdf0e10cSrcweir 	{
97cdf0e10cSrcweir 		int nLen = strlen( pEnv );
98cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
99cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
100cdf0e10cSrcweir 	}
101cdf0e10cSrcweir 	else
102cdf0e10cSrcweir 	{
103cdf0e10cSrcweir 		int nLen = strlen( _DEF_SSOLARINI );
104cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
105cdf0e10cSrcweir 		(void) strcpy( pRet, _DEF_SSOLARINI );
106cdf0e10cSrcweir 	}
107cdf0e10cSrcweir 	return pRet;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
GetSSCommon()111cdf0e10cSrcweir const char* GetSSCommon()
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	char* pRet;
114cdf0e10cSrcweir 	char* pEnv = getenv("STAR_SSCOMMON");
115cdf0e10cSrcweir 	if ( pEnv )
116cdf0e10cSrcweir 	{
117cdf0e10cSrcweir 		int nLen = strlen( pEnv );
118cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
119cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
120cdf0e10cSrcweir 	}
121cdf0e10cSrcweir 	else
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		int nLen = strlen( _DEF_SSCOMMON );
124cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
125cdf0e10cSrcweir 		(void) strcpy( pRet, _DEF_SSCOMMON );
126cdf0e10cSrcweir 	}
127cdf0e10cSrcweir 	return pRet;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
GetBServerRoot()131cdf0e10cSrcweir const char* GetBServerRoot()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	char* pRet;
134cdf0e10cSrcweir 	char* pEnv = getenv("STAR_BSERVERROOT");
135cdf0e10cSrcweir 	if ( pEnv )
136cdf0e10cSrcweir 	{
137cdf0e10cSrcweir 		int nLen = strlen( pEnv );
138cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
139cdf0e10cSrcweir 		(void) strcpy( pRet, pEnv );
140cdf0e10cSrcweir 	}
141cdf0e10cSrcweir 	else
142cdf0e10cSrcweir 	{
143cdf0e10cSrcweir 		int nLen = strlen( B_SERVER_ROOT );
144cdf0e10cSrcweir 		pRet = ( char *) malloc( nLen + 1 );
145cdf0e10cSrcweir 		(void) strcpy( pRet, B_SERVER_ROOT );
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir 	return pRet;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir 
GetEnv(const char * pVar)150cdf0e10cSrcweir const char* GetEnv( const char *pVar )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir 	char const *pRet = getenv( pVar );
153cdf0e10cSrcweir 	if ( !pRet )
154cdf0e10cSrcweir 		pRet = "";
155cdf0e10cSrcweir 	return pRet;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir 
GetEnv(const char * pVar,const char * pDefault)158cdf0e10cSrcweir const char* GetEnv( const char *pVar, const char *pDefault )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	char *pRet = getenv( pVar );
161cdf0e10cSrcweir 	if ( !pRet )
162cdf0e10cSrcweir 		return pDefault;
163cdf0e10cSrcweir 	return pRet;
164cdf0e10cSrcweir }
165