home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_01 / 1001008a < prev    next >
Text File  |  1991-11-18  |  3KB  |  107 lines

  1. Listing 1 -- The file stdio.h
  2.  
  3.  
  4. /* stdio.h standard header */
  5. #ifndef _STDIO
  6. #define _STDIO
  7. #ifndef _YVALS
  8. #include <yvals.h>
  9. #endif
  10.         /* macros */
  11. #define NULL        _NULL
  12. #define _IOFBF        0
  13. #define _IOLBF        1
  14. #define _IONBF        2
  15. #define BUFSIZ        512
  16. #define EOF            -1
  17. #define FILENAME_MAX    _FNAMAX
  18. #define FOPEN_MAX        _FOPMAX
  19. #define L_tmpnam        _TNAMAX
  20. #define TMP_MAX            32
  21. #define SEEK_SET    0
  22. #define SEEK_CUR    1
  23. #define SEEK_END    2
  24. #define stdin        _Files[0]
  25. #define stdout        _Files[1]
  26. #define stderr        _Files[2]
  27.         /* type definitions */
  28. #ifndef _SIZET
  29. #define _SIZET
  30. typedef _Sizet size_t;
  31. #endif
  32. typedef struct {
  33.     unsigned long _Off;    /* system dependent */
  34.     } fpos_t;
  35. typedef struct {
  36.     unsigned short _Mode;
  37.     short _Handle;
  38.     unsigned char *_Buf, *_Bend, *_Next;
  39.     unsigned char *_Rend, *_Rsave, *_Wend;
  40.     unsigned char _Back[2], _Cbuf, _Nback;
  41.     char *_Tmpnam;
  42.     } FILE;
  43.         /* declarations */
  44. void clearerr(FILE *);
  45. int fclose(FILE *);
  46. int feof(FILE *);
  47. int ferror(FILE *);
  48. int fflush(FILE *);
  49. int fgetc(FILE *);
  50. int fgetpos(FILE *, fpos_t *);
  51. char *fgets(char *, int, FILE *);
  52. FILE *fopen(const char *, const char *);
  53. int fprintf(FILE *, const char *, ...);
  54. int fputc(int, FILE *);
  55. int fputs(const char *, FILE *);
  56. size_t fread(void *, size_t, size_t, FILE *);
  57. FILE *freopen(const char *, const char *, FILE *);
  58. int fscanf(FILE *, const char *, ...);
  59. int fseek(FILE *, long, int);
  60. int fsetpos(FILE *, const fpos_t *);
  61. long ftell(FILE *);
  62. size_t fwrite(const void *, size_t, size_t, FILE *);
  63. int getc(FILE *);
  64. int getchar(void);
  65. char *gets(char *);
  66. void perror(const char *);
  67. int printf(const char *, ...);
  68. int putc(int, FILE *);
  69. int putchar(int);
  70. int puts(const char *);
  71. int remove(const char *);
  72. int rename(const char *, const char *);
  73. void rewind(FILE *);
  74. int scanf(const char *, ...);
  75. void setbuf(FILE *, char *);
  76. int setvbuf(FILE *, char *, int, size_t);
  77. int sprintf(char *, const char *, ...);
  78. int sscanf(const char *, const char *, ...);
  79. FILE *tmpfile(void);
  80. char *tmpnam(char *);
  81. int ungetc(int, FILE *);
  82. int vfprintf(FILE *, const char *, char *);
  83. int vprintf(const char *, char *);
  84. int vsprintf(char *, const char *, char *);
  85. long _Fgpos(FILE *, fpos_t *);
  86. int _Fspos(FILE *, const fpos_t *, long, int);
  87. extern FILE *_Files[FOPEN_MAX];
  88.         /* macro overrides */
  89. #define fgetpos(str, ptr)    (int)_Fgpos(str, ptr)
  90. #define fseek(str, off, way)    _Fspos(str, _NULL, off, way)
  91. #define fsetpos(str, ptr)    _Fspos(str, ptr, 0L, 0)
  92. #define ftell(str)    _Fgpos(str, _NULL)
  93. #define getc(str)    ((str)->_Next < (str)->_Rend \
  94.     ? *(str)->_Next++ : (getc)(str))
  95. #define getchar()    \
  96.     (_Files[0]->_Next < _Files[0]->_Rend \
  97.     ? *_Files[0]->_Next++ : (getchar)())
  98. #define putc(c, str)    \
  99.     ((str)->_Next < (str)->_Wend \
  100.     ? (*(str)->_Next++ = c) : (putc)(c, str))
  101. #define putchar(c)    \
  102.     (_Files[1]->_Next < _Files[1]->_Wend \
  103.     ? (*_Files[1]->_Next++ = c) : (putchar)(c))
  104. #endif
  105.  
  106.  
  107.