changeset: 2603:dc527b879321
parent: 2601:931a509765b5
user: Kris Maglione <kris_AT_suckless.org>
date: Mon May 17 12:06:02 2010 -0400
files: cmd/wmii/error.c
description:
Add forgotten cmd/wmii/error.c
diff -r 931a509765b5 -r dc527b879321 cmd/wmii/error.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/wmii/error.c Mon May 17 12:06:02 2010 -0400
@@ -0,0 +1,41 @@
+/* Copyright ©2007-2009 Kris Maglione <jg_AT_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++];
+}
+
Received on Mon May 17 2010 - 16:11:30 UTC
This archive was generated by hypermail 2.2.0 : Mon May 17 2010 - 16:12:03 UTC