summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdagley%netscape.com <devnull@localhost>1999-06-07 02:37:28 +0000
committersdagley%netscape.com <devnull@localhost>1999-06-07 02:37:28 +0000
commitb4db76e082fee25f6595f15069cee222b52ddb14 (patch)
tree8ed8abe663cb56a79eb275a496c8e80520bf483e
parent396bebcd4d1bb434c46ca71f4ceeaab21be688a9 (diff)
downloadnspr-hg-b4db76e082fee25f6595f15069cee222b52ddb14.tar.gz
Fix bug #6507. PR_fprintf() with PR_GetSpecialFD(PR_StandardOutput) or PR_GetSpecialFD(PR_StandardError) as the file argument now works on the Mac with output directed to the SIOUX stdout console window.
-rw-r--r--pr/src/md/mac/macio.c53
1 files changed, 15 insertions, 38 deletions
diff --git a/pr/src/md/mac/macio.c b/pr/src/md/mac/macio.c
index eb2a5503..5f931521 100644
--- a/pr/src/md/mac/macio.c
+++ b/pr/src/md/mac/macio.c
@@ -197,52 +197,29 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
ExtendedParamBlock pbAsync;
PRThread *me = _PR_MD_CURRENT_THREAD();
_PRCPU *cpu = _PR_MD_CURRENT_CPU();
-#if 0
+
/* quick hack to allow PR_fprintf, etc to work with stderr, stdin, stdout */
/* note, if a user chooses "seek" or the like as an operation in another function */
/* this will not work */
- FILE* systemFP = NULL;
- extern int errno;
-
- switch (refNum)
- {
- case 0:
- systemFP = stdin;
- break;
- case 1:
- systemFP = stdout;
- break;
- case 2:
- systemFP = stderr;
- break;
- }
-
- if (systemFP)
+ if (refNum >= 0 && refNum < 3)
{
- size_t bytesDone;
-
- if (op == READ_ASYNC)
- bytesDone = fread(buf, 1, bytes, systemFP);
- else
- bytesDone = fwrite(buf, 1, bytes, systemFP);
-
- if (errno)
+ switch (refNum)
{
- err = errno;
- goto ErrorExit;
+ case 0:
+ /* stdin - not on a Mac for now */
+ err = paramErr;
+ goto ErrorExit;
+ break;
+ case 1: /* stdout */
+ case 2: /* stderr */
+ puts(buf);
+ break;
}
- else
- return (bytesDone);
+
+ return (bytes);
+
}
else
-#else
- if (refNum >= 0 && refNum < 3)
- {
- PR_ASSERT(FALSE); /* writing to these is hazardous to a Mac's health (refNum 2 is the system file) */
- err = paramErr;
- goto ErrorExit;
- }
-#endif
{
static IOCompletionUPP sCompletionUPP = NULL;