(posix_fileno) [_WIN32]: Rename posix_fileno() to fileno().

Remove the extern posix_fileno().

(fileno) [_WIN32]: Replace system fileno() with a function that supports posix
file descriptors.  Move #undef fileno to w32misc.h as the system define
is in stdio.h.

(rea) [_WIN32]: Add stdio.h for fileno() extern declaration and add misc.h
to ensure the WIN32 fixes to stdio.h are included.
This commit is contained in:
Ron Koenderink 2007-08-24 21:05:59 +00:00
parent d5a1b3c6cd
commit 5299580260
4 changed files with 5 additions and 5 deletions

View file

@ -36,8 +36,10 @@
#include <config.h> #include <config.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include "commands.h" #include "commands.h"
#include "match.h" #include "match.h"
#include "misc.h"
#include "optlist.h" #include "optlist.h"
#include "tel.h" #include "tel.h"

View file

@ -129,7 +129,7 @@ set_fd(int fd, enum fdmap_io_type type, int handle)
fdmap[fd].type = type; fdmap[fd].type = type;
/* /*
* Garbage collection for posix_fileno(), currently not * Garbage collection for fileno(), currently not
* replacing fclose() and fcloseall() so do not know when * replacing fclose() and fcloseall() so do not know when
* a stream is closed. * a stream is closed.
*/ */
@ -586,7 +586,7 @@ writev(int fd, const struct iovec *iov, int iovcnt)
* handle is reused. * handle is reused.
*/ */
int int
posix_fileno(FILE *stream) fileno(FILE *stream)
{ {
int fd; int fd;
int handle; int handle;

View file

@ -36,7 +36,6 @@
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>
#undef fileno
#include <direct.h> #include <direct.h>
#include "sys/socket.h" #include "sys/socket.h"
#include <sys/stat.h> #include <sys/stat.h>
@ -108,8 +107,6 @@ typedef int socklen_t;
#define read posix_read #define read posix_read
#define write(fd, buffer, count) \ #define write(fd, buffer, count) \
posix_write((fd), (buffer), (count)) posix_write((fd), (buffer), (count))
#define fileno(stream) \
posix_fileno((stream))
#define fsync(fd) \ #define fsync(fd) \
posix_fsync((fd)) posix_fsync((fd))

View file

@ -46,6 +46,7 @@
/* stdio.h */ /* stdio.h */
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define snprintf _snprintf #define snprintf _snprintf
#undef fileno
/* stdlib.h */ /* stdlib.h */
#define random rand #define random rand