From e69e4ed9349ee28262fe74f70e7e52c181d5d098 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 27 Feb 2000 22:00:19 +0000 Subject: Support expansion of command abbreviations. Client considered finished (modulo bugs). --- client/util.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'client/util.c') diff --git a/client/util.c b/client/util.c index 7699faf..9f1a16b 100644 --- a/client/util.c +++ b/client/util.c @@ -12,11 +12,21 @@ #include #include "nest/bird.h" +#include "lib/string.h" #include "client/client.h" /* Client versions of logging functions */ -/* FIXME: Use bsprintf, so that %m works */ +static void +vlog(char *msg, va_list args) +{ + char buf[1024]; + + if (bvsnprintf(buf, sizeof(buf)-1, msg, args) < 0) + bsprintf(buf + sizeof(buf) - 100, " ... "); + fputs(buf, stderr); + fputc('\n', stderr); +} void bug(char *msg, ...) @@ -26,8 +36,8 @@ bug(char *msg, ...) va_start(args, msg); cleanup(); fputs("Internal error: ", stderr); + vlog(msg, args); vfprintf(stderr, msg, args); - fputc('\n', stderr); exit(1); } @@ -38,7 +48,6 @@ die(char *msg, ...) va_start(args, msg); cleanup(); - vfprintf(stderr, msg, args); - fputc('\n', stderr); + vlog(msg, args); exit(1); } -- cgit v1.2.3