nsprpub/pr/tests/stdio.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/tests/stdio.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * File:        stdio.c
    1.11 + * Description: testing the "special" fds
    1.12 + * Modification History:
    1.13 + * 20-May-1997 AGarcia - Replace Test succeeded status with PASS. This is used by the
    1.14 + *						regress tool parsing code.
    1.15 + ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
    1.16 +**			recognize the return code from tha main program.
    1.17 + */
    1.18 +
    1.19 +
    1.20 +#include "prlog.h"
    1.21 +#include "prinit.h"
    1.22 +#include "prio.h"
    1.23 +
    1.24 +#include <stdio.h>
    1.25 +#include <string.h>
    1.26 +
    1.27 +static PRIntn PR_CALLBACK stdio(PRIntn argc, char **argv)
    1.28 +{
    1.29 +    PRInt32 rv;
    1.30 +
    1.31 +    PRFileDesc *out = PR_GetSpecialFD(PR_StandardOutput);
    1.32 +    PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
    1.33 +
    1.34 +    rv = PR_Write(
    1.35 +        out, "This to standard out\n",
    1.36 +        strlen("This to standard out\n"));
    1.37 +    PR_ASSERT((PRInt32)strlen("This to standard out\n") == rv);
    1.38 +    rv = PR_Write(
    1.39 +        err, "This to standard err\n",
    1.40 +        strlen("This to standard err\n"));
    1.41 +    PR_ASSERT((PRInt32)strlen("This to standard err\n") == rv);
    1.42 +
    1.43 +    return 0;
    1.44 +
    1.45 +}  /* stdio */
    1.46 +
    1.47 +int main(int argc, char **argv)
    1.48 +{
    1.49 +    PR_STDIO_INIT();
    1.50 +    return PR_Initialize(stdio, argc, argv, 0);
    1.51 +}  /* main */
    1.52 +
    1.53 +
    1.54 +/* stdio.c */

mercurial