From: Ron Koenderink Date: Fri, 24 Aug 2007 21:05:59 +0000 (+0000) Subject: (posix_fileno) [_WIN32]: Rename posix_fileno() to fileno(). X-Git-Tag: v4.3.10~23 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=529958026028d9e6eb3750cd41ecdba709c6a549 (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. --- diff --git a/src/lib/commands/rea.c b/src/lib/commands/rea.c index def7a1043..89ca17b44 100644 --- a/src/lib/commands/rea.c +++ b/src/lib/commands/rea.c @@ -36,8 +36,10 @@ #include #include +#include #include "commands.h" #include "match.h" +#include "misc.h" #include "optlist.h" #include "tel.h" diff --git a/src/lib/w32/posixio.c b/src/lib/w32/posixio.c index 6c0e8394c..6af4b9b74 100644 --- a/src/lib/w32/posixio.c +++ b/src/lib/w32/posixio.c @@ -129,7 +129,7 @@ set_fd(int fd, enum fdmap_io_type type, int handle) 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 * a stream is closed. */ @@ -586,7 +586,7 @@ writev(int fd, const struct iovec *iov, int iovcnt) * handle is reused. */ int -posix_fileno(FILE *stream) +fileno(FILE *stream) { int fd; int handle; diff --git a/src/lib/w32/unistd.h b/src/lib/w32/unistd.h index 2a407c9ab..32aeeb6cd 100644 --- a/src/lib/w32/unistd.h +++ b/src/lib/w32/unistd.h @@ -36,7 +36,6 @@ #include #include -#undef fileno #include #include "sys/socket.h" #include @@ -108,8 +107,6 @@ typedef int socklen_t; #define read posix_read #define write(fd, buffer, count) \ posix_write((fd), (buffer), (count)) -#define fileno(stream) \ - posix_fileno((stream)) #define fsync(fd) \ posix_fsync((fd)) diff --git a/src/lib/w32/w32misc.h b/src/lib/w32/w32misc.h index a3bd3c0e0..cc2a545ce 100644 --- a/src/lib/w32/w32misc.h +++ b/src/lib/w32/w32misc.h @@ -46,6 +46,7 @@ /* stdio.h */ #define vsnprintf _vsnprintf #define snprintf _snprintf +#undef fileno /* stdlib.h */ #define random rand