plan9fox/sys/src/ape/lib/fmt/werrstr.c
cinap_lenrek 14685d6595 ape: return plan9 error strings from strerror()
when _syserrno() fails to map a plan9 error string to
a unix error number, we copy the plan9 error string
to the per process error buffer "plan9err" and set
errno = EPLAN9.

when strerror() is called with EPLAN9, it returns
a pointer to the plan9err buffer.
2016-05-04 00:23:48 +02:00

17 lines
224 B
C

#include <stdarg.h>
#include <errno.h>
#include "fmt.h"
extern char *_plan9err;
void
werrstr(const char *fmt, ...)
{
va_list arg;
va_start(arg, fmt);
snprint(_plan9err, 128, fmt, arg);
va_end(arg);
errno = EPLAN9;
}