1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sal.hxx"
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include "sal/main.h"
33 #include <rtl/bootstrap.hxx>
34 #include <rtl/ustring.h>
35 #include <rtl/ustring.hxx>
36 
37 using namespace ::rtl;
38 
39 // ----------------------------------- Main -----------------------------------
40 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
41 {
42     (void)argc;
43     Bootstrap aBootstrap;
44     //custom .ini/rc file
45     Bootstrap aBs_custom( OUString::createFromAscii(argv[3]) );
46 	OUString suValue;
47 	OUString suDefault( OUString::createFromAscii("mydefault") );
48     int flag = atoi( argv[1] );
49 
50     switch( flag ) {
51     case 1:
52 		// parameters may be passed by command line arguments
53         aBootstrap.getFrom(
54 			OUString(RTL_CONSTASCII_USTRINGPARAM("UNO_SERVICES")),
55 			suValue );
56 		if (suValue.equalsAscii("service.rdb") )
57 		{
58 			return 10;
59 		}
60 		else
61 			return 11;
62     case 2:
63         // parameters may be passed by ini file
64         aBootstrap.getFrom(
65 			OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
66 			suValue );
67 		if (suValue.equalsAscii("true") )
68 		{
69 			return 20;
70 		}
71 		else
72 			return 21;
73     case 3:
74         // parameters may be passed by command line arguments
75         aBootstrap.getFrom(
76 			OUString(RTL_CONSTASCII_USTRINGPARAM("QADEV_BOOTSTRAP")),
77 			suValue );
78 		if (suValue.equalsAscii("sun&ms") )
79 		{
80 			return 30;
81 		}
82 		else
83 			return 31;
84     case 4:
85         // parameters may be passed by custom .ini/rc file
86         aBs_custom.getFrom(
87 			OUString(RTL_CONSTASCII_USTRINGPARAM("RTLVALUE")),
88 			suValue );
89 		if (suValue.equalsAscii("qadev17") )
90 		{
91 			return 40;
92 		}
93 		else
94 			return 41;
95     case 5:
96         // parameters may be passed by inheritance
97         aBs_custom.getFrom(
98 			OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
99 			suValue );
100 		if (suValue.equalsAscii("true") )
101 		{
102 			return 50;
103 		}
104 		else
105 			return 51;
106     default:
107         // parameters may be passed by inheritance
108         aBs_custom.getFrom(
109 			OUString(RTL_CONSTASCII_USTRINGPARAM("ABCDE")),
110 			suValue, suDefault );
111 		if (suValue.equalsAscii("mydefault") )
112 		{
113 			return 60;
114 		}
115 		else
116 			return 61;
117     }
118 }
119