Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <6526481A986CD51189C30002A52C969701E7A71B@Esealnt862.al.sw.ericsson.se> From: "Nenad Antic (EAB)" To: "'cygwin AT cygwin DOT com'" Subject: RE: Compiling netcat under cygwin Date: Thu, 5 Sep 2002 18:28:59 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C254F9.568FA6C0" Note-from-DJ: This may be spam ------_=_NextPart_000_01C254F9.568FA6C0 Content-Type: text/plain; charset="iso-8859-1" Hi, I combined the latest Debian netcat patch that has various bug fixes with the one Bjoern submitted earlier today to make it compile on cygwin. Thought that I might send it here since I don't know where else to put it. (In case somebody else wants a native cygwin netcat.) Just run patch > > 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 > 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 | > +------------------------------------------------------------- ------_=_NextPart_000_01C254F9.568FA6C0 Content-Type: application/octet-stream; name="netcat_1.10-12.1_cygwin.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="netcat_1.10-12.1_cygwin.diff" diff -Nu ../nc110/Makefile ./Makefile=0A= --- ../nc110/Makefile Wed Mar 20 03:16:06 1996=0A= +++ ./Makefile Thu Sep 5 17:52:04 2002=0A= @@ -9,6 +9,7 @@=0A= # pick gcc if you'd rather , and/or do -g instead of -O if = debugging=0A= # debugging=0A= # DFLAGS =3D -DTEST -DDEBUG=0A= +DFLAGS =3D -DTELNET=0A= CFLAGS =3D -O=0A= XFLAGS =3D # xtra cflags, set by systype targets=0A= XLIBS =3D # xtra libs if necessary?=0A= @@ -67,7 +68,7 @@=0A= make -e $(ALL) $(MFLAGS) XFLAGS=3D'-DAIX'=0A= =0A= linux:=0A= - make -e $(ALL) $(MFLAGS) XFLAGS=3D'-DLINUX' STATIC=3D-static=0A= + make -e $(ALL) $(MFLAGS) XFLAGS=3D'-DLINUX'=0A= =0A= # irix 5.2, dunno 'bout earlier versions. If STATIC=3D'-non_shared' = doesn't=0A= # work for you, null it out and yell at SGI for their STUPID = default=0A= @@ -108,6 +109,11 @@=0A= # Nexstep from mudge: NeXT cc is really old gcc=0A= next:=0A= make -e $(ALL) $(MFLAGS) XFLAGS=3D'-DNEXT' STATIC=3D-Bstatic=0A= + =0A= +# cygwin Unix-emulationlayer for Win9x/NT/...=0A= +cygwin:=0A= + make -e $(ALL) $(MFLAGS) XFLAGS=3D'-DCYGWIN' STATIC=3D CC=3Dgcc=0A= +=0A= =0A= # start with this for a new architecture, and see what breaks.=0A= generic:=0A= @@ -118,5 +124,5 @@=0A= ### RANDOM=0A= =0A= clean:=0A= - rm -f $(ALL) *.o *.obj=0A= + rm -f $(ALL) *.o *.obj *.exe=0A= =0A= diff -Nu ../nc110/changelog.debian ./changelog.debian=0A= --- ../nc110/changelog.debian Thu Jan 1 01:00:00 1970=0A= +++ ./changelog.debian Thu Sep 5 16:48:40 2002=0A= @@ -0,0 +1,84 @@=0A= +*************** +*** 1,81 **** +- netcat (1.10-12.1) frozen unstable; urgency=3Dlow +-=20 +- * Non-maintained upload. +- * Rename arm() to arm_timer() (Closes: #56390)=20 +-=20 +- -- Edward Brocklesby Tue, 22 Feb = 2000 12:59:12 +0000 +-=20 +- netcat (1.10-12) unstable; urgency=3Dlow +-=20 +- * Fixed bugs #45669 and #45675 (removed extraneous sleep(1) = command and also removed +- * the "punt!" message; added -q feature) +-=20 +- -- Robert S. Edmonds Wed, 22 Sep 1999 19:29:47 = -0400 +-=20 +- netcat (1.10-11) unstable; urgency=3Dlow +-=20 +- * Applied patch from Graham Stoney = that fixes deadlock +- * if the server doesn't close its end until it reads EOF on the = connection +-=20 +- -- Robert S. Edmonds Mon, 13 Sep 1999 21:53:59 = -0400 +-=20 +- netcat (1.10-10) unstable; urgency=3Dlow +-=20 +- * Man page fixed (/usr/doc/netcat/README.gz). Fixes bug #35811 +-=20 +- -- Robert S. Edmonds Sat, 12 Jun 1999 = 15:21:31 -0400 +-=20 +- netcat (1.10-9) unstable; urgency=3Dlow +-=20 +- * Compiled with -DTELNET. +-=20 +- -- Robert S. Edmonds Wed, 4 Nov 1998 = 09:27:40 -0500 +-=20 +- netcat (1.10-8) unstable frozen; urgency=3Dlow +-=20 +- * At the request of many users (and a few bug reports) the binary = is now +- * going to be called "nc" as it always was. +-=20 +- -- Robert S. Edmonds Sun, 26 Apr 1998 = 19:36:00 -0400 +-=20 +- netcat (1.10-7) unstable; urgency=3Dlow +-=20 +- * Fixed lintian error possible-name-space-pollution. (binary nc -> = netcat) +-=20 +- -- Robert S. Edmonds Mon, 30 Mar 1998 = 19:11:49 -0500 +-=20 +- netcat (1.10-6) unstable; urgency=3Dlow +-=20 +- * Upgraded to Standards-Version 2.4.0.0. +-=20 +- -- Robert S. Edmonds Tue, 17 Feb 1998 = 13:06:22 -0500 +-=20 +- netcat (1.10-5) unstable; urgency=3Dlow +-=20 +- * Merged in changes from Robert Woodcock . +- - Man page updates. +- - Compiled with -DTELNET +- * Removed bogus menu file. +- * Full source upload. +-=20 +- -- Joey Hess Sat, 10 Jan 1998 13:53:59 = -0500 +-=20 +- netcat (1.10-4) unstable; urgency=3Dlow +-=20 +- * Updated to "new" source format. (#9489) +- * Libc6. (#11716) +- * Orphaned the package. +- * Fixed up description in control file to conform with policy, = short +- description doesn't include package name now. +- * Fixed documentation location to comply with current policy. = (#13194, +- #11530, #9785) +- * Wrote a man page. (#9785, #5304, #6647) +- * Rewrote debian/rules to use debhelper. +- * Install upstream changelog. +-=20 +- -- Joey Hess Sat, 10 Jan 1998 00:53:45 = -0500 +-=20 +- Local variables: +- mode: debian-changelog +- add-log-mailing-address: "stu AT novare DOT net" +- End: +--- 0 ---- diff -Nu ../nc110/compress ./compress=0A= --- ../nc110/compress Thu Jan 1 01:00:00 1970=0A= +++ ./compress Thu Sep 5 16:47:38 2002=0A= @@ -0,0 +1,6 @@=0A= +# Tell dh_compress to ignore the examples/ directory. +find usr/info usr/man usr/X11*/man -type f +find usr/doc -type f \ + \( -size +4k -or -name "changelog*" \) \ + ! -name "*.htm*" ! -name "*.gif" \ + ! -name "copyright" | grep -v examples diff -Nu ../nc110/control ./control=0A= --- ../nc110/control Thu Jan 1 01:00:00 1970=0A= +++ ./control Thu Sep 5 16:48:40 2002=0A= @@ -0,0 +1,17 @@=0A= +Source: netcat +Section: net +Priority: optional +Maintainer: Robert S. Edmonds +Standards-Version: 2.4.1.0 + +Package: netcat +Architecture: any +Depends: ${shlibs:Depends} +Description: TCP/IP swiss army knife + A simple Unix utility which reads and writes data across network=20 + connections using TCP or UDP protocol. It is designed to be a = reliable + "back-end" tool that can be used directly or easily driven by other=20 + programs and scripts. At the same time it is a feature-rich network + debugging and exploration tool, since it can create almost any kind = of + connection you would need and has several interesting built-in=20 + capabilities. diff -Nu ../nc110/copyright ./copyright=0A= --- ../nc110/copyright Thu Jan 1 01:00:00 1970=0A= +++ ./copyright Thu Sep 5 16:48:40 2002=0A= @@ -0,0 +1,72 @@=0A= +This is the CrossLink/Debian prepackaged version of *Hobbit*'s pretty +nifty "TCP/IP swiss army knife", netcat. + +CrossLink's Debian packages are maintained by Michael Shields +; their development is supported by CrossLink +Internet Access and Networking Services, http://www.crosslink.net or ++1 703 642 1120 x154. + +The `netcat.blurb' file is appended. + +----- +Netcat 1.10 is an updated release of Netcat, a simple Unix utility = which reads +and writes data across network connections using TCP or UDP protocol. = It is +designed to be a reliable "back-end" tool that can be used directly or = easily +driven by other programs and scripts. At the same time it is a = feature-rich +network debugging and exploration tool, since it can create almost any = kind of +connection you would need and has several interesting built-in = capabilities. + +Some of netcat's major features are: + + Outbound or inbound connections, TCP or UDP, to or from any ports + Full DNS forward/reverse checking, with appropriate warnings + Ability to use any local source port + Ability to use any locally-configured network source address + Built-in port-scanning capabilities, with randomizer + Built-in loose source-routing capability + Can read command line arguments from standard input + Slow-send mode, one line every N seconds + Hex dump of transmitted and received data + Optional ability to let another program service established = connections + Optional telnet-options responder + +A very short list of potential uses: + + Script backends + Scanning ports and inventorying services, automated probes + Backup handlers + File transfers + Server testing, simulation, debugging, and hijacking + Firewall testing + Proxy gatewaying + Network performance testing + Address spoofing tests + Protecting X servers + 1001 other uses you'll likely come up with + +Changes between the 1.00 release and this release: + + Better portability -- updated generic.h and Makefile [thanx folks!] + Indication of local-end interface address on inbound connections + That's *Dave* Borman's telnet, not Paul Borman... + Better indication of DNS errors + Total byte counts printed if -v -v is used + A bunch of front-end driver companion programs and scripts + Better handling of stdin arguments-plus-data + Hex-dump feature + Telnet responder + Program exec works inbound or outbound now + +Netcat and the associated package is a product of Avian Research, and = is freely +available in full source form with no restrictions save an obligation = to give +credit where due. Get it via anonymous FTP at = avian.org:/src/hacks/nc110.tgz +which is a gzipped tar file and not to be confused with its version = 1.00 +precursor, nc100.tgz. Other distribution formats can be accomodated = upon +request. Netcat is also mirrored at the following [faster] sites: + + zippy.telcom.arizona.edu:/pub/mirrors/avian.org/hacks/nc110.tgz + ftp.sterling.com:/mirrors/avian.org/src/hacks/nc110.tgz + coast.cs.purdue.edu:/pub/tools/unix/netcat/nc110.tgz + ftp.rge.com:/pub/security/coast/mirrors/avian.org/netcat/nc110.tgz + +_H* 960320 Common subdirectories: ../nc110/data and ./data=0A= diff -Nu ../nc110/generic.h ./generic.h=0A= --- ../nc110/generic.h Sun Feb 18 01:36:44 1996=0A= +++ ./generic.h Thu Sep 5 17:00:17 2002=0A= @@ -70,6 +70,9 @@=0A= /* a sysvism, I think, but ... */=0A= #define HAVE_SYSINFO=0A= =0A= +/* not found on cygwin as far as i know (kahl AT informatik DOT uni-kl DOT de) = */=0A= +#define HAVE_RES_INIT=0A= +=0A= /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */=0A= /* Include files */=0A= /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */=0A= @@ -359,6 +362,19 @@=0A= #undef UTMPX=0A= #undef HAVE_SELECT_X=0A= #endif /* NeXTSTEP 3.2 motorola */=0A= +=0A= +/* cygwin unix-emulation-layer formWin9x/NT/...=0A= + * they try to be posix and linux compatible... */=0A= +#ifdef CYGWIN=0A= +#undef UTMPX=0A= +#undef HAVE_SYSINFO=0A= +#undef HAVE_SELECT_H=0A= +#undef HAVE_TTYENT_H=0A= +#define HAVE_NO_LSRR=0A= +#define HAVE_NO_NOP=0A= +#undef HAVE_RES_INIT=0A= +#endif /* cygwin */=0A= +=0A= =0A= /* Make some "generic" assumptions if all else fails */=0A= #ifdef GENERIC=0A= diff -Nu ../nc110/nc.1 ./nc.1=0A= --- ../nc110/nc.1 Thu Jan 1 01:00:00 1970=0A= +++ ./nc.1 Thu Sep 5 16:48:40 2002=0A= @@ -0,0 +1,134 @@=0A= +.TH NC 1=20 +.SH NAME +nc \- TCP/IP swiss army knife +.SH SYNOPSIS +.B nc +.I "[-options] hostname port[s] [ports] ..." +.br +.B nc +.I "-l -p port [-options] [hostname] [port]" +.SH "DESCRIPTION" +.B netcat +is a simple unix utility which reads and writes data across network +connections, using TCP or UDP protocol. It is designed to be a = reliable +"back-end" tool that can be used directly or easily driven by other = programs +and scripts. At the same time, it is a feature-rich network debugging = and +exploration tool, since it can create almost any kind of connection = you +would need and has several interesting built-in capabilities. Netcat, = or +"nc" as the actual program is named, should have been supplied long = ago as +another one of those cryptic but standard Unix tools. +.P +In the simplest usage, "nc host port" creates a TCP connection to the = given +port on the given target host. Your standard input is then sent to = the host, +and anything that comes back across the connection is sent to your = standard=20 +output. This continues indefinitely, until the network side of the = connection +shuts down. Note that this behavior is different from most other = applications +which shut everything down and exit after an end-of-file on the = standard input. +.P +Netcat can also function as a server, by listening for inbound = connections +on arbitrary ports and then doing the same reading and writing. With = minor +limitations, netcat doesn't really care if it runs in "client" or = "server" +mode -- it still shovels data back and forth until there isn't any = more +left. In either mode, shutdown can be forced after a configurable time = of +inactivity on the network side. +.P +And it can do this via UDP too, so netcat is possibly the "udp = telnet-like" +application you always wanted for testing your UDP-mode servers. UDP, = as +the "U" implies, gives less reliable data transmission than TCP = connections=20 +and some systems may have trouble sending large amounts of data that = way, but +it's still a useful capability to have. +.P +You may be asking "why not just use telnet to connect to arbitrary = ports?" +Valid question, and here are some reasons. Telnet has the "standard = input +EOF" problem, so one must introduce calculated delays in driving = scripts to +allow network output to finish. This is the main reason netcat stays = running +until the *network* side closes. Telnet also will not transfer = arbitrary +binary data, because certain characters are interpreted as telnet = options +and are thus removed from the data stream. Telnet also emits some of = its +diagnostic messages to standard output, where netcat keeps such things +religiously separated from its *output* and will never modify any of = the +real data in transit unless you *really* want it to. And of course = telnet is +incapable of listening for inbound connections, or using UDP instead. = Netcat +doesn't have any of these limitations, is much smaller and faster than = telnet, +and has many other advantages. +.SH OPTIONS +.TP 13 +.I \-g gateway +source-routing hop point[s], up to 8 +.TP 13 +.I \-G num +source-routing pointer: 4, 8, 12, ... +.TP 13 +.I \-h +Display help. +.TP 13 +.I \-i secs +delay interval for lines sent, ports scanned +.TP 13 +.I \-l +listen mode, for inbound connects +.TP 13 +.I \-n +numeric-only IP addresses, no DNS +.TP 13 +.I \-o file +hex dump of traffic +.TP 13 +.I \-p port +local port number +(port numbers can be individual or ranges: lo-hi [inclusive]) +.TP 13 +.I \-q seconds +Quit after EOF is detected on stdin and after a delay. "-q 0" makes = "nc" +quit as soon as EOF is detected. +.TP 13 +.I \-r +randomize local and remote ports +.TP 13 +.I \-s addr +local source address +.TP 13 +.I \-t +Enable telnet negotiation +.TP 13 +.I \-u +UDP mode +.TP 13 +.I \-v +verbose [use twice to be more verbose] +.TP 13 +.I \-w secs +timeout for connects and final net reads +.TP 13 +.I \-z +zero-I/O mode [used for scanning] +.SH COPYRIGHT +Netcat is entirely my own creation, although plenty of other code was = used as +examples. It is freely given away to the Internet community in the = hope that +it will be useful, with no restrictions except giving credit where it = is due. +No GPLs, Berkeley copyrights or any of that nonsense. The author = assumes NO +responsibility for how anyone uses it. If netcat makes you rich = somehow and +you're feeling generous, mail me a check. If you are affiliated in = any way +with Microsoft Network, get a life. Always ski in control. Comments, +questions, and patches to hobbit AT avian DOT org. +.SH BUGS +Efforts have been made to have netcat "do the right thing" in all its +various modes. If you believe that it is doing the wrong thing under = whatever +circumstances, please notify me and tell me how you think it should = behave. +If netcat is not able to do some task you think up, minor tweaks to = the code +will probably fix that. It provides a basic and easily-modified = template for +writing other network applications, and I certainly encourage people = to make +custom mods and send in any improvements they make to it. Continued = feedback +from the Internet community is always welcome! +.P +Some port names in /etc/services contain hyphens -- netcat currently = will not +correctly parse those, so specify ranges using numbers if you can. +.SH "SEE ALSO" +/usr/doc/netcat/README.gz +.SH AUTHOR +This manual page was written by Joey Hess = and +Robert Woodcock , cribbing heavily from Netcat's = README +file. +.P +Netcat was written by a guy we know as the Hobbit, +or _H* . diff -Nu ../nc110/netcat.c ./netcat.c=0A= --- ../nc110/netcat.c Thu Mar 21 00:38:04 1996=0A= +++ ./netcat.c Thu Sep 5 16:58:33 2002=0A= @@ -160,6 +160,7 @@=0A= USHORT o_verbose =3D 0;=0A= unsigned int o_wait =3D 0;=0A= USHORT o_zero =3D 0;=0A= +int o_quit =3D -1; /* 0 =3D=3D quit-now; >0 =3D=3D quit after o_quit = seconds */=0A= /* o_tn in optional section */=0A= =0A= /* Debug macro: squirt whatever message and sleep a bit so we can see = it go=0A= @@ -211,7 +212,6 @@=0A= o_verbose =3D 1;=0A= holler (str, p1, p2, p3, p4, p5, p6);=0A= close (netfd);=0A= - sleep (1);=0A= exit (1);=0A= } /* bail */=0A= =0A= @@ -222,7 +222,15 @@=0A= errno =3D 0;=0A= if (o_verbose > 1) /* normally we don't care */=0A= bail (wrote_txt, wrote_net, wrote_out);=0A= - bail (" punt!");=0A= + bail ("");=0A= +}=0A= +=0A= +/* quit :=0A= + handler for a "-q" timeout (exit 0 instead of 1) */=0A= +void quit()=0A= +{=0A= + close(netfd);=0A= + exit(0);=0A= }=0A= =0A= /* timeout and other signal handling cruft */=0A= @@ -235,9 +243,9 @@=0A= longjmp (jbuf, jval);=0A= }=0A= =0A= -/* arm :=0A= +/* arm_timer :=0A= set the timer. Zero secs arg means unarm */=0A= -void arm (num, secs)=0A= +void arm_timer (num, secs)=0A= unsigned int num;=0A= unsigned int secs;=0A= {=0A= @@ -250,7 +258,7 @@=0A= alarm (secs);=0A= jval =3D num;=0A= } /* if secs */=0A= -} /* arm */=0A= +} /* arm_timer */=0A= =0A= /* Hmalloc :=0A= malloc up what I want, rounded up to *4, and pre-zeroed. Either = succeeds=0A= @@ -713,6 +721,7 @@=0A= if (gatesidx) { /* if we wanted any srcrt hops ... */=0A= /* don't even bother compiling if we can't do IP options here! */=0A= #ifdef IP_OPTIONS=0A= +#ifndef HAVE_NO_LSRR=0A= if (! optbuf) { /* and don't already *have* a srcrt set */=0A= char * opp; /* then do all this setup hair */=0A= optbuf =3D Hmalloc (48);=0A= @@ -737,20 +746,23 @@=0A= rr =3D setsockopt (nnetfd, IPPROTO_IP, IP_OPTIONS, optbuf, x);=0A= if (rr =3D=3D -1)=0A= bail ("srcrt setsockopt fuxored");=0A= +#else /* HAVE_NO_LSRR */=0A= + holler ("Warning: source routing unavailable on this machine, = ignoring");=0A= +#endif=0A= #else /* IP_OPTIONS */=0A= holler ("Warning: source routing unavailable on this machine, = ignoring");=0A= #endif /* IP_OPTIONS*/=0A= } /* if gatesidx */=0A= =0A= /* wrap connect inside a timer, and hit it */=0A= - arm (1, o_wait);=0A= + arm_timer (1, o_wait);=0A= if (setjmp (jbuf) =3D=3D 0) {=0A= rr =3D connect (nnetfd, (SA *)remend, sizeof (SA));=0A= } else { /* setjmp: connect failed... */=0A= rr =3D -1;=0A= errno =3D ETIMEDOUT; /* fake it */=0A= }=0A= - arm (0, 0);=0A= + arm_timer (0, 0);=0A= if (rr =3D=3D 0)=0A= return (nnetfd);=0A= close (nnetfd); /* clean up junked socket FD!! */=0A= @@ -820,14 +832,14 @@=0A= actually does work after all. Yow. YMMV on strange platforms! = */=0A= if (o_udpmode) {=0A= x =3D sizeof (SA); /* retval for recvfrom */=0A= - arm (2, o_wait); /* might as well timeout this, too */=0A= + arm_timer (2, o_wait); /* might as well timeout this, too */=0A= if (setjmp (jbuf) =3D=3D 0) { /* do timeout for initial connect = */=0A= rr =3D recvfrom /* and here we block... */=0A= (nnetfd, bigbuf_net, BIGSIZ, MSG_PEEK, (SA *) remend, &x);=0A= Debug (("dolisten/recvfrom ding, rr =3D %d, netbuf %s ", rr, = bigbuf_net))=0A= } else=0A= goto dol_tmo; /* timeout */=0A= - arm (0, 0);=0A= + arm_timer (0, 0);=0A= /* I'm not completely clear on how this works -- BSD seems to make = UDP=0A= just magically work in a connect()ed context, but we'll undoubtedly = run=0A= into systems this deal doesn't work on. For now, we apparently = have to=0A= @@ -845,12 +857,12 @@=0A= =0A= /* fall here for TCP */=0A= x =3D sizeof (SA); /* retval for accept */=0A= - arm (2, o_wait); /* wrap this in a timer, too; 0 =3D forever */=0A= + arm_timer (2, o_wait); /* wrap this in a timer, too; 0 =3D forever = */=0A= if (setjmp (jbuf) =3D=3D 0) {=0A= rr =3D accept (nnetfd, (SA *)remend, &x);=0A= } else=0A= goto dol_tmo; /* timeout */=0A= - arm (0, 0);=0A= + arm_timer (0, 0);=0A= close (nnetfd); /* dump the old socket */=0A= nnetfd =3D rr; /* here's our new one */=0A= =0A= @@ -1216,6 +1228,7 @@=0A= if (rr <=3D 0) { /* at end, or fukt, or ... */=0A= FD_CLR (0, ding1); /* disable and close stdin */=0A= close (0);=0A= + shutdown(fd, 1);=0A= } else {=0A= rzleft =3D rr;=0A= zp =3D bigbuf_in;=0A= @@ -1315,9 +1328,11 @@=0A= char * randports =3D NULL;=0A= =0A= #ifdef HAVE_BIND=0A= +#ifdef HAVE_RES_INIT=0A= /* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on = SunLOSs? */=0A= res_init();=0A= #endif=0A= +#endif=0A= /* I was in this barbershop quartet in Skokie IL ... */=0A= /* round up the usual suspects, i.e. malloc up all the stuff we need = */=0A= lclend =3D (SAI *) Hmalloc (sizeof (SA));=0A= @@ -1389,7 +1404,7 @@=0A= =0A= /* If your shitbox doesn't have getopt, step into the nineties = already. */=0A= /* optarg, optind =3D next-argv-component [i.e. flag arg]; optopt =3D = last-char */=0A= - while ((x =3D getopt (argc, argv, "ae:g:G:hi:lno:p:rs:tuvw:z")) !=3D = EOF) {=0A= + while ((x =3D getopt (argc, argv, "ae:g:G:hi:lno:p:q:rs:tuvw:z")) = !=3D EOF) {=0A= /* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) = */=0A= switch (x) {=0A= case 'a':=0A= @@ -1443,6 +1458,8 @@=0A= break;=0A= case 'r': /* randomize various things */=0A= o_random++; break;=0A= + case 'q': /* quit after stdin does EOF */=0A= + o_quit =3D atoi(optarg); break;=0A= case 's': /* local source address */=0A= /* do a full lookup [since everything else goes through the same = mill],=0A= unless -n was previously specified. In fact, careful placement of = -n can=0A= @@ -1651,6 +1668,7 @@=0A= -o file hex dump of traffic\n\=0A= -p port local port number\n\=0A= -r randomize local and remote ports\n\=0A= + -q secs quit after EOF on stdin and delay of secs\n\=0A= -s addr local source address");=0A= #ifdef TELNET=0A= holler ("\=0A= diff -Nu ../nc110/rules ./rules=0A= --- ../nc110/rules Thu Jan 1 01:00:00 1970=0A= +++ ./rules Thu Sep 5 16:47:38 2002=0A= @@ -0,0 +1,54 @@=0A= +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey = Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=3D1 + +build: build-stamp +build-stamp: + dh_testdir + $(MAKE) CC=3D"gcc" CFLAGS=3D"-O2" linux + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + # Add here commands to clean up after the build process. + -$(MAKE) clean + dh_clean + +# Build architecture-independent files here. +binary-indep: build +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs usr/bin + install -s nc debian/tmp/usr/bin + dh_installdocs README + dh_installexamples data/ scripts/ + dh_installmanpages + dh_installchangelogs Changelog + dh_movefiles + dh_strip + dh_compress + gzip -9v debian/tmp/usr/share/man/man1/nc.1 + gzip -9v debian/tmp/usr/share/doc/netcat/changelog.Debian + gzip -9v debian/tmp/usr/share/doc/netcat/changelog + dh_fixperms + dh_suidregister + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_makeshlibs + dh_md5sums + dh_builddeb + +source diff: = =20 + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary Common subdirectories: ../nc110/scripts and ./scripts=0A= ------_=_NextPart_000_01C254F9.568FA6C0 Content-Type: text/plain; charset=us-ascii -- 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/ ------_=_NextPart_000_01C254F9.568FA6C0--