stdio.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. * File: stdio.c
  7. * Description: testing the "special" fds
  8. * Modification History:
  9. * 20-May-1997 AGarcia - Replace Test succeeded status with PASS. This is used by the
  10. * regress tool parsing code.
  11. ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
  12. ** recognize the return code from tha main program.
  13. */
  14. #include "prlog.h"
  15. #include "prinit.h"
  16. #include "prio.h"
  17. #include <stdio.h>
  18. #include <string.h>
  19. static PRIntn PR_CALLBACK stdio(PRIntn argc, char **argv)
  20. {
  21. PRInt32 rv;
  22. PRFileDesc *out = PR_GetSpecialFD(PR_StandardOutput);
  23. PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
  24. rv = PR_Write(
  25. out, "This to standard out\n",
  26. strlen("This to standard out\n"));
  27. PR_ASSERT((PRInt32)strlen("This to standard out\n") == rv);
  28. rv = PR_Write(
  29. err, "This to standard err\n",
  30. strlen("This to standard err\n"));
  31. PR_ASSERT((PRInt32)strlen("This to standard err\n") == rv);
  32. return 0;
  33. } /* stdio */
  34. int main(int argc, char **argv)
  35. {
  36. PR_STDIO_INIT();
  37. return PR_Initialize(stdio, argc, argv, 0);
  38. } /* main */
  39. /* stdio.c */