update emoji autocorrect entries from po-files
[LibreOffice.git] / sal / workben / testpip2.cxx
blob87fcd705ae711bbd2630faa68bf4b3364a9c0694
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <stdio.h>
21 #include <stdlib.h>
23 #include <osl/pipe.h>
25 // eindeutiger Name für die Pipe
26 const char pszPipeName[] = "TestPipe";
28 oslPipe Pipe;
30 void fail( const char * pszText, int retval )
32 fprintf( stderr, "TestPipe Client: %s", pszText );
33 fprintf( stderr, "TestPipe Client: test failed, ErrNo: %d.\n", retval );
34 exit( retval );
38 * Teste die Pipe-Implementation in osl
41 int main()
43 char szBuffer[ 256 ];
44 rtl_uString* ustrPipeName=0;
45 sal_Int32 nChars;
47 rtl_uString_newFromAscii(&ustrPipeName,pszPipeName);
49 // erzeuge die Pipe
50 Pipe = osl_createPipe( ustrPipeName, osl_Pipe_OPEN, 0 );
52 if( !Pipe )
53 fail( "unable to open pipe.\n",
54 osl_getLastPipeError(NULL));
56 // empfange Daten vom Server
57 nChars = osl_receivePipe( Pipe, szBuffer, 256 );
59 if( nChars < 0 )
60 fail( "unable to read from pipe.\n",
61 osl_getLastPipeError( Pipe ) );
63 printf( "TestPipe Client: data received: %s.\n", szBuffer );
65 // Sende die Daten wieder zurück.
66 nChars = osl_sendPipe( Pipe, szBuffer, nChars );
68 if( nChars < 0 )
69 fail( "unable to write on pipe.\n",
70 osl_getLastPipeError( Pipe ) );
72 // schliesse die Pipe
73 osl_releasePipe( Pipe );
75 printf( "TestPipe Client: test passed.\n" );
76 return 0;
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */