Something went wrong. Try again.
forked from cz-nic/bird
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758/* * BIRD Client -- Utility Functions * * (c) 1999--2000 Martin Mares <mj@ucw.cz> * * Can be freely distributed and used under the terms of the GNU GPL. */
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>
#include "nest/bird.h"#include "lib/string.h"#include "client/client.h"
/* Client versions of logging functions */
static voidvlog_cli(const char *msg, va_list args){ char buf[1024];
int n = vsnprintf(buf, sizeof(buf), msg, args); if (n < 0) snprintf(buf, sizeof(buf), "???"); else if (n >= (int) sizeof(buf)) snprintf(buf + sizeof(buf) - 100, 100, " ... <too long>"); fputs(buf, stderr); fputc('\n', stderr);}
voidbug(const char *msg, ...){ va_list args;
va_start(args, msg); cleanup(); fputs("Internal error: ", stderr); vlog_cli(msg, args); vfprintf(stderr, msg, args); va_end(args); exit(1);}
voiddie(const char *msg, ...){ va_list args;
va_start(args, msg); cleanup(); vlog_cli(msg, args); va_end(args); exit(1);}