Author santoso.wijaya
Recipients amaury.forgeotdarc, casevh, neologix, pitrou, santoso.wijaya, terry.reedy, vstinner
Date 2011-03-07.00:31:01
SpamBayes Score 1.3538e-06
Marked as misclassified No
Message-id <1299457862.69.0.832952467489.issue11395@psf.upfronthosting.co.za>
In-reply-to
Content
FWIW, here's the Microsoft's source for isatty (in VC\crt\src\isatty.c):

/***
*int _isatty(handle) - check if handle is a device
*
*Purpose:
*       Checks if the given handle is associated with a character device
*       (terminal, console, printer, serial port)
*
*Entry:
*       int handle - handle of file to be tested
*
*Exit:
*       returns non-0 if handle refers to character device,
*       returns 0 otherwise
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _isatty (
        int fh
        )
{
#if defined (_DEBUG) && !defined (_SYSCRT)
        /* make sure we ask debugger only once and cache the answer */
        static int knownHandle = -1;
#endif  /* defined (_DEBUG) && !defined (_SYSCRT) */

        /* see if file handle is valid, otherwise return FALSE */
        _CHECK_FH_RETURN(fh, EBADF, 0);
        _VALIDATE_RETURN((fh >= 0 && (unsigned)fh < (unsigned)_nhandle), EBADF, 0);

#if defined (_DEBUG) && !defined (_SYSCRT)
        if (knownHandle == -1) {
            knownHandle = DebuggerKnownHandle();
        }

        if (knownHandle) {
            return TRUE;
        }
#endif  /* defined (_DEBUG) && !defined (_SYSCRT) */

        /* check file handle database to see if device bit set */
        return (int)(_osfile(fh) & FDEV);
}
History
Date User Action Args
2011-03-07 00:31:02santoso.wijayasetrecipients: + santoso.wijaya, terry.reedy, amaury.forgeotdarc, pitrou, vstinner, casevh, neologix
2011-03-07 00:31:02santoso.wijayasetmessageid: <1299457862.69.0.832952467489.issue11395@psf.upfronthosting.co.za>
2011-03-07 00:31:02santoso.wijayalinkissue11395 messages
2011-03-07 00:31:01santoso.wijayacreate