klog error

Love lha at stacken.kth.se
Mon Sep 25 19:54:29 CEST 2000


Love <lha at stacken.kth.se> writes:

> I think the parser is a little bit picky and thinks that your lines should
> start with directly with the ip-address.
> 
> Can you try the patch below and see it that helps you ?
 
Ugh, next time I'll give you a working patch (and test it before I send it
out). This one should work, and I've just checking it to the
cvs-repository.

Love

Index: kocell.c
===================================================================
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/lib/ko/kocell.c,v
retrieving revision 1.39
diff -u -w -u -w -r1.39 kocell.c
--- lib/ko/kocell.c	2000/09/04 03:51:04	1.39
+++ lib/ko/kocell.c	2000/09/25 17:46:30
@@ -55,7 +55,7 @@
 
 #include "resolve.h"
 
-RCSID("$Id$");
+RCSID("$Id: kocell.c,v 1.39 2000/09/04 03:51:04 lha Exp $");
 
 #define TRANSARCSYSCONFDIR "/usr/vice/etc"
 #define CELLFILENAME "CellServDB"
@@ -345,6 +345,10 @@
      if (*dbnum >= maxdbs) {
 	  return -1;
      }
+     
+     while (*line && isspace(*line))
+	    ++line;
+
      if (inet_aton (line, &numaddr) == 0) {
 	  return -1;
      }
@@ -388,6 +392,7 @@
      int lineno = 0;
      int dbnum;
      cell_db_entry dbservs[256];
+     int i;
 
      f = fopen (filename, "r");
      if (f == NULL) {
@@ -396,16 +401,19 @@
 
      while (fgets (line, sizeof (line), f)) {
 	  ++lineno;
+	  i = 0;
 	  line[strlen(line) - 1] = '\0';
-	  if (*line == '#' || *line == '\0')
+	  while (line[0] && isspace(line[i]))
+		 i++;
+	  if (line[i] == '#' || line[i] == '\0')
 	       continue;
-	  if (*line == '>') {
+	  if (line[i] == '>') {
 	       if (c != NULL)
 		    recordcell (c, dbnum, dbservs);
-	       c = newcell (line + 1);
+	       c = newcell (&line[i] + 1);
 	       dbnum = 0;
 	  } else {
-	       if (readdb(line, c, &dbnum, sizeof (dbservs) /
+	      if (readdb(&line[i], c, &dbnum, sizeof (dbservs) /
 			  sizeof(*dbservs),
 			  dbservs, lineno))
 		    continue;






More information about the Arla-drinkers mailing list