1*9d7e27acSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9d7e27acSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9d7e27acSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9d7e27acSAndrew Rist * distributed with this work for additional information
6*9d7e27acSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9d7e27acSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9d7e27acSAndrew Rist * "License"); you may not use this file except in compliance
9*9d7e27acSAndrew Rist * with the License. You may obtain a copy of the License at
10*9d7e27acSAndrew Rist *
11*9d7e27acSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9d7e27acSAndrew Rist *
13*9d7e27acSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9d7e27acSAndrew Rist * software distributed under the License is distributed on an
15*9d7e27acSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9d7e27acSAndrew Rist * KIND, either express or implied. See the License for the
17*9d7e27acSAndrew Rist * specific language governing permissions and limitations
18*9d7e27acSAndrew Rist * under the License.
19*9d7e27acSAndrew Rist *
20*9d7e27acSAndrew Rist *************************************************************/
21*9d7e27acSAndrew Rist
22*9d7e27acSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cppuhelper.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <sal/main.h>
28cdf0e10cSrcweir
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <cstdio>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include <rtl/process.h>
34cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37cdf0e10cSrcweir
38cdf0e10cSrcweir using namespace ::cppu;
39cdf0e10cSrcweir using namespace ::com::sun::star::lang;
40cdf0e10cSrcweir using namespace ::com::sun::star::uno;
41cdf0e10cSrcweir using namespace ::rtl;
42cdf0e10cSrcweir
43cdf0e10cSrcweir
SAL_IMPLEMENT_MAIN()44cdf0e10cSrcweir SAL_IMPLEMENT_MAIN()
45cdf0e10cSrcweir {
46cdf0e10cSrcweir sal_Bool result = sal_True;
47cdf0e10cSrcweir
48cdf0e10cSrcweir try {
49cdf0e10cSrcweir Reference<XComponentContext> xComponentContext = defaultBootstrap_InitialComponentContext();
50cdf0e10cSrcweir
51cdf0e10cSrcweir Reference<XMultiServiceFactory> smgr(xComponentContext->getServiceManager(), UNO_QUERY);
52cdf0e10cSrcweir
53cdf0e10cSrcweir for(sal_uInt32 i = 0; i < rtl_getAppCommandArgCount(); ++ i) {
54cdf0e10cSrcweir OUString arg;
55cdf0e10cSrcweir
56cdf0e10cSrcweir rtl_getAppCommandArg(i, &arg.pData);
57cdf0e10cSrcweir if (arg.getLength())
58cdf0e10cSrcweir {
59cdf0e10cSrcweir Reference<XInterface> xInterface = smgr->createInstance(arg);
60cdf0e10cSrcweir OString tmp = OUStringToOString(arg, RTL_TEXTENCODING_ASCII_US);
61cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
62cdf0e10cSrcweir fprintf(stderr, "got the %s service %p\n", tmp.getStr(), xInterface.get());
63cdf0e10cSrcweir #endif
64cdf0e10cSrcweir
65cdf0e10cSrcweir result = result && (xInterface.get() != 0);
66cdf0e10cSrcweir }
67cdf0e10cSrcweir }
68cdf0e10cSrcweir }
69cdf0e10cSrcweir catch(Exception & exception) {
70cdf0e10cSrcweir OString message = OUStringToOString(exception.Message, RTL_TEXTENCODING_ASCII_US);
71cdf0e10cSrcweir
72cdf0e10cSrcweir fprintf(stderr, "an exception occurred: %s\n", message.getStr());
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
76cdf0e10cSrcweir OSL_TRACE("---------------------------------- %i", result);
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir
79cdf0e10cSrcweir return result;
80cdf0e10cSrcweir }
81