Merge from vendor branch GCC:
[dragonfly.git] / contrib / libio / iostdio.h
1 /* 
2 Copyright (C) 1993 Free Software Foundation
3
4 This file is part of the GNU IO Library.  This library is free
5 software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this library; see the file COPYING.  If not, write to the Free
17 Software Foundation, 59 Temple Place - Suite 330, Boston, 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 not cause
21 the resulting executable to be covered by the GNU General Public License.
22 This exception does not however invalidate any other reasons why
23 the executable file might be covered by the GNU General Public License. */
24
25 /* This file defines a stdio-like environment, except that it avoid
26    link-time name clashes with an existing stdio.
27    It allows for testing the libio using stdio-using programs
28    with an incompatible libc.a.
29    It is not predantically correct - e.g. some macros are used
30    that may evaluate a stream argument more than once.  */
31
32 #ifndef _IOSTDIO_H
33 #define _IOSTDIO_H
34
35 #include "iolibio.h"
36
37 typedef _IO_FILE FILE;
38 #ifndef EOF
39 #define EOF (-1)
40 #endif
41 #ifndef BUFSIZ
42 #define BUFSIZ 1024
43 #endif
44
45 /* #define size_t, fpos_t L_tmpname TMP_MAX */
46
47 #define _IOFBF 0 /* Fully buffered. */
48 #define _IOLBF 1 /* Line buffered. */
49 #define _IONBF 2 /* No buffering. */
50
51 #define SEEK_SET 0
52 #define SEEK_CUR 1
53 #define SEEK_END 2
54
55 #define stdin _IO_stdin
56 #define stdout _IO_stdout
57 #define stderr _IO_stderr
58
59 #define getc(_fp) _IO_getc(_fp)
60 #define putc(_ch, _fp) _IO_putc(_ch, _fp)
61
62 #define clearerr _IO_clearerr
63 #define fclose _IO_fclose
64 #define feof _IO_feof
65 #define ferror _IO_ferror
66 #define fflush _IO_fflush
67 #define fgetc(__fp) _IO_getc(_fp)
68 #define fgetpos _IO_fgetpos
69 #define fgets _IO_fgets
70 #define fopen _IO_fopen
71 #define fprintf _IO_fprintf
72 #define fputc(_ch, _fp) _IO_putc(_ch, _fp)
73 #define fputs _IO_fputs
74 #define fread _IO_fread
75 #define freopen _IO_freopen
76 #define fscanf _IO_fscanf
77 #define fseek _IO_fseek
78 #define fsetpos _IO_fsetpos
79 #define ftell _IO_ftell
80 #define fwrite _IO_fwrite
81 #define gets _IO_gets
82 #define perror _IO_perror
83 #define printf _IO_printf
84 #define puts _IO_puts
85 #define rewind _IO_rewind
86 #define scanf _IO_scanf
87 #define setbuf _IO_setbuf
88 #define setbuffer _IO_setbuffer
89 #define setvbuf _IO_setvbuf
90 #define sprintf _IO_sprintf
91 #define sscanf _IO_sscanf
92 #define ungetc _IO_ungetc
93 #define vfprintf _IO_vfprintf
94 #define vprintf(__fmt, __args) vfprintf(stdout, __fmt, __args)
95 #define vsprintf _IO_vsprintf
96
97 #if 0
98 /* We can use the libc versions of these, since they don't pass FILE*s. */
99 #define remove ??? __P((const char*))
100 #define rename ??? __P((const char* _old, const char* _new))
101 #define tmpfile ??? __P((void))
102 #define tmpnam ??? __P((char*))
103 #endif
104
105 #if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
106 #define fdopen _IO_fdopen
107 #define fileno _IO_fileno
108 #define popen _IO_popen
109 #define pclose _IO_pclose
110 #define setbuf _IO_setbuf
111 #define setlinebuf _IO_setlinebuf
112 #endif
113
114 #endif /* _IOSTDIO_H */