blob: 8a41da8088b45d50b06332d46180b70cd5605610 [file] [log] [blame]
diff --git a/src/Makefile.in b/src/Makefile.in
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -161,6 +161,7 @@ netcat_SOURCES = \
netcat_LDADD = @CONTRIBLIBS@ @INTLLIBS@
+netcat_PPAPI = -lppapi_simple -lnacl_io -lppapi
EXTRA_DIST = *.h
@@ -188,7 +189,7 @@ depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
+CCLD = $(CXX)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(netcat_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
@@ -229,7 +230,7 @@ clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
netcat$(EXEEXT): $(netcat_OBJECTS) $(netcat_DEPENDENCIES)
@rm -f netcat$(EXEEXT)
- $(LINK) $(netcat_LDFLAGS) $(netcat_OBJECTS) $(netcat_LDADD) $(LIBS)
+ $(LINK) $(netcat_LDFLAGS) $(netcat_OBJECTS) $(netcat_LDADD) $(LIBS) $(netcat_PPAPI)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
diff --git a/src/flagset.c b/src/flagset.c
--- a/src/flagset.c
+++ b/src/flagset.c
@@ -169,7 +169,7 @@ int netcat_flag_count(void)
unsigned short netcat_flag_rand(void)
{
- int rand, randmax = netcat_flag_count() - 1;
+ int randv, randmax = netcat_flag_count() - 1;
unsigned short ret = 0;
assert(flagset);
@@ -180,16 +180,16 @@ unsigned short netcat_flag_rand(void)
#ifdef USE_RANDOM
/* fetch a random number from the high-order bits */
- rand = 1 + (int) ((float)randmax * RAND() / (RAND_MAX + 1.0));
+ randv = 1 + (int) ((float)randmax * RAND() / (RAND_MAX + 1.0));
#else
# ifdef __GNUC__
# warning "random routines not found, removed random support"
# endif
- rand = 1; /* simulates a random number */
+ randv = 1; /* simulates a random number */
#endif
/* loop until we find the specified flag */
- while (rand--)
+ while (randv--)
ret = netcat_flag_next(ret);
/* don't return this same flag again */
diff --git a/src/udphelper.c b/src/udphelper.c
--- a/src/udphelper.c
+++ b/src/udphelper.c
@@ -30,7 +30,9 @@
#ifndef USE_PKTINFO
#include <sys/ioctl.h>
-#include <net/if.h>
+#if !defined(__native_client__) || defined(__GLIBC__)
+# include <net/if.h>
+#endif
#ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h>
#endif
@@ -109,6 +111,13 @@ int udphelper_ancillary_read(struct msghdr *my_hdr,
int udphelper_sockets_open(int **sockbuf, in_port_t nport)
{
+#if defined(__native_client__)
+ /*
+ * TODO(bradnelson): figure out if nacl_io can support these calls.
+ */
+ errno = ENOSYS;
+ return -1;
+#else
int ret, i, alloc_size, dummy_sock, if_total = 1;
int *my_sockbuf = NULL, my_sockbuf_max = 0, sock_total = 0;
unsigned int if_pos = 0;
@@ -279,6 +288,7 @@ int udphelper_sockets_open(int **sockbuf, in_port_t nport)
errno = ret;
return -1;
+#endif
}
#endif /* USE_PKTINFO */