1*87d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87d2adbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87d2adbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87d2adbcSAndrew Rist  * distributed with this work for additional information
6*87d2adbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87d2adbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87d2adbcSAndrew Rist  * "License"); you may not use this file except in compliance
9*87d2adbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87d2adbcSAndrew Rist  *
11*87d2adbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87d2adbcSAndrew Rist  *
13*87d2adbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87d2adbcSAndrew Rist  * software distributed under the License is distributed on an
15*87d2adbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87d2adbcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*87d2adbcSAndrew Rist  * specific language governing permissions and limitations
18*87d2adbcSAndrew Rist  * under the License.
19*87d2adbcSAndrew Rist  *
20*87d2adbcSAndrew Rist  *************************************************************/
21*87d2adbcSAndrew Rist 
22*87d2adbcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sal.hxx"
26cdf0e10cSrcweir #include <stdlib.h>
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include "sal/main.h"
29cdf0e10cSrcweir #include <rtl/bootstrap.hxx>
30cdf0e10cSrcweir #include <rtl/ustring.h>
31cdf0e10cSrcweir #include <rtl/ustring.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::rtl;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // ----------------------------------- Main -----------------------------------
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc,argv)36cdf0e10cSrcweir SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     (void)argc;
39cdf0e10cSrcweir     Bootstrap aBootstrap;
40cdf0e10cSrcweir     //custom .ini/rc file
41cdf0e10cSrcweir     Bootstrap aBs_custom( OUString::createFromAscii(argv[3]) );
42cdf0e10cSrcweir 	OUString suValue;
43cdf0e10cSrcweir 	OUString suDefault( OUString::createFromAscii("mydefault") );
44cdf0e10cSrcweir     int flag = atoi( argv[1] );
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     switch( flag ) {
47cdf0e10cSrcweir     case 1:
48cdf0e10cSrcweir 		// parameters may be passed by command line arguments
49cdf0e10cSrcweir         aBootstrap.getFrom(
50cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("UNO_SERVICES")),
51cdf0e10cSrcweir 			suValue );
52cdf0e10cSrcweir 		if (suValue.equalsAscii("service.rdb") )
53cdf0e10cSrcweir 		{
54cdf0e10cSrcweir 			return 10;
55cdf0e10cSrcweir 		}
56cdf0e10cSrcweir 		else
57cdf0e10cSrcweir 			return 11;
58cdf0e10cSrcweir     case 2:
59cdf0e10cSrcweir         // parameters may be passed by ini file
60cdf0e10cSrcweir         aBootstrap.getFrom(
61cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
62cdf0e10cSrcweir 			suValue );
63cdf0e10cSrcweir 		if (suValue.equalsAscii("true") )
64cdf0e10cSrcweir 		{
65cdf0e10cSrcweir 			return 20;
66cdf0e10cSrcweir 		}
67cdf0e10cSrcweir 		else
68cdf0e10cSrcweir 			return 21;
69cdf0e10cSrcweir     case 3:
70cdf0e10cSrcweir         // parameters may be passed by command line arguments
71cdf0e10cSrcweir         aBootstrap.getFrom(
72cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("QADEV_BOOTSTRAP")),
73cdf0e10cSrcweir 			suValue );
74cdf0e10cSrcweir 		if (suValue.equalsAscii("sun&ms") )
75cdf0e10cSrcweir 		{
76cdf0e10cSrcweir 			return 30;
77cdf0e10cSrcweir 		}
78cdf0e10cSrcweir 		else
79cdf0e10cSrcweir 			return 31;
80cdf0e10cSrcweir     case 4:
81cdf0e10cSrcweir         // parameters may be passed by custom .ini/rc file
82cdf0e10cSrcweir         aBs_custom.getFrom(
83cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("RTLVALUE")),
84cdf0e10cSrcweir 			suValue );
85cdf0e10cSrcweir 		if (suValue.equalsAscii("qadev17") )
86cdf0e10cSrcweir 		{
87cdf0e10cSrcweir 			return 40;
88cdf0e10cSrcweir 		}
89cdf0e10cSrcweir 		else
90cdf0e10cSrcweir 			return 41;
91cdf0e10cSrcweir     case 5:
92cdf0e10cSrcweir         // parameters may be passed by inheritance
93cdf0e10cSrcweir         aBs_custom.getFrom(
94cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
95cdf0e10cSrcweir 			suValue );
96cdf0e10cSrcweir 		if (suValue.equalsAscii("true") )
97cdf0e10cSrcweir 		{
98cdf0e10cSrcweir 			return 50;
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 		else
101cdf0e10cSrcweir 			return 51;
102cdf0e10cSrcweir     default:
103cdf0e10cSrcweir         // parameters may be passed by inheritance
104cdf0e10cSrcweir         aBs_custom.getFrom(
105cdf0e10cSrcweir 			OUString(RTL_CONSTASCII_USTRINGPARAM("ABCDE")),
106cdf0e10cSrcweir 			suValue, suDefault );
107cdf0e10cSrcweir 		if (suValue.equalsAscii("mydefault") )
108cdf0e10cSrcweir 		{
109cdf0e10cSrcweir 			return 60;
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 		else
112cdf0e10cSrcweir 			return 61;
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir }
115