Debian Codegraph @

nsprpub/pr/tests/stdio.c

raw
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
11 *by the regress tool parsing code.
12 ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been
13 *updated to
14 ** recognize the return code from tha main program.
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 PRInt32 rv;
26
27 PRFileDesc* out = PR_GetSpecialFD(PR_StandardOutput);
28 PRFileDesc* err = PR_GetSpecialFD(PR_StandardError);
29
30 rv =
31 PR_Write(out, "This to standard out\n", strlen("This to standard out\n"));
32 PR_ASSERT((PRInt32)strlen("This to standard out\n") == rv);
33 rv =
34 PR_Write(err, "This to standard err\n", strlen("This to standard err\n"));
35 PR_ASSERT((PRInt32)strlen("This to standard err\n") == rv);
36
37 return 0;
38
39 } /* stdio */
40
41 int main(int argc, char** argv) {
42 PR_STDIO_INIT();
43 return PR_Initialize(stdio, argc, argv, 0);
44 } /* main */
45
46 /* stdio.c */