Commit | Line | Data |
---|---|---|
d6376244 JH |
1 | /* fakestdio.h |
2 | * | |
3 | * Copyright (c) 2000-2002, Larry Wall | |
4 | * | |
5 | * You may distribute under the terms of either the GNU General Public | |
6 | * License or the Artistic License, as specified in the README file. | |
7 | * | |
8 | */ | |
9 | ||
76ced9ad NIS |
10 | /* |
11 | * This is "source level" stdio compatibility mode. | |
12 | * We try and #define stdio functions in terms of PerlIO. | |
13 | */ | |
14 | #define _CANNOT "CANNOT" | |
15 | #undef FILE | |
16 | #define FILE PerlIO | |
cf677677 | 17 | #undef clearerr |
76ced9ad | 18 | #undef fclose |
cf677677 JH |
19 | #undef fdopen |
20 | #undef feof | |
21 | #undef ferror | |
22 | #undef fflush | |
76ced9ad | 23 | #undef fgetc |
cf677677 JH |
24 | #undef fgetpos |
25 | #undef fgets | |
26 | #undef fileno | |
400e04b6 | 27 | #undef flockfile |
cf677677 JH |
28 | #undef fopen |
29 | #undef fprintf | |
76ced9ad | 30 | #undef fputc |
76ced9ad | 31 | #undef fputs |
76ced9ad | 32 | #undef fread |
cf677677 JH |
33 | #undef freopen |
34 | #undef fscanf | |
76ced9ad NIS |
35 | #undef fseek |
36 | #undef fsetpos | |
37 | #undef ftell | |
400e04b6 JH |
38 | #undef ftrylockfile |
39 | #undef funlockfile | |
cf677677 JH |
40 | #undef fwrite |
41 | #undef getc | |
42 | #undef getc_unlocked | |
76ced9ad | 43 | #undef getw |
cf677677 JH |
44 | #undef pclose |
45 | #undef popen | |
46 | #undef putc | |
47 | #undef putc_unlocked | |
76ced9ad | 48 | #undef putw |
cf677677 | 49 | #undef rewind |
76ced9ad NIS |
50 | #undef setbuf |
51 | #undef setvbuf | |
cf677677 | 52 | #undef stderr |
76ced9ad NIS |
53 | #undef stdin |
54 | #undef stdout | |
cf677677 JH |
55 | #undef tmpfile |
56 | #undef ungetc | |
57 | #undef vfprintf | |
76ced9ad NIS |
58 | #define fprintf PerlIO_printf |
59 | #define stdin PerlIO_stdin() | |
60 | #define stdout PerlIO_stdout() | |
61 | #define stderr PerlIO_stderr() | |
62 | #define tmpfile() PerlIO_tmpfile() | |
63 | #define fclose(f) PerlIO_close(f) | |
64 | #define fflush(f) PerlIO_flush(f) | |
65 | #define fopen(p,m) PerlIO_open(p,m) | |
66 | #define vfprintf(f,fmt,a) PerlIO_vprintf(f,fmt,a) | |
67 | #define fgetc(f) PerlIO_getc(f) | |
68 | #define fputc(c,f) PerlIO_putc(f,c) | |
69 | #define fputs(s,f) PerlIO_puts(f,s) | |
70 | #define getc(f) PerlIO_getc(f) | |
76ced9ad NIS |
71 | #define getc_unlocked(f) PerlIO_getc(f) |
72 | #define putc(c,f) PerlIO_putc(f,c) | |
76ced9ad NIS |
73 | #define putc_unlocked(c,f) PerlIO_putc(c,f) |
74 | #define ungetc(c,f) PerlIO_ungetc(f,c) | |
75 | #if 0 | |
76 | /* return values of read/write need work */ | |
77 | #define fread(b,s,c,f) PerlIO_read(f,b,(s*c)) | |
78 | #define fwrite(b,s,c,f) PerlIO_write(f,b,(s*c)) | |
79 | #else | |
80 | #define fread(b,s,c,f) _CANNOT fread | |
81 | #define fwrite(b,s,c,f) _CANNOT fwrite | |
82 | #endif | |
76ced9ad | 83 | #define fseek(f,o,w) PerlIO_seek(f,o,w) |
76ced9ad NIS |
84 | #define ftell(f) PerlIO_tell(f) |
85 | #define rewind(f) PerlIO_rewind(f) | |
86 | #define clearerr(f) PerlIO_clearerr(f) | |
87 | #define feof(f) PerlIO_eof(f) | |
88 | #define ferror(f) PerlIO_error(f) | |
89 | #define fdopen(fd,p) PerlIO_fdopen(fd,p) | |
90 | #define fileno(f) PerlIO_fileno(f) | |
91 | #define popen(c,m) my_popen(c,m) | |
92 | #define pclose(f) my_pclose(f) | |
93 | ||
766a733e NIS |
94 | #define fsetpos(f,p) _CANNOT _fsetpos_ |
95 | #define fgetpos(f,p) _CANNOT _fgetpos_ | |
96 | ||
76ced9ad NIS |
97 | #define __filbuf(f) _CANNOT __filbuf_ |
98 | #define _filbuf(f) _CANNOT _filbuf_ | |
99 | #define __flsbuf(c,f) _CANNOT __flsbuf_ | |
100 | #define _flsbuf(c,f) _CANNOT _flsbuf_ | |
101 | #define getw(f) _CANNOT _getw_ | |
102 | #define putw(v,f) _CANNOT _putw_ | |
103 | #if SFIO_VERSION < 20000101L | |
104 | #define flockfile(f) _CANNOT _flockfile_ | |
105 | #define ftrylockfile(f) _CANNOT _ftrylockfile_ | |
106 | #define funlockfile(f) _CANNOT _funlockfile_ | |
107 | #endif | |
108 | #define freopen(p,m,f) _CANNOT _freopen_ | |
109 | #define setbuf(f,b) _CANNOT _setbuf_ | |
110 | #define setvbuf(f,b,x,s) _CANNOT _setvbuf_ | |
111 | #define fscanf _CANNOT _fscanf_ | |
112 | #define fgets(s,n,f) _CANNOT _fgets_ | |
113 |