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.
git-svn-id: svn://10.0.0.236/trunk@33970 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
96e56379e8
commit
07e7d53b83
@ -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)
|
||||
{
|
||||
size_t bytesDone;
|
||||
|
||||
if (op == READ_ASYNC)
|
||||
bytesDone = fread(buf, 1, bytes, systemFP);
|
||||
else
|
||||
bytesDone = fwrite(buf, 1, bytes, systemFP);
|
||||
|
||||
if (errno)
|
||||
{
|
||||
err = errno;
|
||||
goto ErrorExit;
|
||||
}
|
||||
else
|
||||
return (bytesDone);
|
||||
}
|
||||
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;
|
||||
switch (refNum)
|
||||
{
|
||||
case 0:
|
||||
/* stdin - not on a Mac for now */
|
||||
err = paramErr;
|
||||
goto ErrorExit;
|
||||
break;
|
||||
case 1: /* stdout */
|
||||
case 2: /* stderr */
|
||||
puts(buf);
|
||||
break;
|
||||
}
|
||||
|
||||
return (bytes);
|
||||
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
static IOCompletionUPP sCompletionUPP = NULL;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user