mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 20:58:44 +00:00
more lib stuff inside clients
This commit is contained in:
parent
4381ca1ec2
commit
401ff80ed6
@ -1,4 +1,4 @@
|
|||||||
src := commands.c util.c client.c
|
src := commands.c util.c client.c log.c
|
||||||
obj := $(src-o-files)
|
obj := $(src-o-files)
|
||||||
|
|
||||||
$(all-client)
|
$(all-client)
|
||||||
|
57
client/log.c
Normal file
57
client/log.c
Normal 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)
|
||||||
|
{ }
|
@ -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)
|
obj := $(src-o-files)
|
||||||
$(all-daemon)
|
$(all-daemon)
|
||||||
|
|
||||||
|
@ -4,5 +4,7 @@ $(all-daemon)
|
|||||||
$(cf-local)
|
$(cf-local)
|
||||||
$(conf-y-targets): $(s)krt.Y
|
$(conf-y-targets): $(s)krt.Y
|
||||||
|
|
||||||
|
$(client): $(addprefix $(o),alloc.o)
|
||||||
|
|
||||||
src := $(filter-out main.c, $(src))
|
src := $(filter-out main.c, $(src))
|
||||||
tests_objs := $(tests_objs) $(src-o-files)
|
tests_objs := $(tests_objs) $(src-o-files)
|
||||||
|
Loading…
Reference in New Issue
Block a user