nsprpub/pr/tests/stdio.c

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial