8e2b856088dcbdf0d4b4a383af3b441c0f79cd66
[platform/upstream/nspr.git] / nspr / pr / tests / stdio.c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7  * File:        stdio.c
8  * Description: testing the "special" fds
9  * Modification History:
10  * 20-May-1997 AGarcia - Replace Test succeeded status with PASS. This is used by the
11  *                                              regress tool parsing code.
12  ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
13 **                      recognize the return code from tha main program.
14  */
15
16
17 #include "prlog.h"
18 #include "prinit.h"
19 #include "prio.h"
20
21 #include <stdio.h>
22 #include <string.h>
23
24 static PRIntn PR_CALLBACK stdio(PRIntn argc, char **argv)
25 {
26     PRInt32 rv;
27
28     PRFileDesc *out = PR_GetSpecialFD(PR_StandardOutput);
29     PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
30
31     rv = PR_Write(
32         out, "This to standard out\n",
33         strlen("This to standard out\n"));
34     PR_ASSERT((PRInt32)strlen("This to standard out\n") == rv);
35     rv = PR_Write(
36         err, "This to standard err\n",
37         strlen("This to standard err\n"));
38     PR_ASSERT((PRInt32)strlen("This to standard err\n") == rv);
39
40     return 0;
41
42 }  /* stdio */
43
44 int main(int argc, char **argv)
45 {
46     PR_STDIO_INIT();
47     return PR_Initialize(stdio, argc, argv, 0);
48 }  /* main */
49
50
51 /* stdio.c */