]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/TOOLS/BLD/INC/STDIO.H

wirehaze git hosting

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