6 * Make this as close to original stdio as possible.
10 * function prototypes for our own win32io layer
12 EXT int * win32_errno();
13 EXT FILE* win32_stdin(void);
14 EXT FILE* win32_stdout(void);
15 EXT FILE* win32_stderr(void);
16 EXT int win32_ferror(FILE *fp);
17 EXT int win32_feof(FILE *fp);
18 EXT char* win32_strerror(int e);
20 EXT int win32_fprintf(FILE *pf, const char *format, ...);
21 EXT int win32_printf(const char *format, ...);
22 EXT int win32_vfprintf(FILE *pf, const char *format, va_list arg);
23 EXT size_t win32_fread(void *buf, size_t size, size_t count, FILE *pf);
24 EXT size_t win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf);
25 EXT FILE* win32_fopen(const char *path, const char *mode);
26 EXT FILE* win32_fdopen(int fh, const char *mode);
27 EXT FILE* win32_freopen(const char *path, const char *mode, FILE *pf);
28 EXT int win32_fclose(FILE *pf);
29 EXT int win32_fputs(const char *s,FILE *pf);
30 EXT int win32_fputc(int c,FILE *pf);
31 EXT int win32_ungetc(int c,FILE *pf);
32 EXT int win32_getc(FILE *pf);
33 EXT int win32_fileno(FILE *pf);
34 EXT void win32_clearerr(FILE *pf);
35 EXT int win32_fflush(FILE *pf);
36 EXT long win32_ftell(FILE *pf);
37 EXT int win32_fseek(FILE *pf,long offset,int origin);
38 EXT int win32_fgetpos(FILE *pf,fpos_t *p);
39 EXT int win32_fsetpos(FILE *pf,const fpos_t *p);
40 EXT void win32_rewind(FILE *pf);
41 EXT FILE* win32_tmpfile(void);
42 EXT void win32_abort(void);
43 EXT int win32_fstat(int fd,struct stat *bufptr);
44 EXT int win32_stat(const char *name,struct stat *bufptr);
45 EXT int win32_pipe( int *phandles, unsigned int psize, int textmode );
46 EXT FILE* win32_popen( const char *command, const char *mode );
47 EXT int win32_pclose( FILE *pf);
48 EXT int win32_setmode( int fd, int mode);
49 EXT long win32_lseek( int fd, long offset, int origin);
50 EXT long win32_tell( int fd);
51 EXT int win32_dup( int fd);
52 EXT int win32_dup2(int h1, int h2);
53 EXT int win32_open(const char *path, int oflag,...);
54 EXT int win32_close(int fd);
55 EXT int win32_eof(int fd);
56 EXT int win32_read(int fd, void *buf, unsigned int cnt);
57 EXT int win32_write(int fd, const void *buf, unsigned int cnt);
58 EXT int win32_spawnvpe(int mode, const char *cmdname,
59 const char *const *argv, const char *const *envp);
60 EXT int win32_spawnle(int mode, const char *cmdname, const char *,...);
63 * these two are win32 specific but still io related
65 int stolen_open_osfhandle(long handle, int flags);
66 long stolen_get_osfhandle(int fd);
68 #include <win32io.h> /* pull in the io sub system structure */
70 void * SetIOSubSystem(void *piosubsystem);
73 * the following six(6) is #define in stdio.h
75 #ifndef WIN32IO_IS_STDIO
83 #define stderr win32_stderr()
84 #define stdout win32_stdout()
85 #define stdin win32_stdin()
86 #define feof(f) win32_feof(f)
87 #define ferror(f) win32_ferror(f)
88 #define errno (*win32_errno())
89 #define strerror win32_strerror
92 * redirect to our own version
94 #define fprintf win32_fprintf
95 #define vfprintf win32_vfprintf
96 #define printf win32_printf
97 #define fread(buf,size,count,f) win32_fread(buf,size,count,f)
98 #define fwrite(buf,size,count,f) win32_fwrite(buf,size,count,f)
99 #define fopen win32_fopen
100 #define fdopen win32_fdopen
101 #define freopen win32_freopen
102 #define fclose(f) win32_fclose(f)
103 #define fputs(s,f) win32_fputs(s,f)
104 #define fputc(c,f) win32_fputc(c,f)
105 #define ungetc(c,f) win32_ungetc(c,f)
106 #define getc(f) win32_getc(f)
107 #define fileno(f) win32_fileno(f)
108 #define clearerr(f) win32_clearerr(f)
109 #define fflush(f) win32_fflush(f)
110 #define ftell(f) win32_ftell(f)
111 #define fseek(f,o,w) win32_fseek(f,o,w)
112 #define fgetpos(f,p) win32_fgetpos(f,p)
113 #define fsetpos(f,p) win32_fsetpos(f,p)
114 #define rewind(f) win32_rewind(f)
115 #define tmpfile() win32_tmpfile()
116 #define abort() win32_abort()
117 #define fstat(fd,bufptr) win32_fstat(fd,bufptr)
118 #define setmode(fd,mode) win32_setmode(fd,mode)
119 #define lseek(fd,offset,orig) win32_lseek(fd,offset,orig)
120 #define tell(fd) win32_tell(fd)
121 #define dup(fd) win32_dup(fd)
122 #define dup2(fd1,fd2) win32_dup2(fd1,fd2)
123 #define open win32_open
124 #define close(fd) win32_close(fd)
125 #define eof(fd) win32_eof(fd)
126 #define read(fd,b,s) win32_read(fd,b,s)
127 #define write(fd,b,s) win32_write(fd,b,s)
128 #define _open_osfhandle stolen_open_osfhandle
129 #define _get_osfhandle stolen_get_osfhandle
130 #define spawnvpe win32_spawnvpe
131 #define spawnle win32_spawnle
132 #endif /* WIN32IO_IS_STDIO */
134 #endif /* WIN32IOP_H */