mirror of
https://github.com/0intro/wmii
synced 2024-11-21 21:31:33 +03:00
Add forgotten cmd/wmii/error.c
This commit is contained in:
parent
e42c5a1be6
commit
d953213bf7
41
cmd/wmii/error.c
Normal file
41
cmd/wmii/error.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* Copyright ©2007-2009 Kris Maglione <jg@suckless.org>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
|
||||
static jmp_buf errjmp[16];
|
||||
static long nerror;
|
||||
|
||||
void
|
||||
error(char *fmt, ...) {
|
||||
char errbuf[IXP_ERRMAX];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprint(errbuf, IXP_ERRMAX, fmt, ap);
|
||||
va_end(ap);
|
||||
ixp_errstr(errbuf, IXP_ERRMAX);
|
||||
|
||||
nexterror();
|
||||
}
|
||||
|
||||
void
|
||||
nexterror(void) {
|
||||
assert(nerror > 0);
|
||||
longjmp(errjmp[--nerror], 1);
|
||||
}
|
||||
|
||||
void
|
||||
poperror(void) {
|
||||
assert(nerror > 0);
|
||||
--nerror;
|
||||
}
|
||||
|
||||
jmp_buf*
|
||||
pusherror(void) {
|
||||
assert(nerror < nelem(errjmp));
|
||||
return &errjmp[nerror++];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user