 +
 +	return(s - src - 1);	/* count does not include NUL */
 +}
++
++#define INVALID 	1
++#define TOOSMALL 	2
++#define TOOLARGE 	3
 +
 +long long
 +strtonum(const char *numstr, long long minval, long long maxval,

diff -uprN netcat-openbsd-1.130.bk/Makefile netcat-openbsd-1.130/Makefile
--- netcat-openbsd-1.130.bk/Makefile	2017-04-13 23:16:15.235448400 +0800
+++ netcat-openbsd-1.130/Makefile	2017-04-13 23:24:53.021349200 +0800
@@ -1,7 +1,7 @@
 #       $OpenBSD: Makefile,v 1.6 2001/09/02 18:45:41 jakob Exp $
 
 PROG=	nc

+SRCS=	netcat.c atomicio.c socks.c arc4random.c
 
 PKG_CONFIG ?= pkg-config
-LIBS=  `$(PKG_CONFIG) --libs libbsd` -lresolv
+LIBS=  -lresolv
 OBJS=  $(SRCS:.c=.o)
 CFLAGS=  -g -O2
 LDFLAGS=  -Wl,--no-add-needed
diff -uprN netcat-openbsd-1.130.bk/netcat.c netcat-openbsd-1.130/netcat.c
--- netcat-openbsd-1.130.bk/netcat.c	2017-04-13 23:37:45.463285600 +0800
+++ netcat-openbsd-1.130/netcat.c	2017-04-13 23:47:38.148270100 +0800
@@ -96,8 +96,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <bsd/stdlib.h>
-#include <bsd/string.h>
+#include <sys/cdefs.h>
 #include "atomicio.h"
 
 #ifndef SUN_LEN
@@ -180,7 +179,11 @@ static int connect_with_timeout(int fd,
         socklen_t salen, int ctimeout);
 
 static void quit();
-
+long long
+strtonum(const char *numstr, long long minval, long long maxval,
+    const char **errstrp);
+size_t
+strlcpy(char *dst, const char *src, size_t siz);
 int
 main(int argc, char *argv[])
 {
@@ -1616,3 +1619,72 @@ static void quit()
 {
 	exit(0);
 }
