Subversion Repositories Kolibri OS

Rev

Rev 6536 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6536 Rev 8777
1
/*
1
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms are permitted
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 *
16
 *
17
 *	@(#)stdio.h	5.3 (Berkeley) 3/15/86
17
 *	@(#)stdio.h	5.3 (Berkeley) 3/15/86
18
 */
18
 */
19
 
19
 
20
/*
20
/*
21
 * NB: to fit things in six character monocase externals, the
21
 * NB: to fit things in six character monocase externals, the
22
 * stdio code uses the prefix `__s' for stdio objects, typically
22
 * stdio code uses the prefix `__s' for stdio objects, typically
23
 * followed by a three-character attempt at a mnemonic.
23
 * followed by a three-character attempt at a mnemonic.
24
 */
24
 */
25
 
25
 
26
#ifndef _STDIO_H_
26
#ifndef _STDIO_H_
27
#define	_STDIO_H_
27
#define	_STDIO_H_
28
 
28
 
29
#include "_ansi.h"
29
#include "_ansi.h"
30
 
30
 
31
#define	_FSTDIO			/* ``function stdio'' */
31
#define	_FSTDIO			/* ``function stdio'' */
32
 
32
 
33
#define __need_size_t
33
#define __need_size_t
34
#define __need_NULL
34
#define __need_NULL
35
#include 
35
#include 
36
#include 
36
#include 
37
 
37
 
38
#define __need___va_list
38
#define __need___va_list
39
#include 
39
#include 
40
 
40
 
41
/*
41
/*
42
 *  defines __FILE, _fpos_t.
42
 *  defines __FILE, _fpos_t.
43
 * They must be defined there because struct _reent needs them (and we don't
43
 * They must be defined there because struct _reent needs them (and we don't
44
 * want reent.h to include this file.
44
 * want reent.h to include this file.
45
 */
45
 */
46
 
46
 
47
#include 
47
#include 
48
#include 
48
#include 
49
 
49
 
50
_BEGIN_STD_C
50
_BEGIN_STD_C
51
 
51
 
52
#if !defined(__FILE_defined)
52
#if !defined(__FILE_defined)
53
typedef __FILE FILE;
53
typedef __FILE FILE;
54
# define __FILE_defined
54
# define __FILE_defined
55
#endif
55
#endif
56
 
56
 
57
#ifdef __CYGWIN__
57
#ifdef __CYGWIN__
58
typedef _fpos64_t fpos_t;
58
typedef _fpos64_t fpos_t;
59
#else
59
#else
60
typedef _fpos_t fpos_t;
60
typedef _fpos_t fpos_t;
61
#ifdef __LARGE64_FILES
61
#ifdef __LARGE64_FILES
62
typedef _fpos64_t fpos64_t;
62
typedef _fpos64_t fpos64_t;
63
#endif
63
#endif
64
#endif /* !__CYGWIN__ */
64
#endif /* !__CYGWIN__ */
65
 
65
 
66
#include 
66
#include 
67
 
67
 
68
#define	__SLBF	0x0001		/* line buffered */
68
#define	__SLBF	0x0001		/* line buffered */
69
#define	__SNBF	0x0002		/* unbuffered */
69
#define	__SNBF	0x0002		/* unbuffered */
70
#define	__SRD	0x0004		/* OK to read */
70
#define	__SRD	0x0004		/* OK to read */
71
#define	__SWR	0x0008		/* OK to write */
71
#define	__SWR	0x0008		/* OK to write */
72
	/* RD and WR are never simultaneously asserted */
72
	/* RD and WR are never simultaneously asserted */
73
#define	__SRW	0x0010		/* open for reading & writing */
73
#define	__SRW	0x0010		/* open for reading & writing */
74
#define	__SEOF	0x0020		/* found EOF */
74
#define	__SEOF	0x0020		/* found EOF */
75
#define	__SERR	0x0040		/* found error */
75
#define	__SERR	0x0040		/* found error */
76
#define	__SMBF	0x0080		/* _buf is from malloc */
76
#define	__SMBF	0x0080		/* _buf is from malloc */
77
#define	__SAPP	0x0100		/* fdopen()ed in append mode - so must  write to end */
77
#define	__SAPP	0x0100		/* fdopen()ed in append mode - so must  write to end */
78
#define	__SSTR	0x0200		/* this is an sprintf/snprintf string */
78
#define	__SSTR	0x0200		/* this is an sprintf/snprintf string */
79
#define	__SOPT	0x0400		/* do fseek() optimisation */
79
#define	__SOPT	0x0400		/* do fseek() optimisation */
80
#define	__SNPT	0x0800		/* do not do fseek() optimisation */
80
#define	__SNPT	0x0800		/* do not do fseek() optimisation */
81
#define	__SOFF	0x1000		/* set iff _offset is in fact correct */
81
#define	__SOFF	0x1000		/* set iff _offset is in fact correct */
82
#define	__SORD	0x2000		/* true => stream orientation (byte/wide) decided */
82
#define	__SORD	0x2000		/* true => stream orientation (byte/wide) decided */
83
#if defined(__CYGWIN__)
83
#if defined(__CYGWIN__)
84
#  define __SCLE  0x4000        /* convert line endings CR/LF <-> NL */
84
#  define __SCLE  0x4000        /* convert line endings CR/LF <-> NL */
85
#endif
85
#endif
86
#define	__SL64	0x8000		/* is 64-bit offset large file */
86
#define	__SL64	0x8000		/* is 64-bit offset large file */
87
 
87
 
88
/* _flags2 flags */
88
/* _flags2 flags */
89
#define	__SNLK  0x0001		/* stdio functions do not lock streams themselves */
89
#define	__SNLK  0x0001		/* stdio functions do not lock streams themselves */
90
#define	__SWID	0x2000		/* true => stream orientation wide, false => byte, only valid if __SORD in _flags is true */
90
#define	__SWID	0x2000		/* true => stream orientation wide, false => byte, only valid if __SORD in _flags is true */
91
 
91
 
92
/*
92
/*
93
 * The following three definitions are for ANSI C, which took them
93
 * The following three definitions are for ANSI C, which took them
94
 * from System V, which stupidly took internal interface macros and
94
 * from System V, which stupidly took internal interface macros and
95
 * made them official arguments to setvbuf(), without renaming them.
95
 * made them official arguments to setvbuf(), without renaming them.
96
 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
96
 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
97
 *
97
 *
98
 * Although these happen to match their counterparts above, the
98
 * Although these happen to match their counterparts above, the
99
 * implementation does not rely on that (so these could be renumbered).
99
 * implementation does not rely on that (so these could be renumbered).
100
 */
100
 */
101
#define	_IOFBF	0		/* setvbuf should set fully buffered */
101
#define	_IOFBF	0		/* setvbuf should set fully buffered */
102
#define	_IOLBF	1		/* setvbuf should set line buffered */
102
#define	_IOLBF	1		/* setvbuf should set line buffered */
103
#define	_IONBF	2		/* setvbuf should set unbuffered */
103
#define	_IONBF	2		/* setvbuf should set unbuffered */
104
 
104
 
105
#define	EOF	(-1)
105
#define	EOF	(-1)
106
 
106
 
107
#ifdef __BUFSIZ__
107
#ifdef __BUFSIZ__
108
#define	BUFSIZ		__BUFSIZ__
108
#define	BUFSIZ		__BUFSIZ__
109
#else
109
#else
110
#define	BUFSIZ		1024
110
#define	BUFSIZ		1024
111
#endif
111
#endif
112
 
112
 
113
#ifdef __FOPEN_MAX__
113
#ifdef __FOPEN_MAX__
114
#define FOPEN_MAX	__FOPEN_MAX__
114
#define FOPEN_MAX	__FOPEN_MAX__
115
#else
115
#else
116
#define	FOPEN_MAX	20
116
#define	FOPEN_MAX	20
117
#endif
117
#endif
118
 
118
 
119
#ifdef __FILENAME_MAX__
119
#ifdef __FILENAME_MAX__
120
#define FILENAME_MAX    __FILENAME_MAX__
120
#define FILENAME_MAX    __FILENAME_MAX__
121
#else
121
#else
122
#define	FILENAME_MAX	1024
122
#define	FILENAME_MAX	1024
123
#endif
123
#endif
124
 
124
 
125
#ifdef __L_tmpnam__
125
#ifdef __L_tmpnam__
126
#define L_tmpnam	__L_tmpnam__
126
#define L_tmpnam	__L_tmpnam__
127
#else
127
#else
128
#define	L_tmpnam	FILENAME_MAX
128
#define	L_tmpnam	FILENAME_MAX
129
#endif
129
#endif
130
 
130
 
131
#if __BSD_VISIBLE || __XSI_VISIBLE
131
#if __BSD_VISIBLE || __XSI_VISIBLE
132
#define P_tmpdir        "/tmp"
132
#define P_tmpdir        "/tmp"
133
#endif
133
#endif
134
 
134
 
135
#ifndef SEEK_SET
135
#ifndef SEEK_SET
136
#define	SEEK_SET	0	/* set file offset to offset */
136
#define	SEEK_SET	0	/* set file offset to offset */
137
#endif
137
#endif
138
#ifndef SEEK_CUR
138
#ifndef SEEK_CUR
139
#define	SEEK_CUR	1	/* set file offset to current plus offset */
139
#define	SEEK_CUR	1	/* set file offset to current plus offset */
140
#endif
140
#endif
141
#ifndef SEEK_END
141
#ifndef SEEK_END
142
#define	SEEK_END	2	/* set file offset to EOF plus offset */
142
#define	SEEK_END	2	/* set file offset to EOF plus offset */
143
#endif
143
#endif
144
 
144
 
145
#define	TMP_MAX		26
145
#define	TMP_MAX		26
146
 
146
 
147
#define	stdin	(_REENT->_stdin)
147
#define	stdin	(_REENT->_stdin)
148
#define	stdout	(_REENT->_stdout)
148
#define	stdout	(_REENT->_stdout)
-
 
149
 
-
 
150
#ifndef _NO_STDERR
149
#define	stderr	(_REENT->_stderr)
151
  #define	stderr	(_REENT->_stderr)
-
 
152
#else
-
 
153
  #define stderr stdout
-
 
154
#endif
150
 
155
 
151
#define _stdin_r(x)	((x)->_stdin)
156
#define _stdin_r(x)	((x)->_stdin)
152
#define _stdout_r(x)	((x)->_stdout)
157
#define _stdout_r(x)	((x)->_stdout)
153
#define _stderr_r(x)	((x)->_stderr)
158
#define _stderr_r(x)	((x)->_stderr)
-
 
159
 
-
 
160
 
154
 
161
 
155
/*
162
/*
156
 * Functions defined in ANSI C standard.
163
 * Functions defined in ANSI C standard.
157
 */
164
 */
158
 
165
 
159
#ifndef __VALIST
166
#ifndef __VALIST
160
#ifdef __GNUC__
167
#ifdef __GNUC__
161
#define __VALIST __gnuc_va_list
168
#define __VALIST __gnuc_va_list
162
#else
169
#else
163
#define __VALIST char*
170
#define __VALIST char*
164
#endif
171
#endif
165
#endif
172
#endif
166
 
173
 
167
FILE *	_EXFUN(tmpfile, (void));
174
FILE *	_EXFUN(tmpfile, (void));
168
char *	_EXFUN(tmpnam, (char *));
175
char *	_EXFUN(tmpnam, (char *));
169
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
176
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
170
char *	_EXFUN(tempnam, (const char *, const char *));
177
char *	_EXFUN(tempnam, (const char *, const char *));
171
#endif
178
#endif
172
int	_EXFUN(fclose, (FILE *));
179
int	_EXFUN(fclose, (FILE *));
173
int	_EXFUN(fflush, (FILE *));
180
int	_EXFUN(fflush, (FILE *));
174
FILE *	_EXFUN(freopen, (const char *__restrict, const char *__restrict, FILE *__restrict));
181
FILE *	_EXFUN(freopen, (const char *__restrict, const char *__restrict, FILE *__restrict));
175
void	_EXFUN(setbuf, (FILE *__restrict, char *__restrict));
182
void	_EXFUN(setbuf, (FILE *__restrict, char *__restrict));
176
int	_EXFUN(setvbuf, (FILE *__restrict, char *__restrict, int, size_t));
183
int	_EXFUN(setvbuf, (FILE *__restrict, char *__restrict, int, size_t));
177
int	_EXFUN(fprintf, (FILE *__restrict, const char *__restrict, ...)
184
int	_EXFUN(fprintf, (FILE *__restrict, const char *__restrict, ...)
178
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
185
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
179
int	_EXFUN(fscanf, (FILE *__restrict, const char *__restrict, ...)
186
int	_EXFUN(fscanf, (FILE *__restrict, const char *__restrict, ...)
180
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
187
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
181
int	_EXFUN(printf, (const char *__restrict, ...)
188
int	_EXFUN(printf, (const char *__restrict, ...)
182
               _ATTRIBUTE ((__format__ (__printf__, 1, 2))));
189
               _ATTRIBUTE ((__format__ (__printf__, 1, 2))));
183
int	_EXFUN(scanf, (const char *__restrict, ...)
190
int	_EXFUN(scanf, (const char *__restrict, ...)
184
               _ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
191
               _ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
185
int	_EXFUN(sscanf, (const char *__restrict, const char *__restrict, ...)
192
int	_EXFUN(sscanf, (const char *__restrict, const char *__restrict, ...)
186
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
193
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
187
int	_EXFUN(vfprintf, (FILE *__restrict, const char *__restrict, __VALIST)
194
int	_EXFUN(vfprintf, (FILE *__restrict, const char *__restrict, __VALIST)
188
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
195
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
189
int	_EXFUN(vprintf, (const char *, __VALIST)
196
int	_EXFUN(vprintf, (const char *, __VALIST)
190
               _ATTRIBUTE ((__format__ (__printf__, 1, 0))));
197
               _ATTRIBUTE ((__format__ (__printf__, 1, 0))));
191
int	_EXFUN(vsprintf, (char *__restrict, const char *__restrict, __VALIST)
198
int	_EXFUN(vsprintf, (char *__restrict, const char *__restrict, __VALIST)
192
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
199
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
193
int	_EXFUN(fgetc, (FILE *));
200
int	_EXFUN(fgetc, (FILE *));
194
char *  _EXFUN(fgets, (char *__restrict, int, FILE *__restrict));
201
char *  _EXFUN(fgets, (char *__restrict, int, FILE *__restrict));
195
int	_EXFUN(fputc, (int, FILE *));
202
int	_EXFUN(fputc, (int, FILE *));
196
int	_EXFUN(fputs, (const char *__restrict, FILE *__restrict));
203
int	_EXFUN(fputs, (const char *__restrict, FILE *__restrict));
197
int	_EXFUN(getc, (FILE *));
204
int	_EXFUN(getc, (FILE *));
198
int	_EXFUN(getchar, (void));
205
int	_EXFUN(getchar, (void));
199
char *  _EXFUN(gets, (char *));
206
char *  _EXFUN(gets, (char *));
200
int	_EXFUN(putc, (int, FILE *));
207
int	_EXFUN(putc, (int, FILE *));
201
int	_EXFUN(putchar, (int));
208
int	_EXFUN(putchar, (int));
202
int	_EXFUN(puts, (const char *));
209
int	_EXFUN(puts, (const char *));
203
int	_EXFUN(ungetc, (int, FILE *));
210
int	_EXFUN(ungetc, (int, FILE *));
204
size_t	_EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
211
size_t	_EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
205
size_t	_EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
212
size_t	_EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
206
#ifdef _COMPILING_NEWLIB
213
#ifdef _COMPILING_NEWLIB
207
int	_EXFUN(fgetpos, (FILE *, _fpos_t *));
214
int	_EXFUN(fgetpos, (FILE *, _fpos_t *));
208
#else
215
#else
209
int	_EXFUN(fgetpos, (FILE *__restrict, fpos_t *__restrict));
216
int	_EXFUN(fgetpos, (FILE *__restrict, fpos_t *__restrict));
210
#endif
217
#endif
211
int	_EXFUN(fseek, (FILE *, long, int));
218
int	_EXFUN(fseek, (FILE *, long, int));
212
#ifdef _COMPILING_NEWLIB
219
#ifdef _COMPILING_NEWLIB
213
int	_EXFUN(fsetpos, (FILE *, const _fpos_t *));
220
int	_EXFUN(fsetpos, (FILE *, const _fpos_t *));
214
#else
221
#else
215
int	_EXFUN(fsetpos, (FILE *, const fpos_t *));
222
int	_EXFUN(fsetpos, (FILE *, const fpos_t *));
216
#endif
223
#endif
217
long	_EXFUN(ftell, ( FILE *));
224
long	_EXFUN(ftell, ( FILE *));
218
void	_EXFUN(rewind, (FILE *));
225
void	_EXFUN(rewind, (FILE *));
219
void	_EXFUN(clearerr, (FILE *));
226
void	_EXFUN(clearerr, (FILE *));
220
int	_EXFUN(feof, (FILE *));
227
int	_EXFUN(feof, (FILE *));
221
int	_EXFUN(ferror, (FILE *));
228
int	_EXFUN(ferror, (FILE *));
222
void    _EXFUN(perror, (const char *));
229
void    _EXFUN(perror, (const char *));
223
#ifndef _REENT_ONLY
230
#ifndef _REENT_ONLY
224
FILE *	_EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type));
231
FILE *	_EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type));
225
int	_EXFUN(sprintf, (char *__restrict, const char *__restrict, ...)
232
int	_EXFUN(sprintf, (char *__restrict, const char *__restrict, ...)
226
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
233
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
227
int	_EXFUN(remove, (const char *));
234
int	_EXFUN(remove, (const char *));
228
int	_EXFUN(rename, (const char *, const char *));
235
int	_EXFUN(rename, (const char *, const char *));
229
#ifdef _COMPILING_NEWLIB
236
#ifdef _COMPILING_NEWLIB
230
int	_EXFUN(_rename, (const char *, const char *));
237
int	_EXFUN(_rename, (const char *, const char *));
231
#endif
238
#endif
232
#endif
239
#endif
233
#if __LARGEFILE_VISIBLE || __POSIX_VISIBLE >= 200112
240
#if __LARGEFILE_VISIBLE || __POSIX_VISIBLE >= 200112
234
#ifdef _COMPILING_NEWLIB
241
#ifdef _COMPILING_NEWLIB
235
int	_EXFUN(fseeko, (FILE *, _off_t, int));
242
int	_EXFUN(fseeko, (FILE *, _off_t, int));
236
_off_t	_EXFUN(ftello, ( FILE *));
243
_off_t	_EXFUN(ftello, ( FILE *));
237
#else
244
#else
238
int	_EXFUN(fseeko, (FILE *, off_t, int));
245
int	_EXFUN(fseeko, (FILE *, off_t, int));
239
off_t	_EXFUN(ftello, ( FILE *));
246
off_t	_EXFUN(ftello, ( FILE *));
240
#endif
247
#endif
241
#endif
248
#endif
242
#if __GNU_VISIBLE
249
#if __GNU_VISIBLE
243
int	_EXFUN(fcloseall, (_VOID));
250
int	_EXFUN(fcloseall, (_VOID));
244
#endif
251
#endif
245
#ifndef _REENT_ONLY
252
#ifndef _REENT_ONLY
246
#if __ISO_C_VISIBLE >= 1999
253
#if __ISO_C_VISIBLE >= 1999
247
int	_EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
254
int	_EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
248
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
255
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
249
int	_EXFUN(vsnprintf, (char *__restrict, size_t, const char *__restrict, __VALIST)
256
int	_EXFUN(vsnprintf, (char *__restrict, size_t, const char *__restrict, __VALIST)
250
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
257
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
251
int	_EXFUN(vfscanf, (FILE *__restrict, const char *__restrict, __VALIST)
258
int	_EXFUN(vfscanf, (FILE *__restrict, const char *__restrict, __VALIST)
252
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
259
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
253
int	_EXFUN(vscanf, (const char *, __VALIST)
260
int	_EXFUN(vscanf, (const char *, __VALIST)
254
               _ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
261
               _ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
255
int	_EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST)
262
int	_EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST)
256
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
263
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
257
#endif
264
#endif
258
#if __GNU_VISIBLE
265
#if __GNU_VISIBLE
259
int	_EXFUN(asprintf, (char **__restrict, const char *__restrict, ...)
266
int	_EXFUN(asprintf, (char **__restrict, const char *__restrict, ...)
260
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
267
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
261
int	_EXFUN(vasprintf, (char **, const char *, __VALIST)
268
int	_EXFUN(vasprintf, (char **, const char *, __VALIST)
262
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
269
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
263
#endif
270
#endif
264
#if __MISC_VISIBLE /* Newlib-specific */
271
#if __MISC_VISIBLE /* Newlib-specific */
265
int	_EXFUN(asiprintf, (char **, const char *, ...)
272
int	_EXFUN(asiprintf, (char **, const char *, ...)
266
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
273
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
267
char *	_EXFUN(asniprintf, (char *, size_t *, const char *, ...)
274
char *	_EXFUN(asniprintf, (char *, size_t *, const char *, ...)
268
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
275
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
269
char *	_EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...)
276
char *	_EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...)
270
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
277
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
271
#ifndef diprintf
278
#ifndef diprintf
272
int	_EXFUN(diprintf, (int, const char *, ...)
279
int	_EXFUN(diprintf, (int, const char *, ...)
273
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
280
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
274
#endif
281
#endif
275
int	_EXFUN(fiprintf, (FILE *, const char *, ...)
282
int	_EXFUN(fiprintf, (FILE *, const char *, ...)
276
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
283
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
277
int	_EXFUN(fiscanf, (FILE *, const char *, ...)
284
int	_EXFUN(fiscanf, (FILE *, const char *, ...)
278
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
285
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
279
int	_EXFUN(iprintf, (const char *, ...)
286
int	_EXFUN(iprintf, (const char *, ...)
280
               _ATTRIBUTE ((__format__ (__printf__, 1, 2))));
287
               _ATTRIBUTE ((__format__ (__printf__, 1, 2))));
281
int	_EXFUN(iscanf, (const char *, ...)
288
int	_EXFUN(iscanf, (const char *, ...)
282
               _ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
289
               _ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
283
int	_EXFUN(siprintf, (char *, const char *, ...)
290
int	_EXFUN(siprintf, (char *, const char *, ...)
284
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
291
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
285
int	_EXFUN(siscanf, (const char *, const char *, ...)
292
int	_EXFUN(siscanf, (const char *, const char *, ...)
286
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
293
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
287
int	_EXFUN(sniprintf, (char *, size_t, const char *, ...)
294
int	_EXFUN(sniprintf, (char *, size_t, const char *, ...)
288
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
295
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
289
int	_EXFUN(vasiprintf, (char **, const char *, __VALIST)
296
int	_EXFUN(vasiprintf, (char **, const char *, __VALIST)
290
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
297
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
291
char *	_EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST)
298
char *	_EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST)
292
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
299
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
293
char *	_EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST)
300
char *	_EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST)
294
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
301
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
295
int	_EXFUN(vdiprintf, (int, const char *, __VALIST)
302
int	_EXFUN(vdiprintf, (int, const char *, __VALIST)
296
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
303
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
297
int	_EXFUN(vfiprintf, (FILE *, const char *, __VALIST)
304
int	_EXFUN(vfiprintf, (FILE *, const char *, __VALIST)
298
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
305
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
299
int	_EXFUN(vfiscanf, (FILE *, const char *, __VALIST)
306
int	_EXFUN(vfiscanf, (FILE *, const char *, __VALIST)
300
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
307
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
301
int	_EXFUN(viprintf, (const char *, __VALIST)
308
int	_EXFUN(viprintf, (const char *, __VALIST)
302
               _ATTRIBUTE ((__format__ (__printf__, 1, 0))));
309
               _ATTRIBUTE ((__format__ (__printf__, 1, 0))));
303
int	_EXFUN(viscanf, (const char *, __VALIST)
310
int	_EXFUN(viscanf, (const char *, __VALIST)
304
               _ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
311
               _ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
305
int	_EXFUN(vsiprintf, (char *, const char *, __VALIST)
312
int	_EXFUN(vsiprintf, (char *, const char *, __VALIST)
306
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
313
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
307
int	_EXFUN(vsiscanf, (const char *, const char *, __VALIST)
314
int	_EXFUN(vsiscanf, (const char *, const char *, __VALIST)
308
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
315
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
309
int	_EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST)
316
int	_EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST)
310
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
317
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
311
#endif /* __MISC_VISIBLE */
318
#endif /* __MISC_VISIBLE */
312
#endif /* !_REENT_ONLY */
319
#endif /* !_REENT_ONLY */
313
 
320
 
314
/*
321
/*
315
 * Routines in POSIX 1003.1:2001.
322
 * Routines in POSIX 1003.1:2001.
316
 */
323
 */
317
 
324
 
318
#if __POSIX_VISIBLE
325
#if __POSIX_VISIBLE
319
#ifndef _REENT_ONLY
326
#ifndef _REENT_ONLY
320
FILE *	_EXFUN(fdopen, (int, const char *));
327
FILE *	_EXFUN(fdopen, (int, const char *));
321
#endif
328
#endif
322
int	_EXFUN(fileno, (FILE *));
329
int	_EXFUN(fileno, (FILE *));
323
#endif
330
#endif
324
#if __MISC_VISIBLE || __POSIX_VISIBLE >= 199209
331
#if __MISC_VISIBLE || __POSIX_VISIBLE >= 199209
325
int	_EXFUN(pclose, (FILE *));
332
int	_EXFUN(pclose, (FILE *));
326
FILE *  _EXFUN(popen, (const char *, const char *));
333
FILE *  _EXFUN(popen, (const char *, const char *));
327
#endif
334
#endif
328
 
335
 
329
#if __BSD_VISIBLE
336
#if __BSD_VISIBLE
330
void    _EXFUN(setbuffer, (FILE *, char *, int));
337
void    _EXFUN(setbuffer, (FILE *, char *, int));
331
int	_EXFUN(setlinebuf, (FILE *));
338
int	_EXFUN(setlinebuf, (FILE *));
332
#endif
339
#endif
333
 
340
 
334
#if __MISC_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112)
341
#if __MISC_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112)
335
int	_EXFUN(getw, (FILE *));
342
int	_EXFUN(getw, (FILE *));
336
int	_EXFUN(putw, (int, FILE *));
343
int	_EXFUN(putw, (int, FILE *));
337
#endif
344
#endif
338
#if __MISC_VISIBLE || __POSIX_VISIBLE
345
#if __MISC_VISIBLE || __POSIX_VISIBLE
339
int	_EXFUN(getc_unlocked, (FILE *));
346
int	_EXFUN(getc_unlocked, (FILE *));
340
int	_EXFUN(getchar_unlocked, (void));
347
int	_EXFUN(getchar_unlocked, (void));
341
void	_EXFUN(flockfile, (FILE *));
348
void	_EXFUN(flockfile, (FILE *));
342
int	_EXFUN(ftrylockfile, (FILE *));
349
int	_EXFUN(ftrylockfile, (FILE *));
343
void	_EXFUN(funlockfile, (FILE *));
350
void	_EXFUN(funlockfile, (FILE *));
344
int	_EXFUN(putc_unlocked, (int, FILE *));
351
int	_EXFUN(putc_unlocked, (int, FILE *));
345
int	_EXFUN(putchar_unlocked, (int));
352
int	_EXFUN(putchar_unlocked, (int));
346
#endif
353
#endif
347
 
354
 
348
/*
355
/*
349
 * Routines in POSIX 1003.1:200x.
356
 * Routines in POSIX 1003.1:200x.
350
 */
357
 */
351
 
358
 
352
#if __POSIX_VISIBLE >= 200809
359
#if __POSIX_VISIBLE >= 200809
353
# ifndef _REENT_ONLY
360
# ifndef _REENT_ONLY
354
#  ifndef dprintf
361
#  ifndef dprintf
355
int	_EXFUN(dprintf, (int, const char *__restrict, ...)
362
int	_EXFUN(dprintf, (int, const char *__restrict, ...)
356
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
363
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
357
#  endif
364
#  endif
358
FILE *	_EXFUN(fmemopen, (void *__restrict, size_t, const char *__restrict));
365
FILE *	_EXFUN(fmemopen, (void *__restrict, size_t, const char *__restrict));
359
/* getdelim - see __getdelim for now */
366
/* getdelim - see __getdelim for now */
360
/* getline - see __getline for now */
367
/* getline - see __getline for now */
361
FILE *	_EXFUN(open_memstream, (char **, size_t *));
368
FILE *	_EXFUN(open_memstream, (char **, size_t *));
362
int	_EXFUN(vdprintf, (int, const char *__restrict, __VALIST)
369
int	_EXFUN(vdprintf, (int, const char *__restrict, __VALIST)
363
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
370
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
364
# endif
371
# endif
365
#endif
372
#endif
366
#if __ATFILE_VISIBLE
373
#if __ATFILE_VISIBLE
367
int	_EXFUN(renameat, (int, const char *, int, const char *));
374
int	_EXFUN(renameat, (int, const char *, int, const char *));
368
#endif
375
#endif
369
 
376
 
370
/*
377
/*
371
 * Recursive versions of the above.
378
 * Recursive versions of the above.
372
 */
379
 */
373
 
380
 
374
int	_EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...)
381
int	_EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...)
375
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
382
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
376
char *	_EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...)
383
char *	_EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...)
377
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
384
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
378
char *	_EXFUN(_asnprintf_r, (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
385
char *	_EXFUN(_asnprintf_r, (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
379
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
386
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
380
int	_EXFUN(_asprintf_r, (struct _reent *, char **__restrict, const char *__restrict, ...)
387
int	_EXFUN(_asprintf_r, (struct _reent *, char **__restrict, const char *__restrict, ...)
381
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
388
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
382
int	_EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...)
389
int	_EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...)
383
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
390
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
384
int	_EXFUN(_dprintf_r, (struct _reent *, int, const char *__restrict, ...)
391
int	_EXFUN(_dprintf_r, (struct _reent *, int, const char *__restrict, ...)
385
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
392
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
386
int	_EXFUN(_fclose_r, (struct _reent *, FILE *));
393
int	_EXFUN(_fclose_r, (struct _reent *, FILE *));
387
int	_EXFUN(_fcloseall_r, (struct _reent *));
394
int	_EXFUN(_fcloseall_r, (struct _reent *));
388
FILE *	_EXFUN(_fdopen_r, (struct _reent *, int, const char *));
395
FILE *	_EXFUN(_fdopen_r, (struct _reent *, int, const char *));
389
int	_EXFUN(_fflush_r, (struct _reent *, FILE *));
396
int	_EXFUN(_fflush_r, (struct _reent *, FILE *));
390
int	_EXFUN(_fgetc_r, (struct _reent *, FILE *));
397
int	_EXFUN(_fgetc_r, (struct _reent *, FILE *));
391
int	_EXFUN(_fgetc_unlocked_r, (struct _reent *, FILE *));
398
int	_EXFUN(_fgetc_unlocked_r, (struct _reent *, FILE *));
392
char *  _EXFUN(_fgets_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
399
char *  _EXFUN(_fgets_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
393
char *  _EXFUN(_fgets_unlocked_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
400
char *  _EXFUN(_fgets_unlocked_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
394
#ifdef _COMPILING_NEWLIB
401
#ifdef _COMPILING_NEWLIB
395
int	_EXFUN(_fgetpos_r, (struct _reent *, FILE *__restrict, _fpos_t *__restrict));
402
int	_EXFUN(_fgetpos_r, (struct _reent *, FILE *__restrict, _fpos_t *__restrict));
396
int	_EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *));
403
int	_EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *));
397
#else
404
#else
398
int	_EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *));
405
int	_EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *));
399
int	_EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *));
406
int	_EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *));
400
#endif
407
#endif
401
int	_EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...)
408
int	_EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...)
402
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
409
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
403
int	_EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...)
410
int	_EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...)
404
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
411
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
405
FILE *	_EXFUN(_fmemopen_r, (struct _reent *, void *__restrict, size_t, const char *__restrict));
412
FILE *	_EXFUN(_fmemopen_r, (struct _reent *, void *__restrict, size_t, const char *__restrict));
406
FILE *	_EXFUN(_fopen_r, (struct _reent *, const char *__restrict, const char *__restrict));
413
FILE *	_EXFUN(_fopen_r, (struct _reent *, const char *__restrict, const char *__restrict));
407
FILE *	_EXFUN(_freopen_r, (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict));
414
FILE *	_EXFUN(_freopen_r, (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict));
408
int	_EXFUN(_fprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
415
int	_EXFUN(_fprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
409
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
416
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
410
int	_EXFUN(_fpurge_r, (struct _reent *, FILE *));
417
int	_EXFUN(_fpurge_r, (struct _reent *, FILE *));
411
int	_EXFUN(_fputc_r, (struct _reent *, int, FILE *));
418
int	_EXFUN(_fputc_r, (struct _reent *, int, FILE *));
412
int	_EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *));
419
int	_EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *));
413
int	_EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict));
420
int	_EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict));
414
int	_EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict));
421
int	_EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict));
415
size_t	_EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
422
size_t	_EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
416
size_t	_EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
423
size_t	_EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
417
int	_EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
424
int	_EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
418
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
425
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
419
int	_EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
426
int	_EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
420
int	_EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
427
int	_EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
421
long	_EXFUN(_ftell_r, (struct _reent *, FILE *));
428
long	_EXFUN(_ftell_r, (struct _reent *, FILE *));
422
_off_t	_EXFUN(_ftello_r,(struct _reent *, FILE *));
429
_off_t	_EXFUN(_ftello_r,(struct _reent *, FILE *));
423
void	_EXFUN(_rewind_r, (struct _reent *, FILE *));
430
void	_EXFUN(_rewind_r, (struct _reent *, FILE *));
424
size_t	_EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
431
size_t	_EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
425
size_t	_EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
432
size_t	_EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
426
int	_EXFUN(_getc_r, (struct _reent *, FILE *));
433
int	_EXFUN(_getc_r, (struct _reent *, FILE *));
427
int	_EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
434
int	_EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
428
int	_EXFUN(_getchar_r, (struct _reent *));
435
int	_EXFUN(_getchar_r, (struct _reent *));
429
int	_EXFUN(_getchar_unlocked_r, (struct _reent *));
436
int	_EXFUN(_getchar_unlocked_r, (struct _reent *));
430
char *	_EXFUN(_gets_r, (struct _reent *, char *));
437
char *	_EXFUN(_gets_r, (struct _reent *, char *));
431
int	_EXFUN(_iprintf_r, (struct _reent *, const char *, ...)
438
int	_EXFUN(_iprintf_r, (struct _reent *, const char *, ...)
432
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
439
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
433
int	_EXFUN(_iscanf_r, (struct _reent *, const char *, ...)
440
int	_EXFUN(_iscanf_r, (struct _reent *, const char *, ...)
434
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
441
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
435
FILE *	_EXFUN(_open_memstream_r, (struct _reent *, char **, size_t *));
442
FILE *	_EXFUN(_open_memstream_r, (struct _reent *, char **, size_t *));
436
void	_EXFUN(_perror_r, (struct _reent *, const char *));
443
void	_EXFUN(_perror_r, (struct _reent *, const char *));
437
int	_EXFUN(_printf_r, (struct _reent *, const char *__restrict, ...)
444
int	_EXFUN(_printf_r, (struct _reent *, const char *__restrict, ...)
438
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
445
               _ATTRIBUTE ((__format__ (__printf__, 2, 3))));
439
int	_EXFUN(_putc_r, (struct _reent *, int, FILE *));
446
int	_EXFUN(_putc_r, (struct _reent *, int, FILE *));
440
int	_EXFUN(_putc_unlocked_r, (struct _reent *, int, FILE *));
447
int	_EXFUN(_putc_unlocked_r, (struct _reent *, int, FILE *));
441
int	_EXFUN(_putchar_unlocked_r, (struct _reent *, int));
448
int	_EXFUN(_putchar_unlocked_r, (struct _reent *, int));
442
int	_EXFUN(_putchar_r, (struct _reent *, int));
449
int	_EXFUN(_putchar_r, (struct _reent *, int));
443
int	_EXFUN(_puts_r, (struct _reent *, const char *));
450
int	_EXFUN(_puts_r, (struct _reent *, const char *));
444
int	_EXFUN(_remove_r, (struct _reent *, const char *));
451
int	_EXFUN(_remove_r, (struct _reent *, const char *));
445
int	_EXFUN(_rename_r, (struct _reent *,
452
int	_EXFUN(_rename_r, (struct _reent *,
446
			   const char *_old, const char *_new));
453
			   const char *_old, const char *_new));
447
int	_EXFUN(_scanf_r, (struct _reent *, const char *__restrict, ...)
454
int	_EXFUN(_scanf_r, (struct _reent *, const char *__restrict, ...)
448
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
455
               _ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
449
int	_EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...)
456
int	_EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...)
450
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
457
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
451
int	_EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...)
458
int	_EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...)
452
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
459
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
453
int	_EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...)
460
int	_EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...)
454
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
461
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
455
int	_EXFUN(_snprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
462
int	_EXFUN(_snprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
456
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
463
               _ATTRIBUTE ((__format__ (__printf__, 4, 5))));
457
int	_EXFUN(_sprintf_r, (struct _reent *, char *__restrict, const char *__restrict, ...)
464
int	_EXFUN(_sprintf_r, (struct _reent *, char *__restrict, const char *__restrict, ...)
458
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
465
               _ATTRIBUTE ((__format__ (__printf__, 3, 4))));
459
int	_EXFUN(_sscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, ...)
466
int	_EXFUN(_sscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, ...)
460
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
467
               _ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
461
char *	_EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
468
char *	_EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
462
FILE *	_EXFUN(_tmpfile_r, (struct _reent *));
469
FILE *	_EXFUN(_tmpfile_r, (struct _reent *));
463
char *	_EXFUN(_tmpnam_r, (struct _reent *, char *));
470
char *	_EXFUN(_tmpnam_r, (struct _reent *, char *));
464
int	_EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
471
int	_EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
465
int	_EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST)
472
int	_EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST)
466
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
473
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
467
char *	_EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
474
char *	_EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
468
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
475
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
469
char *	_EXFUN(_vasnprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
476
char *	_EXFUN(_vasnprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
470
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
477
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
471
int	_EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST)
478
int	_EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST)
472
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
479
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
473
int	_EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST)
480
int	_EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST)
474
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
481
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
475
int	_EXFUN(_vdprintf_r, (struct _reent *, int, const char *__restrict, __VALIST)
482
int	_EXFUN(_vdprintf_r, (struct _reent *, int, const char *__restrict, __VALIST)
476
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
483
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
477
int	_EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST)
484
int	_EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST)
478
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
485
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
479
int	_EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST)
486
int	_EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST)
480
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
487
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
481
int	_EXFUN(_vfprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
488
int	_EXFUN(_vfprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
482
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
489
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
483
int	_EXFUN(_vfscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
490
int	_EXFUN(_vfscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
484
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
491
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
485
int	_EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST)
492
int	_EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST)
486
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
493
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
487
int	_EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST)
494
int	_EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST)
488
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
495
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
489
int	_EXFUN(_vprintf_r, (struct _reent *, const char *__restrict, __VALIST)
496
int	_EXFUN(_vprintf_r, (struct _reent *, const char *__restrict, __VALIST)
490
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
497
               _ATTRIBUTE ((__format__ (__printf__, 2, 0))));
491
int	_EXFUN(_vscanf_r, (struct _reent *, const char *__restrict, __VALIST)
498
int	_EXFUN(_vscanf_r, (struct _reent *, const char *__restrict, __VALIST)
492
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
499
               _ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
493
int	_EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST)
500
int	_EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST)
494
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
501
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
495
int	_EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST)
502
int	_EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST)
496
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
503
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
497
int	_EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)
504
int	_EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)
498
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
505
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
499
int	_EXFUN(_vsnprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
506
int	_EXFUN(_vsnprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
500
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
507
               _ATTRIBUTE ((__format__ (__printf__, 4, 0))));
501
int	_EXFUN(_vsprintf_r, (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
508
int	_EXFUN(_vsprintf_r, (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
502
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
509
               _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
503
int	_EXFUN(_vsscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
510
int	_EXFUN(_vsscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
504
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
511
               _ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
505
 
512
 
506
/* Other extensions.  */
513
/* Other extensions.  */
507
 
514
 
508
int	_EXFUN(fpurge, (FILE *));
515
int	_EXFUN(fpurge, (FILE *));
509
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
516
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
510
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
517
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
511
 
518
 
512
#if __MISC_VISIBLE
519
#if __MISC_VISIBLE
513
void	_EXFUN(clearerr_unlocked, (FILE *));
520
void	_EXFUN(clearerr_unlocked, (FILE *));
514
int	_EXFUN(feof_unlocked, (FILE *));
521
int	_EXFUN(feof_unlocked, (FILE *));
515
int	_EXFUN(ferror_unlocked, (FILE *));
522
int	_EXFUN(ferror_unlocked, (FILE *));
516
int	_EXFUN(fileno_unlocked, (FILE *));
523
int	_EXFUN(fileno_unlocked, (FILE *));
517
int	_EXFUN(fflush_unlocked, (FILE *));
524
int	_EXFUN(fflush_unlocked, (FILE *));
518
int	_EXFUN(fgetc_unlocked, (FILE *));
525
int	_EXFUN(fgetc_unlocked, (FILE *));
519
int	_EXFUN(fputc_unlocked, (int, FILE *));
526
int	_EXFUN(fputc_unlocked, (int, FILE *));
520
size_t	_EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
527
size_t	_EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
521
size_t	_EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
528
size_t	_EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
522
#endif
529
#endif
523
 
530
 
524
#if __GNU_VISIBLE
531
#if __GNU_VISIBLE
525
char *  _EXFUN(fgets_unlocked, (char *__restrict, int, FILE *__restrict));
532
char *  _EXFUN(fgets_unlocked, (char *__restrict, int, FILE *__restrict));
526
int	_EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict));
533
int	_EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict));
527
#endif
534
#endif
528
 
535
 
529
#ifdef __LARGE64_FILES
536
#ifdef __LARGE64_FILES
530
#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
537
#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
531
FILE *	_EXFUN(fdopen64, (int, const char *));
538
FILE *	_EXFUN(fdopen64, (int, const char *));
532
FILE *  _EXFUN(fopen64, (const char *, const char *));
539
FILE *  _EXFUN(fopen64, (const char *, const char *));
533
FILE *  _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *));
540
FILE *  _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *));
534
_off64_t _EXFUN(ftello64, (FILE *));
541
_off64_t _EXFUN(ftello64, (FILE *));
535
_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
542
_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
536
int     _EXFUN(fgetpos64, (FILE *, _fpos64_t *));
543
int     _EXFUN(fgetpos64, (FILE *, _fpos64_t *));
537
int     _EXFUN(fsetpos64, (FILE *, const _fpos64_t *));
544
int     _EXFUN(fsetpos64, (FILE *, const _fpos64_t *));
538
FILE *  _EXFUN(tmpfile64, (void));
545
FILE *  _EXFUN(tmpfile64, (void));
539
 
546
 
540
FILE *	_EXFUN(_fdopen64_r, (struct _reent *, int, const char *));
547
FILE *	_EXFUN(_fdopen64_r, (struct _reent *, int, const char *));
541
FILE *  _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *));
548
FILE *  _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *));
542
FILE *  _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *));
549
FILE *  _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *));
543
_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *));
550
_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *));
544
_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int));
551
_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int));
545
int     _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
552
int     _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
546
int     _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
553
int     _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
547
FILE *  _EXFUN(_tmpfile64_r, (struct _reent *));
554
FILE *  _EXFUN(_tmpfile64_r, (struct _reent *));
548
#endif /* !__CYGWIN__ */
555
#endif /* !__CYGWIN__ */
549
#endif /* __LARGE64_FILES */
556
#endif /* __LARGE64_FILES */
550
 
557
 
551
/*
558
/*
552
 * Routines internal to the implementation.
559
 * Routines internal to the implementation.
553
 */
560
 */
554
 
561
 
555
int	_EXFUN(__srget_r, (struct _reent *, FILE *));
562
int	_EXFUN(__srget_r, (struct _reent *, FILE *));
556
int	_EXFUN(__swbuf_r, (struct _reent *, int, FILE *));
563
int	_EXFUN(__swbuf_r, (struct _reent *, int, FILE *));
557
 
564
 
558
/*
565
/*
559
 * Stdio function-access interface.
566
 * Stdio function-access interface.
560
 */
567
 */
561
 
568
 
562
#if __BSD_VISIBLE
569
#if __BSD_VISIBLE
563
# ifdef __LARGE64_FILES
570
# ifdef __LARGE64_FILES
564
FILE	*_EXFUN(funopen,(const _PTR __cookie,
571
FILE	*_EXFUN(funopen,(const _PTR __cookie,
565
		int (*__readfn)(_PTR __c, char *__buf,
572
		int (*__readfn)(_PTR __c, char *__buf,
566
				_READ_WRITE_BUFSIZE_TYPE __n),
573
				_READ_WRITE_BUFSIZE_TYPE __n),
567
		int (*__writefn)(_PTR __c, const char *__buf,
574
		int (*__writefn)(_PTR __c, const char *__buf,
568
				 _READ_WRITE_BUFSIZE_TYPE __n),
575
				 _READ_WRITE_BUFSIZE_TYPE __n),
569
		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
576
		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
570
		int (*__closefn)(_PTR __c)));
577
		int (*__closefn)(_PTR __c)));
571
FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
578
FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
572
		int (*__readfn)(_PTR __c, char *__buf,
579
		int (*__readfn)(_PTR __c, char *__buf,
573
				_READ_WRITE_BUFSIZE_TYPE __n),
580
				_READ_WRITE_BUFSIZE_TYPE __n),
574
		int (*__writefn)(_PTR __c, const char *__buf,
581
		int (*__writefn)(_PTR __c, const char *__buf,
575
				 _READ_WRITE_BUFSIZE_TYPE __n),
582
				 _READ_WRITE_BUFSIZE_TYPE __n),
576
		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
583
		_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
577
		int (*__closefn)(_PTR __c)));
584
		int (*__closefn)(_PTR __c)));
578
# else
585
# else
579
FILE	*_EXFUN(funopen,(const _PTR __cookie,
586
FILE	*_EXFUN(funopen,(const _PTR __cookie,
580
		int (*__readfn)(_PTR __cookie, char *__buf,
587
		int (*__readfn)(_PTR __cookie, char *__buf,
581
				_READ_WRITE_BUFSIZE_TYPE __n),
588
				_READ_WRITE_BUFSIZE_TYPE __n),
582
		int (*__writefn)(_PTR __cookie, const char *__buf,
589
		int (*__writefn)(_PTR __cookie, const char *__buf,
583
				 _READ_WRITE_BUFSIZE_TYPE __n),
590
				 _READ_WRITE_BUFSIZE_TYPE __n),
584
		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
591
		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
585
		int (*__closefn)(_PTR __cookie)));
592
		int (*__closefn)(_PTR __cookie)));
586
FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
593
FILE	*_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
587
		int (*__readfn)(_PTR __cookie, char *__buf,
594
		int (*__readfn)(_PTR __cookie, char *__buf,
588
				_READ_WRITE_BUFSIZE_TYPE __n),
595
				_READ_WRITE_BUFSIZE_TYPE __n),
589
		int (*__writefn)(_PTR __cookie, const char *__buf,
596
		int (*__writefn)(_PTR __cookie, const char *__buf,
590
				 _READ_WRITE_BUFSIZE_TYPE __n),
597
				 _READ_WRITE_BUFSIZE_TYPE __n),
591
		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
598
		fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
592
		int (*__closefn)(_PTR __cookie)));
599
		int (*__closefn)(_PTR __cookie)));
593
# endif /* !__LARGE64_FILES */
600
# endif /* !__LARGE64_FILES */
594
 
601
 
595
# define	fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
602
# define	fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
596
					       (fpos_t (*)())0, (int (*)())0)
603
					       (fpos_t (*)())0, (int (*)())0)
597
# define	fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0, __fn, \
604
# define	fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0, __fn, \
598
					       (fpos_t (*)())0, (int (*)())0)
605
					       (fpos_t (*)())0, (int (*)())0)
599
#endif /* __BSD_VISIBLE */
606
#endif /* __BSD_VISIBLE */
600
 
607
 
601
#if __GNU_VISIBLE
608
#if __GNU_VISIBLE
602
typedef ssize_t cookie_read_function_t(void *__cookie, char *__buf, size_t __n);
609
typedef ssize_t cookie_read_function_t(void *__cookie, char *__buf, size_t __n);
603
typedef ssize_t cookie_write_function_t(void *__cookie, const char *__buf,
610
typedef ssize_t cookie_write_function_t(void *__cookie, const char *__buf,
604
					size_t __n);
611
					size_t __n);
605
# ifdef __LARGE64_FILES
612
# ifdef __LARGE64_FILES
606
typedef int cookie_seek_function_t(void *__cookie, _off64_t *__off,
613
typedef int cookie_seek_function_t(void *__cookie, _off64_t *__off,
607
				   int __whence);
614
				   int __whence);
608
# else
615
# else
609
typedef int cookie_seek_function_t(void *__cookie, off_t *__off, int __whence);
616
typedef int cookie_seek_function_t(void *__cookie, off_t *__off, int __whence);
610
# endif /* !__LARGE64_FILES */
617
# endif /* !__LARGE64_FILES */
611
typedef int cookie_close_function_t(void *__cookie);
618
typedef int cookie_close_function_t(void *__cookie);
612
typedef struct
619
typedef struct
613
{
620
{
614
  /* These four struct member names are dictated by Linux; hopefully,
621
  /* These four struct member names are dictated by Linux; hopefully,
615
     they don't conflict with any macros.  */
622
     they don't conflict with any macros.  */
616
  cookie_read_function_t  *read;
623
  cookie_read_function_t  *read;
617
  cookie_write_function_t *write;
624
  cookie_write_function_t *write;
618
  cookie_seek_function_t  *seek;
625
  cookie_seek_function_t  *seek;
619
  cookie_close_function_t *close;
626
  cookie_close_function_t *close;
620
} cookie_io_functions_t;
627
} cookie_io_functions_t;
621
FILE *_EXFUN(fopencookie,(void *__cookie,
628
FILE *_EXFUN(fopencookie,(void *__cookie,
622
		const char *__mode, cookie_io_functions_t __functions));
629
		const char *__mode, cookie_io_functions_t __functions));
623
FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie,
630
FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie,
624
		const char *__mode, cookie_io_functions_t __functions));
631
		const char *__mode, cookie_io_functions_t __functions));
625
#endif /* __GNU_VISIBLE */
632
#endif /* __GNU_VISIBLE */
626
 
633
 
627
#ifndef __CUSTOM_FILE_IO__
634
#ifndef __CUSTOM_FILE_IO__
628
/*
635
/*
629
 * The __sfoo macros are here so that we can 
636
 * The __sfoo macros are here so that we can 
630
 * define function versions in the C library.
637
 * define function versions in the C library.
631
 */
638
 */
632
#define       __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++))
639
#define       __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++))
633
 
640
 
634
#ifdef __SCLE
641
#ifdef __SCLE
635
/*  For a platform with CR/LF, additional logic is required by
642
/*  For a platform with CR/LF, additional logic is required by
636
  __sgetc_r which would otherwise simply be a macro; therefore we
643
  __sgetc_r which would otherwise simply be a macro; therefore we
637
  use an inlined function.  The function is only meant to be inlined
644
  use an inlined function.  The function is only meant to be inlined
638
  in place as used and the function body should never be emitted.  
645
  in place as used and the function body should never be emitted.  
639
 
646
 
640
  There are two possible means to this end when compiling with GCC,
647
  There are two possible means to this end when compiling with GCC,
641
  one when compiling with a standard C99 compiler, and for other
648
  one when compiling with a standard C99 compiler, and for other
642
  compilers we're just stuck.  At the moment, this issue only
649
  compilers we're just stuck.  At the moment, this issue only
643
  affects the Cygwin target, so we'll most likely be using GCC. */
650
  affects the Cygwin target, so we'll most likely be using GCC. */
644
 
651
 
645
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
652
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
646
 
653
 
647
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
654
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
648
  {
655
  {
649
    int __c = __sgetc_raw_r(__ptr, __p);
656
    int __c = __sgetc_raw_r(__ptr, __p);
650
    if ((__p->_flags & __SCLE) && (__c == '\r'))
657
    if ((__p->_flags & __SCLE) && (__c == '\r'))
651
      {
658
      {
652
      int __c2 = __sgetc_raw_r(__ptr, __p);
659
      int __c2 = __sgetc_raw_r(__ptr, __p);
653
      if (__c2 == '\n')
660
      if (__c2 == '\n')
654
        __c = __c2;
661
        __c = __c2;
655
      else
662
      else
656
        ungetc(__c2, __p);
663
        ungetc(__c2, __p);
657
      }
664
      }
658
    return __c;
665
    return __c;
659
  }
666
  }
660
#else
667
#else
661
#define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p)
668
#define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p)
662
#endif
669
#endif
663
 
670
 
664
#ifdef __GNUC__
671
#ifdef __GNUC__
665
_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
672
_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
666
#ifdef __SCLE
673
#ifdef __SCLE
667
	if ((_p->_flags & __SCLE) && _c == '\n')
674
	if ((_p->_flags & __SCLE) && _c == '\n')
668
	  __sputc_r (_ptr, '\r', _p);
675
	  __sputc_r (_ptr, '\r', _p);
669
#endif
676
#endif
670
	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
677
	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
671
		return (*_p->_p++ = _c);
678
		return (*_p->_p++ = _c);
672
	else
679
	else
673
		return (__swbuf_r(_ptr, _c, _p));
680
		return (__swbuf_r(_ptr, _c, _p));
674
}
681
}
675
#else
682
#else
676
/*
683
/*
677
 * This has been tuned to generate reasonable code on the vax using pcc
684
 * This has been tuned to generate reasonable code on the vax using pcc
678
 */
685
 */
679
#define       __sputc_raw_r(__ptr, __c, __p) \
686
#define       __sputc_raw_r(__ptr, __c, __p) \
680
	(--(__p)->_w < 0 ? \
687
	(--(__p)->_w < 0 ? \
681
		(__p)->_w >= (__p)->_lbfsize ? \
688
		(__p)->_w >= (__p)->_lbfsize ? \
682
			(*(__p)->_p = (__c)), *(__p)->_p != '\n' ? \
689
			(*(__p)->_p = (__c)), *(__p)->_p != '\n' ? \
683
				(int)*(__p)->_p++ : \
690
				(int)*(__p)->_p++ : \
684
				__swbuf_r(__ptr, '\n', __p) : \
691
				__swbuf_r(__ptr, '\n', __p) : \
685
			__swbuf_r(__ptr, (int)(__c), __p) : \
692
			__swbuf_r(__ptr, (int)(__c), __p) : \
686
		(*(__p)->_p = (__c), (int)*(__p)->_p++))
693
		(*(__p)->_p = (__c), (int)*(__p)->_p++))
687
#ifdef __SCLE
694
#ifdef __SCLE
688
#define __sputc_r(__ptr, __c, __p) \
695
#define __sputc_r(__ptr, __c, __p) \
689
        ((((__p)->_flags & __SCLE) && ((__c) == '\n')) \
696
        ((((__p)->_flags & __SCLE) && ((__c) == '\n')) \
690
          ? __sputc_raw_r(__ptr, '\r', (__p)) : 0 , \
697
          ? __sputc_raw_r(__ptr, '\r', (__p)) : 0 , \
691
        __sputc_raw_r((__ptr), (__c), (__p)))
698
        __sputc_raw_r((__ptr), (__c), (__p)))
692
#else
699
#else
693
#define __sputc_r(__ptr, __c, __p) __sputc_raw_r(__ptr, __c, __p)
700
#define __sputc_r(__ptr, __c, __p) __sputc_raw_r(__ptr, __c, __p)
694
#endif
701
#endif
695
#endif
702
#endif
696
 
703
 
697
#define	__sfeof(p)	((int)(((p)->_flags & __SEOF) != 0))
704
#define	__sfeof(p)	((int)(((p)->_flags & __SEOF) != 0))
698
#define	__sferror(p)	((int)(((p)->_flags & __SERR) != 0))
705
#define	__sferror(p)	((int)(((p)->_flags & __SERR) != 0))
699
#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
706
#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
700
#define	__sfileno(p)	((p)->_file)
707
#define	__sfileno(p)	((p)->_file)
701
 
708
 
702
#ifndef _REENT_SMALL
709
#ifndef _REENT_SMALL
703
#define	feof(p)		__sfeof(p)
710
#define	feof(p)		__sfeof(p)
704
#define	ferror(p)	__sferror(p)
711
#define	ferror(p)	__sferror(p)
705
#define	clearerr(p)	__sclearerr(p)
712
#define	clearerr(p)	__sclearerr(p)
706
 
713
 
707
#if __MISC_VISIBLE
714
#if __MISC_VISIBLE
708
#define	feof_unlocked(p)	__sfeof(p)
715
#define	feof_unlocked(p)	__sfeof(p)
709
#define	ferror_unlocked(p)	__sferror(p)
716
#define	ferror_unlocked(p)	__sferror(p)
710
#define	clearerr_unlocked(p)	__sclearerr(p)
717
#define	clearerr_unlocked(p)	__sclearerr(p)
711
#endif /* __MISC_VISIBLE */
718
#endif /* __MISC_VISIBLE */
712
#endif /* _REENT_SMALL */
719
#endif /* _REENT_SMALL */
713
 
720
 
714
#if 0 /* __POSIX_VISIBLE - FIXME: must initialize stdio first, use fn */
721
#if 0 /* __POSIX_VISIBLE - FIXME: must initialize stdio first, use fn */
715
#define	fileno(p)	__sfileno(p)
722
#define	fileno(p)	__sfileno(p)
716
#endif
723
#endif
717
 
724
 
718
#ifndef __CYGWIN__
725
#ifndef __CYGWIN__
719
#ifndef lint
726
#ifndef lint
720
#define	getc(fp)	__sgetc_r(_REENT, fp)
727
#define	getc(fp)	__sgetc_r(_REENT, fp)
721
#define putc(x, fp)	__sputc_r(_REENT, x, fp)
728
#define putc(x, fp)	__sputc_r(_REENT, x, fp)
722
#endif /* lint */
729
#endif /* lint */
723
#endif /* __CYGWIN__ */
730
#endif /* __CYGWIN__ */
724
 
731
 
725
#if __MISC_VISIBLE
732
#if __MISC_VISIBLE
726
/* fast always-buffered version, true iff error */
733
/* fast always-buffered version, true iff error */
727
#define	fast_putc(x,p) (--(p)->_w < 0 ? \
734
#define	fast_putc(x,p) (--(p)->_w < 0 ? \
728
	__swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
735
	__swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
729
#endif
736
#endif
730
 
737
 
731
#if __XSI_VISIBLE
738
#if __XSI_VISIBLE
732
#define	L_cuserid	9		/* posix says it goes in stdio.h :( */
739
#define	L_cuserid	9		/* posix says it goes in stdio.h :( */
733
#ifdef __CYGWIN__
740
#ifdef __CYGWIN__
734
#define L_ctermid       16
741
#define L_ctermid       16
735
#endif
742
#endif
736
#endif
743
#endif
737
 
744
 
738
#endif /* !__CUSTOM_FILE_IO__ */
745
#endif /* !__CUSTOM_FILE_IO__ */
739
 
746
 
740
#define	getchar()	getc(stdin)
747
#define	getchar()	getc(stdin)
741
#define	putchar(x)	putc(x, stdout)
748
#define	putchar(x)	putc(x, stdout)
742
 
749
 
743
#if __MISC_VISIBLE || __POSIX_VISIBLE
750
#if __MISC_VISIBLE || __POSIX_VISIBLE
744
#define	getchar_unlocked()	getc_unlocked(stdin)
751
#define	getchar_unlocked()	getc_unlocked(stdin)
745
#define	putchar_unlocked(x)	putc_unlocked(x, stdout)
752
#define	putchar_unlocked(x)	putc_unlocked(x, stdout)
746
#endif
753
#endif
747
 
754
 
748
_END_STD_C
755
_END_STD_C
749
 
756
 
750
#endif /* _STDIO_H_ */
757
#endif /* _STDIO_H_ */