mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 08:00:50 +00:00
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@216 b9cfdab3-6d41-4d17-bbe4-086880011989
25 lines
472 B
C
25 lines
472 B
C
/* $Id$ */
|
|
#include <Mw/Milsko.h>
|
|
#include "error_internal.h"
|
|
|
|
#define MAX_ERROR_LEN 512
|
|
|
|
// buffer for holding the error. +1 to ensure there's always a null terminator.
|
|
char error[MAX_ERROR_LEN + 1] = {0};
|
|
|
|
const char* MwGetLastError(void) {
|
|
return error;
|
|
}
|
|
|
|
void setLastError(const char* fmt, ...) {
|
|
va_list va;
|
|
char out[MAX_ERROR_LEN];
|
|
memset(out, 0, MAX_ERROR_LEN);
|
|
|
|
va_start(va, fmt);
|
|
vsprintf(out, fmt, va);
|
|
va_end(va);
|
|
|
|
memcpy(error, out, MAX_ERROR_LEN);
|
|
}
|