xref: /plan9-contrib/sys/src/cmd/auth/lib/error.c (revision 9a747e4fd48b9f4522c70c07e8f882a15030f964)
1 #include <u.h>
2 #include <libc.h>
3 #include "authcmdlib.h"
4 
5 void
6 error(char *fmt, ...)
7 {
8 	char buf[8192], *s;
9 	va_list arg;
10 
11 	s = buf;
12 	s += sprint(s, "%s: ", argv0);
13 	va_start(arg, fmt);
14 	s = vseprint(s, buf + sizeof(buf), fmt, arg);
15 	va_end(arg);
16 	*s++ = '\n';
17 	write(2, buf, s - buf);
18 	exits(buf);
19 }
20