Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /****************************************************************************
  2. *
  3. *                            Open Watcom Project
  4. *
  5. *    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. *
  7. *  ========================================================================
  8. *
  9. *    This file contains Original Code and/or Modifications of Original
  10. *    Code as defined in and that are subject to the Sybase Open Watcom
  11. *    Public License version 1.0 (the 'License'). You may not use this file
  12. *    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. *    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. *    provided with the Original Code and Modifications, and is also
  15. *    available at www.sybase.com/developer/opensource.
  16. *
  17. *    The Original Code and all software distributed under the License are
  18. *    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. *    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. *    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. *    NON-INFRINGEMENT. Please see the License for the specific language
  23. *    governing rights and limitations under the License.
  24. *
  25. *  ========================================================================
  26. *
  27. * Description:  io_mode handle information array manipulation
  28. *
  29. ****************************************************************************/
  30.  
  31.  
  32. #include "variety.h"
  33. #include <stdio.h>
  34. #include <unistd.h>
  35. #include <string.h>
  36. #include <errno.h>
  37. #include "rtdata.h"
  38. //#include "liballoc.h"
  39. #include "fileacc.h"
  40. #include "rtinit.h"
  41. #include "seterrno.h"
  42. #include "iomode.h"
  43.  
  44. unsigned __NFiles   = _NFILES;          /* maximum # of files we can open */
  45.  
  46. #if defined(__NETWARE__)
  47. #error NO IO MODE MANAGER UNDER NETWARE
  48. #endif
  49.  
  50. #if !defined(__UNIX__)
  51.  
  52. unsigned _HUGEDATA __init_mode[_NFILES] = { /* file mode information (flags) */
  53.         _READ,          /* stdin */
  54.         _WRITE,         /* stdout */
  55.         _WRITE,         /* stderr */
  56.         _READ|_WRITE,   /* stdaux */
  57.         _WRITE          /* stdprn */
  58. };
  59.  
  60. unsigned *__io_mode = __init_mode;      /* initially points to static array */
  61.  
  62. unsigned __GetIOMode( int handle )
  63. {
  64.     if( handle >= __NFiles )
  65.     {
  66.         return( 0 );
  67.     }
  68.     return( __io_mode[handle] );
  69. }
  70.  
  71. void __SetIOMode_nogrow( int handle, unsigned value )
  72. {
  73.     if( handle < __NFiles )
  74.     {
  75.         __io_mode[handle] = value;    /* we're closing it; smite _INITIALIZED */
  76.     }
  77. }
  78.  
  79. #endif
  80.  
  81.