xref: /openbsd-src/gnu/lib/libstdc++/libstdc++/libio/iolibio.h (revision 19731d4f8b8a37c0f0786969cd7fb2f87d5c0b74)
1 /* Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
2    This file is part of the GNU IO Library.
3 
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU General Public License as
6    published by the Free Software Foundation; either version 2, or (at
7    your option) any later version.
8 
9    This library is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with this library; see the file COPYING.  If not, write to
16    the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
17    MA 02111-1307, USA.
18 
19    As a special exception, if you link this library with files
20    compiled with a GNU compiler to produce an executable, this does
21    not cause the resulting executable to be covered by the GNU General
22    Public License.  This exception does not however invalidate any
23    other reasons why the executable file might be covered by the GNU
24    General Public License.  */
25 
26 #include "libio.h"
27 
28 /* These emulate stdio functionality, but with a different name
29    (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 extern int _IO_fclose __P((_IO_FILE*));
36 extern int _IO_new_fclose __P((_IO_FILE*));
37 extern int _IO_old_fclose __P((_IO_FILE*));
38 extern _IO_FILE *_IO_fdopen __P((int, const char*));
39 extern _IO_FILE *_IO_old_fdopen __P((int, const char*));
40 extern _IO_FILE *_IO_new_fdopen __P((int, const char*));
41 extern int _IO_fflush __P((_IO_FILE*));
42 extern int _IO_fgetpos __P((_IO_FILE*, _IO_fpos_t*));
43 extern int _IO_fgetpos64 __P((_IO_FILE*, _IO_fpos64_t*));
44 extern char* _IO_fgets __P((char*, int, _IO_FILE*));
45 extern _IO_FILE *_IO_fopen __P((const char*, const char*));
46 extern _IO_FILE *_IO_old_fopen __P((const char*, const char*));
47 extern _IO_FILE *_IO_new_fopen __P((const char*, const char*));
48 extern _IO_FILE *_IO_fopen64 __P((const char*, const char*));
49 extern int _IO_fprintf __P((_IO_FILE*, const char*, ...));
50 extern int _IO_fputs __P((const char*, _IO_FILE*));
51 extern int _IO_fsetpos __P((_IO_FILE*, const _IO_fpos_t *));
52 extern int _IO_fsetpos64 __P((_IO_FILE*, const _IO_fpos64_t *));
53 extern long int _IO_ftell __P((_IO_FILE*));
54 extern _IO_size_t _IO_fread __P((void*, _IO_size_t, _IO_size_t, _IO_FILE*));
55 extern _IO_size_t _IO_fwrite __P((const void*,
56 				      _IO_size_t, _IO_size_t, _IO_FILE*));
57 extern char* _IO_gets __P((char*));
58 extern void _IO_perror __P((const char*));
59 extern int _IO_printf __P((const char*, ...));
60 extern int _IO_puts __P((const char*));
61 extern int _IO_scanf __P((const char*, ...));
62 extern void _IO_setbuffer __P((_IO_FILE *, char*, _IO_size_t));
63 extern int _IO_setvbuf __P((_IO_FILE*, char*, int, _IO_size_t));
64 extern int _IO_sscanf __P((const char*, const char*, ...));
65 extern int _IO_sprintf __P((char *, const char*, ...));
66 extern int _IO_ungetc __P((int, _IO_FILE*));
67 extern int _IO_vsscanf __P((const char *, const char *, _IO_va_list));
68 extern int _IO_vsprintf __P((char*, const char*, _IO_va_list));
69 extern int _IO_vswprintf __P((wchar_t*, _IO_size_t, const wchar_t*,
70 			      _IO_va_list));
71 
72 struct obstack;
73 extern int _IO_obstack_vprintf __P ((struct obstack *, const char *,
74 				     _IO_va_list));
75 extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
76 #ifndef _IO_pos_BAD
77 #define _IO_pos_BAD ((_IO_off64_t)(-1))
78 #endif
79 #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
80 #define _IO_fseek(__fp, __offset, __whence) \
81   (_IO_seekoff(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD ? EOF : 0)
82 #define _IO_rewind(FILE) (void)_IO_seekoff(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
83 #define _IO_vprintf(FORMAT, ARGS) _IO_vfprintf(_IO_stdout, FORMAT, ARGS)
84 #define _IO_freopen(FILENAME, MODE, FP) \
85   (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 0))
86 #define _IO_old_freopen(FILENAME, MODE, FP) \
87   (_IO_old_file_close_it (FP), _IO_old_file_fopen(FP, FILENAME, MODE))
88 #define _IO_freopen64(FILENAME, MODE, FP) \
89   (_IO_file_close_it(FP), _IO_file_fopen(FP, FILENAME, MODE, 1))
90 #define _IO_fileno(FP) ((FP)->_fileno)
91 extern _IO_FILE* _IO_popen __P((const char*, const char*));
92 extern _IO_FILE* _IO_new_popen __P((const char*, const char*));
93 extern _IO_FILE* _IO_old_popen __P((const char*, const char*));
94 extern int __new_pclose __P((_IO_FILE *));
95 extern int __old_pclose __P((_IO_FILE *));
96 #define _IO_pclose _IO_fclose
97 #define _IO_setbuf(_FP, _BUF) _IO_setbuffer(_FP, _BUF, _IO_BUFSIZ)
98 #define _IO_setlinebuf(_FP) _IO_setvbuf(_FP, NULL, 1, 0)
99 
100 _IO_FILE *__new_freopen __P ((const char *, const char *, _IO_FILE *));
101 _IO_FILE *__old_freopen __P ((const char *, const char *, _IO_FILE *));
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 
108