]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
fix compile on OSX 10.6
authorsdhsdh <sdhsdh>
Fri, 20 Nov 2009 06:04:24 +0000 (06:04 +0000)
committersdhsdh <sdhsdh>
Fri, 20 Nov 2009 06:04:24 +0000 (06:04 +0000)
support/sdk/c/sf/Makefile.am
support/sdk/c/sf/sf.c
support/sdk/c/sf/sfsource.c

index b26b8059285429e77197773bcfe4ed91a328de77..3110210c0f59d07cab59d8a37ac2cef280b6c4f2 100644 (file)
@@ -1,5 +1,7 @@
 AUTOMAKE_OPTIONS = foreign
 
+CFLAGS = -D_POSIX_C_SOURCE
+
 TOS=$(shell ncc -print-tosdir)
 SERIAL_H = $(TOS)/lib/serial/Serial.h
 
@@ -34,7 +36,7 @@ libmote_a_SOURCES = \
        sfsource.c
 
 serialpacket.c serialpacket.h: $(SERIAL_H)
-       mig -o serialpacket.h -c-prefix=spacket c $(SERIAL_H) serial_packet
+       mig -o serialpacket.h -c-prefix=spacket c $(SERIAL_H) serial_packet $(CFLAGS)
 
 serialprotocol.h: $(SERIAL_H)
-       ncg -o $@ -c-prefix=SERIAL c $(SERIAL_H) Serial.h
+       ncg -o $@ -c-prefix=SERIAL c $(SERIAL_H) Serial.h $(CFLAGS)
index ada9bc5b4613ba2eec63f5742d452f1fe54c9f2b..f26fe8100298b800e684398581a074d7db9db5ae 100644 (file)
@@ -1,5 +1,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/select.h>
 #include <netinet/in.h>
 #include <netdb.h>
 #include <errno.h>
index 24df9603acc33581dea43bc61c3e60a2169a29c3..ecde05c65bbb0e65c4b043f6e414e7ed578700d8 100644 (file)
@@ -70,7 +70,7 @@ int open_sf_source(const char *host, int port)
     }      
 
   addr.sin_family = entry->h_addrtype;
-  memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
+  memcpy(&addr.sin_addr, entry->h_addr_list[0], entry->h_length);
   addr.sin_port = htons(port);
   if (connect(fd, (struct sockaddr *)&addr, sizeof addr) < 0)
     {