0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-09-18 19:35:20 +00:00

more lib stuff inside clients

This commit is contained in:
Maria Matejka 2023-12-12 14:33:54 +01:00
parent 4381ca1ec2
commit 401ff80ed6
4 changed files with 65 additions and 2 deletions

View 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)

57
client/log.c Normal file
View File

@ -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)
{ }

View 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)

View 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)