]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
more lib stuff inside clients
authorMaria Matejka <mq@ucw.cz>
Tue, 12 Dec 2023 13:33:54 +0000 (14:33 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 12 Dec 2023 13:34:10 +0000 (14:34 +0100)
client/Makefile
client/log.c [new file with mode: 0644]
lib/Makefile
sysdep/unix/Makefile

index 4f972815eb89971434086ef83c6b037e34c7fe7d..434bb86bdee7b3704c33b3e4251089fbabeae7e8 100644 (file)
@@ -1,4 +1,4 @@
-src := commands.c util.c client.c
+src := commands.c util.c client.c log.c
 obj := $(src-o-files)
 
 $(all-client)
diff --git a/client/log.c b/client/log.c
new file mode 100644 (file)
index 0000000..acb8719
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *     BIRD Client Logging Stubs
+ *
+ *     (c) 2023       Maria Matejka <mq@jmq.cz>
+ *
+ *     Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include "nest/bird.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int shutting_down;
+
+void write_msg(va_list args, const char *msg, const char *type)
+{
+  char buf[4096];
+  bvsnprintf(buf, sizeof buf, msg, args);
+  fputs(type, stderr);
+  fputs(": ", stderr);
+  fputs(buf, stderr);
+  fputc('\n', stderr);
+}
+
+void cf_error(const char *msg, ...)
+{
+  va_list args;
+  va_start(args, msg);
+  write_msg(args, msg, "error");
+  va_end(args);
+  exit(1);
+}
+
+void log_msg(const char *msg, ...)
+{
+  va_list args;
+  va_start(args, msg);
+  write_msg(args, msg, "info");
+  va_end(args);
+  exit(1);
+}
+
+void debug(const char *msg, ...)
+{
+  va_list args;
+  va_start(args, msg);
+  write_msg(args, msg, "debug");
+  va_end(args);
+  exit(1);
+}
+
+/* Ignore all events for now */
+struct event;
+void ev_schedule(struct event *e UNUSED) 
+{ }
index 812f721cc844f4c8fcd325b9c66089122010b566..b7883ef95c470e690ae21a9ec90088853352bd9a 100644 (file)
@@ -1,4 +1,8 @@
-src := bitmap.c bitops.c blake2s.c blake2b.c checksum.c event.c flowspec.c idm.c ip.c lists.c mac.c md5.c mempool.c net.c patmatch.c printf.c resource.c sha1.c sha256.c sha512.c slab.c slists.c strtoul.c tbf.c timer.c xmalloc.c
+src := bitmap.c bitops.c blake2s.c blake2b.c checksum.c flowspec.c idm.c ip.c lists.c mac.c md5.c mempool.c net.c patmatch.c printf.c resource.c sha1.c sha256.c sha512.c slab.c slists.c strtoul.c xmalloc.c
+obj := $(src-o-files)
+$(all-client)
+
+src += event.c timer.c tbf.c
 obj := $(src-o-files)
 $(all-daemon)
 
index d0d36b5f7cdbe404c6a64a35220a3345ac504ab3..92344676dee4ddd1683662389968868c1fb6bad4 100644 (file)
@@ -4,5 +4,7 @@ $(all-daemon)
 $(cf-local)
 $(conf-y-targets): $(s)krt.Y
 
+$(client): $(addprefix $(o),alloc.o)
+
 src := $(filter-out main.c, $(src))
 tests_objs := $(tests_objs) $(src-o-files)