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 _LIBC_INTERFACE_H_
24 #define _LIBC_INTERFACE_H_
32 #include "libc_internal.h"
34 #include "glibcompat.h"
38 #endif /* __cplusplus */
41 #define S_IRUSR S_IREAD
42 #define S_IWUSR S_IWRITE
43 #define S_IXUSR S_IEXEC
45 #define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)
51 #define socket( domain, style, protocol ) \
52 wpurple_socket( domain, style, protocol )
54 #define connect( socket, addr, length ) \
55 wpurple_connect( socket, addr, length )
57 #define getsockopt( socket, level, optname, optval, optlenptr ) \
58 wpurple_getsockopt( socket, level, optname, optval, optlenptr )
60 #define setsockopt( socket, level, optname, optval, optlen ) \
61 wpurple_setsockopt( socket, level, optname, optval, optlen )
63 #define getsockname( socket, addr, lenptr ) \
64 wpurple_getsockname( socket, addr, lenptr )
66 #define bind( socket, addr, length ) \
67 wpurple_bind( socket, addr, length )
69 #define listen( socket, n ) \
70 wpurple_listen( socket, n )
72 #define sendto(socket, buf, len, flags, to, tolen) \
73 wpurple_sendto(socket, buf, len, flags, to, tolen)
75 #define recv(fd, buf, len, flags) \
76 wpurple_recv(fd, buf, len, flags)
78 #define send(socket, buf, buflen, flags) \
79 wpurple_send(socket, buf, buflen, flags)
82 #define ioctl( fd, command, val ) \
83 wpurple_ioctl( fd, command, val )
86 #define fcntl( fd, command, ... ) \
87 wpurple_fcntl( fd, command, ##__VA_ARGS__ )
90 #define inet_aton( name, addr ) \
91 wpurple_inet_aton( name, addr )
93 #define inet_ntop( af, src, dst, cnt ) \
94 wpurple_inet_ntop( af, src, dst, cnt )
96 #define inet_pton( af, src, dst ) \
97 wpurple_inet_pton( af, src, dst )
100 #define gethostbyname( name ) \
101 wpurple_gethostbyname( name )
104 #define ntohl( netlong ) \
105 (unsigned int)ntohl( netlong )
108 #define hstrerror( herror ) \
109 wpurple_strerror( errno )
110 #define strerror( errornum ) \
111 wpurple_strerror( errornum )
112 #define g_strerror( errornum ) \
113 wpurple_strerror( errornum )
116 #define read( fd, buf, buflen ) \
117 wpurple_read( fd, buf, buflen )
119 #define write( socket, buf, buflen ) \
120 wpurple_write( socket, buf, buflen )
122 #define close( fd ) \
126 #define sleep(x) Sleep((x)*1000)
129 #define gethostname( name, size ) \
130 wpurple_gethostname( name, size )
132 #define fsync(fd) _commit(fd)
135 #define gettimeofday( timeval, timezone ) \
136 wpurple_gettimeofday( timeval, timezone )
139 #if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 || \
140 !defined(IS_WIN32_CROSS_COMPILED)
142 # define snprintf _snprintf
144 # define vsnprintf _vsnprintf
147 #define rename( oldname, newname ) \
148 g_rename( oldname, newname )
154 /* XXX: it may be also defined by pthread.h */
156 #define localtime_r( time, resultp ) \
157 wpurple_localtime_r( time, resultp )
161 #endif /* __cplusplus */
163 #endif /* _LIBC_INTERFACE_H_ */