4 * File: libc_interface.h
6 * Copyright (C) 2002-2003, Herman Bloggs <hermanator12002@yahoo.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #ifndef PURPLE_WIN32_LIBC_INTERFACE_H
24 #define PURPLE_WIN32_LIBC_INTERFACE_H
32 #include "libc_internal.h"
34 #include "glibcompat.h"
39 #define S_IRUSR S_IREAD
40 #define S_IWUSR S_IWRITE
41 #define S_IXUSR S_IEXEC
43 #define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
49 #define socket( domain, style, protocol ) \
50 wpurple_socket( domain, style, protocol )
52 #define connect( socket, addr, length ) \
53 wpurple_connect( socket, addr, length )
55 #define getsockopt( socket, level, optname, optval, optlenptr ) \
56 wpurple_getsockopt( socket, level, optname, optval, optlenptr )
58 #define setsockopt( socket, level, optname, optval, optlen ) \
59 wpurple_setsockopt( socket, level, optname, optval, optlen )
61 #define getsockname( socket, addr, lenptr ) \
62 wpurple_getsockname( socket, addr, lenptr )
64 #define bind( socket, addr, length ) \
65 wpurple_bind( socket, addr, length )
67 #define listen( socket, n ) \
68 wpurple_listen( socket, n )
70 #define sendto(socket, buf, len, flags, to, tolen) \
71 wpurple_sendto(socket, buf, len, flags, to, tolen)
73 #define recv(fd, buf, len, flags) \
74 wpurple_recv(fd, buf, len, flags)
76 #define send(socket, buf, buflen, flags) \
77 wpurple_send(socket, buf, buflen, flags)
80 #define ioctl( fd, command, val ) \
81 wpurple_ioctl( fd, command, val )
84 #define fcntl( fd, command, ... ) \
85 wpurple_fcntl( fd, command, ##__VA_ARGS__ )
88 #define inet_aton( name, addr ) \
89 wpurple_inet_aton( name, addr )
91 #define inet_ntop( af, src, dst, cnt ) \
92 wpurple_inet_ntop( af, src, dst, cnt )
94 #define inet_pton( af, src, dst ) \
95 wpurple_inet_pton( af, src, dst )
98 #define gethostbyname( name ) \
99 wpurple_gethostbyname( name )
102 #define ntohl( netlong ) \
103 (unsigned int)ntohl( netlong )
106 #define hstrerror( herror ) \
107 wpurple_strerror( errno )
108 #define strerror( errornum ) \
109 wpurple_strerror( errornum )
110 #define g_strerror( errornum ) \
111 wpurple_strerror( errornum )
114 #define read( fd, buf, buflen ) \
115 wpurple_read( fd, buf, buflen )
117 #define write( socket, buf, buflen ) \
118 wpurple_write( socket, buf, buflen )
120 #define close( fd ) \
124 #define sleep(x) Sleep((x)*1000)
127 #define gethostname( name, size ) \
128 wpurple_gethostname( name, size )
130 #define fsync(fd) _commit(fd)
133 #define gettimeofday( timeval, timezone ) \
134 wpurple_gettimeofday( timeval, timezone )
137 #if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 || \
138 !defined(IS_WIN32_CROSS_COMPILED)
140 # define snprintf _snprintf
142 # define vsnprintf _vsnprintf
145 #define rename( oldname, newname ) \
146 g_rename( oldname, newname )
152 /* XXX: it may be also defined by pthread.h */
154 #define localtime_r( time, resultp ) \
155 wpurple_localtime_r( time, resultp )
159 #endif /* PURPLE_WIN32_LIBC_INTERFACE_H */