MSVSC fixes

This commit is contained in:
Brent Cook 2017-01-16 10:36:05 -06:00
parent 4cb675e2d9
commit 3b2560feb3
4 changed files with 9 additions and 7 deletions

View File

@ -44,7 +44,7 @@ int
posix_open(const char *path, ...)
{
va_list ap;
mode_t mode = 0;
int mode = 0;
int flags;
va_start(ap, path);

View File

@ -29,10 +29,4 @@
#define FD_CLOEXEC 1
#endif
int posix_open(const char *path, ...);
#ifndef NO_REDEF_POSIX_FUNCTIONS
#define open(path, ...) posix_open(path, __VA_ARGS__)
#endif
#endif

View File

@ -26,6 +26,10 @@ int asprintf(char **str, const char *fmt, ...);
#ifdef _WIN32
#if defined(_MSC_VER)
#define __func__ __FUNCTION__
#endif
void posix_perror(const char *s);
FILE * posix_fopen(const char *path, const char *mode);
char * posix_fgets(char *s, int size, FILE *stream);

View File

@ -26,7 +26,10 @@
int posix_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
int posix_open(const char *path, ...);
int posix_close(int fd);
ssize_t posix_read(int fd, void *buf, size_t count);
ssize_t posix_write(int fd, const void *buf, size_t count);
@ -39,6 +42,7 @@ int posix_setsockopt(int sockfd, int level, int optname,
#ifndef NO_REDEF_POSIX_FUNCTIONS
#define connect(sockfd, addr, addrlen) posix_connect(sockfd, addr, addrlen)
#define open(path, ...) posix_open(path, __VA_ARGS__)
#define close(fd) posix_close(fd)
#define read(fd, buf, count) posix_read(fd, buf, count)
#define write(fd, buf, count) posix_write(fd, buf, count)