summaryrefslogtreecommitdiff
path: root/emu/port/errstr.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2009-03-25 15:55:14 +0000
committerCharles.Forsyth <devnull@localhost>2009-03-25 15:55:14 +0000
commitdfd1934d5e1ddbeb326f77fc0e52307c801a1a3e (patch)
treef1e8b23278caae95e01d88b00421d6c3642357ef /emu/port/errstr.c
parent78dfdcbd59dc8f36975e7695933e3f753957474c (diff)
x20090325-1554
Diffstat (limited to 'emu/port/errstr.c')
-rw-r--r--emu/port/errstr.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/emu/port/errstr.c b/emu/port/errstr.c
new file mode 100644
index 00000000..dfb41ed4
--- /dev/null
+++ b/emu/port/errstr.c
@@ -0,0 +1,38 @@
+#include "dat.h"
+#include "fns.h"
+
+/*
+ * General OS interface to errors
+ */
+void
+kwerrstr(char *fmt, ...)
+{
+ va_list arg;
+ char buf[ERRMAX];
+
+ va_start(arg, fmt);
+ vseprint(buf, buf+sizeof(buf), fmt, arg);
+ va_end(arg);
+ kstrcpy(up->env->errstr, buf, ERRMAX);
+}
+
+void
+kerrstr(char *err, uint size)
+{
+ char tmp[ERRMAX];
+
+ kstrcpy(tmp, up->env->errstr, sizeof(tmp));
+ kstrcpy(up->env->errstr, err, ERRMAX);
+ kstrcpy(err, tmp, size);
+}
+
+void
+kgerrstr(char *err, uint size)
+{
+ char *s;
+
+ s = "<no-up>";
+ if(up != nil)
+ s = up->env->errstr;
+ kstrcpy(err, s, size); /* TO DO */
+}