xref: /aoo41x/main/sal/qa/rtl/process/child_process.cxx (revision 87d2adbc)
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 
27 #include <stdio.h>
28 #include "sal/main.h"
29 #include <rtl/process.h>
30 #include <rtl_Process_Const.h>
31 
32 using namespace ::rtl;
33 
34 // ----------------------------------- Main -----------------------------------
35 SAL_IMPLEMENT_MAIN_WITH_ARGS(, argv)
36 {
37     printf("# %s is called.\n", argv[0]);
38 
39     sal_Int32 nCount = rtl_getAppCommandArgCount();
40     if ( nCount != 4 )
41     {
42         printf(
43             "# not enough arguments found, need 4 found %ld.\n",
44             sal::static_int_cast< long >(nCount));
45         return 0;
46     }
47 
48     OUString suArg[4];
49     for( sal_Int32 i = 0 ; i < nCount ; i ++ )
50     {
51         rtl_getAppCommandArg( i , &(suArg[i].pData) );
52         rtl::OString aString;
53         aString = ::rtl::OUStringToOString( suArg[i], RTL_TEXTENCODING_ASCII_US );
54         printf(
55             "# Parameter[%ld] is %s\n", sal::static_int_cast< long >(i),
56             aString.getStr());
57     }
58 
59     if ( suArg[0].compareTo( suParam0) != 0 ||
60          suArg[1].compareTo( suParam1) != 0 ||
61          suArg[2].compareTo( suParam2) != 0 ||
62          suArg[3].compareTo( suParam3) != 0 )
63     {
64         return 0;
65     }
66     return 2;
67 }
68