File net-tools-1.60-notrim.diff of Package net-tools

--- net-tools-1.60/netstat.c	2009-08-12 10:24:54.000000000 +0200
+++ net-tools-1.60/netstat.c	2009-08-12 10:33:00.000000000 +0200
@@ -179,6 +179,7 @@
 int flag_arg = 0;
 int flag_ver = 0;
 int flag_cacheof = 0;
+int flag_trim = 0;
 
 #define OPT_SCTP	0x100
 
@@ -887,10 +888,10 @@
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(local_port), "tcp",
 			   flag_not & FLAG_NUM_PORT));
-
-	if ((strlen(local_addr) + strlen(buffer)) > 22)
-	    local_addr[22 - strlen(buffer)] = '\0';
-
+	if (!flag_trim) {
+		if ((strlen(local_addr) + strlen(buffer)) > 22)
+		    local_addr[22 - strlen(buffer)] = '\0';
+	}
 	strcat(local_addr, ":");
 	strcat(local_addr, buffer);
 	snprintf(buffer, sizeof(buffer), "%s",
@@ -1038,8 +1039,10 @@
 	snprintf(buffer, sizeof(buffer), "%s",
 		 get_sname(htons(local_port), "udp",
 			   flag_not & FLAG_NUM_PORT));
-	if ((strlen(local_addr) + strlen(buffer)) > 22)
-	    local_addr[22 - strlen(buffer)] = '\0';
+	if (!flag_trim) {
+		if ((strlen(local_addr) + strlen(buffer)) > 22)
+		    local_addr[22 - strlen(buffer)] = '\0';
+	}
 	strcat(local_addr, ":");
 	strcat(local_addr, buffer);
 
@@ -1510,8 +1513,10 @@
 			   flag_not & FLAG_NUM_PORT));
         safe_strncpy(local_addr, ap->sprint((struct sockaddr *) &localaddr, 
 					    flag_not & FLAG_NUM_HOST), sizeof(local_addr));
-	if ((strlen(local_addr) + strlen(buffer)) > 22)
-	    local_addr[22 - strlen(buffer)] = '\0';
+	if (!flag_trim) {
+		if ((strlen(local_addr) + strlen(buffer)) > 22)
+		    local_addr[22 - strlen(buffer)] = '\0';
+	}
 	strcat(local_addr, ":");
 	strcat(local_addr, buffer);
 
@@ -1981,6 +1986,7 @@
     fprintf(stderr, _("        -o, --timers             display timers\n"));
     fprintf(stderr, _("        -F, --fib                display Forwarding Information Base (default)\n"));
     fprintf(stderr, _("        -C, --cache              display routing cache instead of FIB\n\n"));
+    fprintf(stderr, _("        -T, --notrim             dont't trim address information\n"));
 
     fprintf(stderr, _("  <Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom --sctp\n"));
     fprintf(stderr, _("  <AF>=Use '-A <af>' or '--<af>'; default: %s\n"), DFLT_AF);
@@ -2026,6 +2032,7 @@
 	{"cache", 0, 0, 'C'},
 	{"fib", 0, 0, 'F'},
 	{"groups", 0, 0, 'g'},
+	{"notrim", 0, 0, 'T'},
 	{NULL, 0, 0, 0}
     };
 
@@ -2037,7 +2044,7 @@
     getroute_init();		/* Set up AF routing support */
 
     afname[0] = '\0';
-    while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxl", longopts, &lop)) != EOF)
+    while ((i = getopt_long(argc, argv, "MCFA:acdegphinNorstuVv?wxlT", longopts, &lop)) != EOF)
 	switch (i) {
 	case -1:
 	    break;
@@ -2137,6 +2144,10 @@
 	    usage();
 	case 's':
 	    flag_sta++;
+	    break;
+	case 'T':
+	    flag_trim++;
+	    break;
 	}
 
     if (flag_int + flag_rou + flag_mas + flag_sta > 1)
--- net-tools-1.60/man/en_US/netstat.8	2009-08-12 10:20:38.000000000 +0200
+++ net-tools-1.60/man/en_US/netstat.8	2009-08-12 10:23:27.000000000 +0200
@@ -164,6 +164,8 @@
 Show both listening and non-listening sockets.  With the
 .B --interfaces
 option, show interfaces that are not marked 
+.SS "\-T, \-\-notrim"
+Don't trim the network address information
 .SS "\-F"
 Print routing information from the FIB.  (This is the default.)
 .SS "\-C"
openSUSE Build Service is sponsored by