Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] Re: (PR#12756) Improving error message in inputfile
Home

[Freeciv-Dev] Re: (PR#12756) Improving error message in inputfile

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12756) Improving error message in inputfile
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 10 Apr 2005 02:45:32 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12756 >

On Sun, 10 Apr 2005, Per I. Mathisen wrote:
> Now it is possible to make a mistake in a ruleset without tearing your
> hair out.

Not that I don't anyway when I discover that my patch was wrong. New patch
attached.

  - Per

Index: utility/inputfile.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/inputfile.c,v
retrieving revision 1.35
diff -u -r1.35 inputfile.c
--- utility/inputfile.c 4 Apr 2003 15:47:49 -0000       1.35
+++ utility/inputfile.c 10 Apr 2005 09:44:27 -0000
@@ -607,16 +607,10 @@
     if (INF_DEBUG_FOUND) {
       freelog(LOG_DEBUG, "inputfile: found %s '%s'", name, inf->token.str);
     }
-  } else {
-    if (!required) {
-      if (INF_DEBUG_NOT_FOUND) {
-       freelog(LOG_DEBUG, "inputfile: did not find %s", name);
-      }
-    } else {
-      /* should be varargs... */
-      freelog(LOG_ERROR, "Did not find required token: %s", name);
-      return NULL;
-    }
+  } else if (required) {
+    freelog(LOG_FATAL, "Did not find token %s in %s line %d", 
+            name, inf->filename, inf->line_num);
+    exit(EXIT_FAILURE);
   }
   return c;
 }

[Prev in Thread] Current Thread [Next in Thread]