summaryrefslogtreecommitdiff
path: root/emu/port/errstr.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
commit37da2899f40661e3e9631e497da8dc59b971cbd0 (patch)
treecbc6d4680e347d906f5fa7fca73214418741df72 /emu/port/errstr.c
parent54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff)
20060303a
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 */
+}