home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC.ZIP / SETUPIO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.2 KB  |  55 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - setupio.c
  3.  *-----------------------------------------------------------------------*/
  4.  
  5. /*
  6.  *      C/C++ Run Time Library - Version 5.0
  7.  *
  8.  *      Copyright (c) 1987, 1992 by Borland International
  9.  *      All Rights Reserved.
  10.  *
  11.  */
  12.  
  13.  
  14. #pragma inline
  15.  
  16. #include <stdio.h>
  17. #include <_stdio.h>
  18. #include <io.h>
  19. #include <_io.h>
  20.  
  21. void near _setupio( void )
  22. {
  23. #if !defined( _RTLDLL )
  24.  
  25.     int i;
  26.  
  27.     for (i=5; i<_nfile; i++)
  28.         {
  29.         _openfd[i] = 0;
  30.         _streams[i].fd = -1;
  31.         _streams[i].token = (short) (i + _streams);
  32.         }
  33.  
  34.     if( !isatty( stdin->fd ) )
  35.         stdin->flags &= ~_F_TERM;
  36.     setvbuf( stdin, NULL, (stdin->flags & _F_TERM) ? _IOLBF : _IOFBF, BUFSIZ );
  37.     if( !isatty( stdout->fd ) )
  38.         stdout->flags &= ~_F_TERM;
  39.     setvbuf( stdout, NULL, (stdout->flags & _F_TERM) ? _IONBF : _IOFBF, BUFSIZ );
  40.  
  41. #endif  // _RTLDLL
  42. }
  43.  
  44. /* #pragma startup _setupio 2 */
  45.  
  46. #pragma warn -asm
  47. asm _INIT_      SEGMENT WORD PUBLIC 'INITDATA'
  48. asm         db      0
  49. asm         db      2
  50. asm         dw      offset _setupio
  51. asm         dw      0
  52. asm _INIT_  ENDS
  53. #pragma warn .asm
  54.  
  55.