Package: Netcat
Version: 1.10-32
Version of Netcat can only be check with the -h option, which exits netcat
with an error. It It is not very convenient for scripting.
Attached to this email you will find a patch to fix this.
--- ./netcat.c 2007-11-27 13:09:42.000000000 +0100
+++ ./netcat.c 2007-11-27 15:11:33.000000000 +0100
@@ -26,6 +26,8 @@
backend progs to do various encryption modes??!?!
*/
+#define VERSION "Debian 33 gostai 4"
+
#include "generic.h" /* same as with L5, skey, etc */
/* conditional includes -- a very messy section which you may have to dink
@@ -1514,7 +1514,7 @@
/* If your shitbox doesn't have getopt, step into the nineties already. */
/* optarg, optind = next-argv-component [i.e. flag arg]; optopt = last-char */
- while ((x = getopt (argc, argv, "abc:e:g:G:hi:klno:p:q:rs:tuvw:x:z")) != EOF) {
+ while ((x = getopt (argc, argv, "abc:e:g:G:hi:klno:p:q:rs:tuvVw:x:z")) != EOF) {
/* Debug (("in go: x now %c, optarg %x optind %d", x, optarg, optind)) */
switch (x) {
case 'a':
@@ -1590,6 +1592,8 @@
#endif /* TELNET */
case 'u': /* use UDP */
o_udpmode++; break;
+ case 'V': /* version */
+ version(); break;
case 'v': /* verbose */
o_verbose++; break;
case 'w': /* wait time */
@@ -1794,7 +1798,7 @@
helpme()
{
o_verbose = 1;
- holler ("[v1.10]\n\
+ holler ("netcat " VERSION "\n\
connect to somewhere: nc [-options] hostname port[s] [ports] ... \n\
listen for inbound: nc -l -p port [-options] [hostname] [port]\n\
options:");
@@ -1811,7 +1815,7 @@
-b allow broadcasts\n\
-g gateway source-routing hop point[s], up to 8\n\
-G num source-routing pointer: 4, 8, 12, ...\n\
- -h this cruft\n\
+ -h display this cruft and exit successfully\n\
-i secs delay interval for lines sent, ports scanned\n\
-k set keepalive option on socket\n\
-l listen mode, for inbound connects\n\
@@ -1827,6 +1831,7 @@
#endif
holler ("\
-u UDP mode\n\
+ -V display version and exit successfully\n\
-v verbose [use twice to be more verbose]\n\
-w secs timeout for connects and final net reads");
#ifdef IP_TOS
@@ -1835,9 +1840,20 @@
#endif
holler("\
-z zero-I/O mode [used for scanning]");
- bail ("port numbers can be individual or ranges: lo-hi [inclusive];\n\
+ holler ("port numbers can be individual or ranges: lo-hi [inclusive];\n\
hyphens in port names must be backslash escaped (e.g. 'ftp\\-data').");
+ quit();
} /* helpme */
#endif /* HAVE_HELP */
+
+/* version :
+ the obvious */
+version()
+{
+ printf ("netcat " VERSION "\n");
+ quit();
+}
+
+
/* None genuine without this seal! _H*/