libs/l_net: support both BSD and Win sockets

This commit is contained in:
Marco Cawthorne 2021-06-06 19:55:18 +02:00
parent 16811dcf6c
commit 7416a87f05
3 changed files with 6 additions and 1 deletions

View File

@ -7,7 +7,7 @@ DO_CC=$(CC) -static -fPIC $(LIB_CFLAGS) -o $@ -c $<
$(DO_CC)
WS_OBJS = \
l_net.o l_net_berkley.o
l_net.o l_net_berkley.o l_net_wins.o
# binary target
../libl_net.a: $(WS_OBJS)
@ -16,6 +16,7 @@ WS_OBJS = \
# object files
l_net.o: l_net.c l_net.h
l_net_berkley.o: l_net_berkley.c
l_net_wins.o: l_net_wins.c
clean:
-rm -f *.o ../libl_net.a

View File

@ -29,6 +29,7 @@
// Notes:
//===========================================================================
#if defined(POSIX) || defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
//#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
@ -746,3 +747,4 @@ int WINS_SetSocketPort( struct sockaddr_s *addr, int port ){
( (struct sockaddr_in *)addr )->sin_port = htons( (u_short)port );
return 0;
} //end of the function WINS_SetSocketPort
#endif

View File

@ -29,6 +29,7 @@
// Notes:
//===========================================================================
#if defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
@ -759,3 +760,4 @@ int WINS_SetSocketPort( struct sockaddr_s *addr, int port ){
( (struct sockaddr_in *)addr )->sin_port = htons( (u_short)port );
return 0;
} //end of the function WINS_SetSocketPort
#endif