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