Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
4.4 KiB

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. * Copyright (c) 1985-1988, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the structures, values, macros, and functions
  8. * used by the level 2 I/O ("standard I/O") routines.
  9. * [ANSI/System V]
  10. *
  11. *******************************************************************************/
  12. #ifndef _SIZE_T_DEFINED
  13. typedef unsigned int size_t;
  14. #define _SIZE_T_DEFINED
  15. #endif
  16. #ifndef _VA_LIST_DEFINED
  17. typedef char *va_list;
  18. #define _VA_LIST_DEFINED
  19. #endif
  20. #ifndef NO_EXT_KEYS /* extensions enabled */
  21. #define _CDECL cdecl
  22. #define _NEAR near
  23. #else /* extensions not enabled */
  24. #define _CDECL
  25. #define _NEAR
  26. #endif /* NO_EXT_KEYS */
  27. /* buffered I/O macros */
  28. #define BUFSIZ 512
  29. #define _NFILE 20
  30. #define EOF (-1)
  31. #ifndef _FILE_DEFINED
  32. #define FILE struct _iobuf
  33. #define _FILE_DEFINED
  34. #endif
  35. /* P_tmpnam: Directory where temporary files may be created.
  36. * L_tmpnam size = size of P_tmpdir
  37. * + 1 (in case P_tmpdir does not end in "\\")
  38. * + 6 (for the temp number string)
  39. * + 1 (for the null terminator)
  40. */
  41. #define P_tmpdir "\\"
  42. #define L_tmpnam sizeof(P_tmpdir)+8
  43. #define SEEK_CUR 1
  44. #define SEEK_END 2
  45. #define SEEK_SET 0
  46. #define SYS_OPEN 20
  47. #define TMP_MAX 32767
  48. /* define NULL pointer value */
  49. #if (defined(M_I86SM) || defined(M_I86MM))
  50. #define NULL 0
  51. #elif (defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  52. #define NULL 0L
  53. #endif
  54. /* define file control block */
  55. #ifndef _IOB_DEFINED
  56. extern FILE {
  57. char *_ptr;
  58. int _cnt;
  59. char *_base;
  60. char _flag;
  61. char _file;
  62. } _NEAR _CDECL _iob[];
  63. #define _IOB_DEFINED
  64. #endif
  65. #define fpos_t long /* file position variable */
  66. #define stdin (&_iob[0])
  67. #define stdout (&_iob[1])
  68. #define stderr (&_iob[2])
  69. #define stdaux (&_iob[3])
  70. #define stdprn (&_iob[4])
  71. #define _IOREAD 0x01
  72. #define _IOWRT 0x02
  73. #define _IOFBF 0x0
  74. #define _IOLBF 0x40
  75. #define _IONBF 0x04
  76. #define _IOMYBUF 0x08
  77. #define _IOEOF 0x10
  78. #define _IOERR 0x20
  79. #define _IOSTRG 0x40
  80. #define _IORW 0x80
  81. #define getc(f) (--(f)->_cnt >= 0 ? 0xff & *(f)->_ptr++ : _filbuf(f))
  82. #define putc(c,f) (--(f)->_cnt >= 0 ? 0xff & (*(f)->_ptr++ = (char)(c)) \
  83. : _flsbuf((c),(f)))
  84. #define getchar() getc(stdin)
  85. #define putchar(c) putc((c),stdout)
  86. #define feof(f) ((f)->_flag & _IOEOF)
  87. #define ferror(f) ((f)->_flag & _IOERR)
  88. #define fileno(f) ((f)->_file)
  89. /* function prototypes */
  90. int _CDECL _filbuf(FILE *);
  91. int _CDECL _flsbuf(int, FILE *);
  92. void _CDECL clearerr(FILE *);
  93. int _CDECL fclose(FILE *);
  94. int _CDECL fcloseall(void);
  95. FILE * _CDECL fdopen(int, char *);
  96. int _CDECL fflush(FILE *);
  97. int _CDECL fgetc(FILE *);
  98. int _CDECL fgetchar(void);
  99. int _CDECL fgetpos(FILE *, fpos_t *);
  100. char * _CDECL fgets(char *, int, FILE *);
  101. int _CDECL flushall(void);
  102. FILE * _CDECL fopen(const char *, const char *);
  103. int _CDECL fprintf(FILE *, const char *, ...);
  104. int _CDECL fputc(int, FILE *);
  105. int _CDECL fputchar(int);
  106. int _CDECL fputs(const char *, FILE *);
  107. size_t _CDECL fread(void *, size_t, size_t, FILE *);
  108. FILE * _CDECL freopen(const char *, const char *, FILE *);
  109. int _CDECL fscanf(FILE *, const char *, ...);
  110. int _CDECL fsetpos(FILE *, const fpos_t *);
  111. int _CDECL fseek(FILE *, long, int);
  112. long _CDECL ftell(FILE *);
  113. size_t _CDECL fwrite(const void *, size_t, size_t, FILE *);
  114. char * _CDECL gets(char *);
  115. int _CDECL getw(FILE *);
  116. void _CDECL perror(const char *);
  117. int _CDECL printf(const char *, ...);
  118. int _CDECL puts(const char *);
  119. int _CDECL putw(int, FILE *);
  120. int _CDECL remove(const char *);
  121. int _CDECL rename(const char *, const char *);
  122. void _CDECL rewind(FILE *);
  123. int _CDECL rmtmp(void);
  124. int _CDECL scanf(const char *, ...);
  125. void _CDECL setbuf(FILE *, char *);
  126. int _CDECL setvbuf(FILE *, char *, int, size_t);
  127. int _CDECL sprintf(char *, const char *, ...);
  128. int _CDECL sscanf(const char *, const char *, ...);
  129. char * _CDECL tempnam(char *, char *);
  130. FILE * _CDECL tmpfile(void);
  131. char * _CDECL tmpnam(char *);
  132. int _CDECL ungetc(int, FILE *);
  133. int _CDECL unlink(const char *);
  134. int _CDECL vfprintf(FILE *, const char *, va_list);
  135. int _CDECL vprintf(const char *, va_list);
  136. int _CDECL vsprintf(char *, const char *, va_list);