cvsdist eb32cc8
--- net-tools-1.60/statistics.c.parse	2004-09-06 10:45:35.595130240 +0200
cvsdist eb32cc8
+++ net-tools-1.60/statistics.c	2004-09-06 10:43:11.000000000 +0200
cvsdist eb32cc8
@@ -289,7 +289,7 @@
cvsdist eb32cc8
 	return &dummytab;
cvsdist eb32cc8
 }
cvsdist eb32cc8
 
cvsdist eb32cc8
-void process_fd(FILE *f)
cvsdist eb32cc8
+void process_fd(FILE *f,int file_desc)   // added file_desc to show propriate error mesg
cvsdist eb32cc8
 {
cvsdist eb32cc8
     char buf1[1024], buf2[1024];
cvsdist eb32cc8
     char *sp, *np, *p;
cvsdist eb32cc8
@@ -297,12 +297,16 @@
cvsdist eb32cc8
 	int endflag;
cvsdist eb32cc8
 	struct tabtab *tab;
cvsdist eb32cc8
 
cvsdist eb32cc8
+	if (strcmp(buf1,"\n") == 0)  // cut leading break
cvsdist eb32cc8
+	    if (!fgets(buf1, sizeof buf1, f))
cvsdist eb32cc8
+	    break;
cvsdist eb32cc8
 	if (!fgets(buf2, sizeof buf2, f))
cvsdist eb32cc8
 	    break;
cvsdist eb32cc8
+
cvsdist eb32cc8
 	sp = strchr(buf1, ':');
cvsdist eb32cc8
-	np = strchr(buf2, ':');
cvsdist eb32cc8
-	if (!np || !sp)
cvsdist eb32cc8
-	    goto formaterr;
cvsdist eb32cc8
+	np = strchr(buf2, ':'); 
cvsdist eb32cc8
+	if (!np || !sp) 
cvsdist eb32cc8
+	    goto formaterr; 
cvsdist eb32cc8
 	*sp = '\0';
cvsdist eb32cc8
 
cvsdist eb32cc8
 	tab = newtable(snmptabs, buf1);
cvsdist eb32cc8
@@ -333,7 +337,12 @@
cvsdist eb32cc8
   return;
cvsdist eb32cc8
   
cvsdist eb32cc8
 formaterr:
cvsdist eb32cc8
-  perror(_("error parsing /proc/net/snmp"));
cvsdist eb32cc8
+ switch(file_desc) {
cvsdist eb32cc8
+    case 0: perror(_("error parsing /proc/net/snmp"));
cvsdist eb32cc8
+	break;
cvsdist eb32cc8
+    case 1: perror(_("error parsing /proc/net/netstat"));
cvsdist eb32cc8
+	break;
cvsdist eb32cc8
+  }
cvsdist eb32cc8
   return;
cvsdist eb32cc8
 }
cvsdist eb32cc8
 
cvsdist eb32cc8
@@ -343,13 +352,13 @@
cvsdist eb32cc8
     FILE *f;
cvsdist eb32cc8
 
cvsdist eb32cc8
     f_raw = flag_raw; f_tcp = flag_tcp; f_udp = flag_udp;
cvsdist eb32cc8
-    
cvsdist eb32cc8
+
cvsdist eb32cc8
     f = fopen("/proc/net/snmp", "r");
cvsdist eb32cc8
     if (!f) {
cvsdist eb32cc8
 	perror(_("cannot open /proc/net/snmp"));
cvsdist eb32cc8
 	return(1);
cvsdist eb32cc8
     }
cvsdist eb32cc8
-    process_fd(f);
cvsdist eb32cc8
+    process_fd(f,0);
cvsdist eb32cc8
 
cvsdist eb32cc8
     if (ferror(f)) {
cvsdist eb32cc8
 	perror("/proc/net/snmp");
cvsdist eb32cc8
@@ -361,7 +370,7 @@
cvsdist eb32cc8
     f = fopen("/proc/net/netstat", "r");
cvsdist eb32cc8
 
cvsdist eb32cc8
     if (f) {
cvsdist eb32cc8
-    	process_fd(f);
cvsdist eb32cc8
+    	process_fd(f,1);
cvsdist eb32cc8
 
cvsdist eb32cc8
         if (ferror(f)) {
cvsdist eb32cc8
 	  perror("/proc/net/netstat");