Compiling netcat under cygwin
Bjoern Kahl AG Resy
kahl@informatik.uni-kl.de
Thu Sep 5 06:09:00 GMT 2002
Hallo !
On Thu, 5 Sep 2002, Nenad Antic (EAB) wrote:
> I would like to get netcat
> (http://www.atstake.com/research/tools/nc110.tgz) compiled natively
> under cygwin. Currently there isn't any appropriate target in
> netcat's makefile to do this.
>
> I do know that there is a Windows NT version available at
>
> http://www.atstake.com/research/tools/nc11nt.zip
>
> However, when using that version under cygwin netcat behaves a bit
> funny.
[ ... ]
> Would anybody know how to set up the gcc options so that netcat
> can compile under cygwin properly? I would be really grateful
> for this information.
Please find the attached patch.
unpack the above mentioned tar-file in a empty directory,
save the patch in the same directory, then run in that directory
patch <netcat-cygwin.patch
make cygwin
You should find a nc binary after these steps in the directory.
Note: I am in no connection to the netcat maintainer, neither
native or cygwin, and I have no plans to maintain a
cygwin-version. I just taken 10 minutes to hack this up.
Bjoern
--
+---------------------------------------------------------------------+
| Dipl.-Phys. Bjoern Kahl +++ AG Embedded Systems and Robotics (RESY) |
| Informatics Faculty +++ Building 48 +++ University of Kaiserslautern|
| phone: +49-631-205-2654 +++ www: http://resy.informatik.uni-kl.de |
+---------------------------------------------------------------------+
-------------- next part --------------
diff -u netcat.orig/Makefile /Makefile
--- netcat.orig/Makefile Wed Mar 20 04:16:06 1996
+++ /Makefile Thu Sep 5 13:47:30 2002
@@ -109,9 +109,16 @@
next:
make -e $(ALL) $(MFLAGS) XFLAGS='-DNEXT' STATIC=-Bstatic
+
+# cygwin Unix-emulationlayer for Win9x/NT/...
+cygwin:
+ make -e $(ALL) $(MFLAGS) XFLAGS='-DCYGWIN' STATIC= CC=gcc
+
+
# start with this for a new architecture, and see what breaks.
generic:
make -e $(ALL) $(MFLAGS) XFLAGS='-DGENERIC' STATIC=
+
# Still at large: dgux dynix ???
diff -u netcat.orig/generic.h /generic.h
--- netcat.orig/generic.h Sun Feb 18 02:36:43 1996
+++ /generic.h Thu Sep 5 14:17:18 2002
@@ -70,6 +70,9 @@
/* a sysvism, I think, but ... */
#define HAVE_SYSINFO
+/* not found on cygwin as far as i know (kahl@informatik.uni-kl.de) */
+#define HAVE_RES_INIT
+
/* ============= */
/* Include files */
/* ============= */
@@ -359,6 +362,20 @@
#undef UTMPX
#undef HAVE_SELECT_X
#endif /* NeXTSTEP 3.2 motorola */
+
+
+/* cygwin unix-emulation-layer formWin9x/NT/...
+ * they try to be posix and linux compatible... */
+#ifdef CYGWIN
+#undef UTMPX
+#undef HAVE_SYSINFO
+#undef HAVE_SELECT_H
+#undef HAVE_TTYENT_H
+#define HAVE_NO_LSRR
+#define HAVE_NO_NOP
+#undef HAVE_RES_INIT
+#endif /* cygwin */
+
/* Make some "generic" assumptions if all else fails */
#ifdef GENERIC
diff -u netcat.orig/netcat.c /netcat.c
--- netcat.orig/netcat.c Thu Mar 21 01:38:04 1996
+++ /netcat.c Thu Sep 5 14:09:48 2002
@@ -713,6 +713,7 @@
if (gatesidx) { /* if we wanted any srcrt hops ... */
/* don't even bother compiling if we can't do IP options here! */
#ifdef IP_OPTIONS
+#ifndef HAVE_NO_LSRR
if (! optbuf) { /* and don't already *have* a srcrt set */
char * opp; /* then do all this setup hair */
optbuf = Hmalloc (48);
@@ -737,6 +738,9 @@
rr = setsockopt (nnetfd, IPPROTO_IP, IP_OPTIONS, optbuf, x);
if (rr == -1)
bail ("srcrt setsockopt fuxored");
+#else /* HAVE_NO_LSRR */
+ holler ("Warning: source routing unavailable on this machine, ignoring");
+#endif
#else /* IP_OPTIONS */
holler ("Warning: source routing unavailable on this machine, ignoring");
#endif /* IP_OPTIONS*/
@@ -1315,8 +1319,10 @@
char * randports = NULL;
#ifdef HAVE_BIND
+#ifdef HAVE_RES_INIT
/* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on SunLOSs? */
res_init();
+#endif
#endif
/* I was in this barbershop quartet in Skokie IL ... */
/* round up the usual suspects, i.e. malloc up all the stuff we need */
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list