]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
cf_error() now accepts any format strings instead of just an error
authorMartin Mares <mj@ucw.cz>
Sun, 6 Dec 1998 23:10:28 +0000 (23:10 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 6 Dec 1998 23:10:28 +0000 (23:10 +0000)
message. Also added extra kludge to get rid of collisions of REJECT
symbols.

conf/cf-lex.l
conf/conf.h

index f608a3d35bf209724ca1e490eef69576f0d0694e..9e6b120fb5fa96d8afd8a85843f498374d4b03fb 100644 (file)
@@ -7,12 +7,15 @@
  */
 
 %{
+#undef REJECT     /* Avoid name clashes */
 
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdarg.h>
 
 #include "nest/bird.h"
+#include "lib/string.h"
 #include "conf/conf.h"
 #include "conf/cf-parse.tab.h"
 
@@ -221,9 +224,16 @@ cf_lex_init_tables(void)
 }
 
 void
-cf_error(char *msg)
+cf_error(char *msg, ...)
 {
-  die(PATH_CONFIG ", line %d: %s", cf_lino, msg);
+  /* FIXME */
+
+  char buf[1024];
+  va_list args;
+
+  va_start(args, msg);
+  bvsprintf(buf, msg, args);
+  die(PATH_CONFIG ", line %d: %s", cf_lino, buf);
 }
 
 void
@@ -243,3 +253,4 @@ cfg_strdup(char *c)
   memcpy(z, c, l);
   return z;
 }
+
index 974815a8f1e4e18c83808b0ea60205f92e683fca..1e80628ed2dd3eb13b9e779de85765df52abfa0d 100644 (file)
@@ -40,7 +40,7 @@ struct symbol {
 void cf_lex_init_tables(void);
 int cf_lex(void);
 void cf_lex_init(int flag);
-void cf_error(char *msg) NORET;
+void cf_error(char *msg, ...) NORET;
 void cf_allocate(void);
 struct symbol *cf_default_name(char *prefix);