2025-10-01 23:40:42 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
#include <Mw/Milsko.h>
|
2025-10-01 21:47:55 +00:00
|
|
|
#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};
|
|
|
|
|
|
2025-10-07 06:05:07 +00:00
|
|
|
const char* MwGetLastError(void) {
|
2025-10-01 21:47:55 +00:00
|
|
|
return error;
|
2025-10-01 23:40:42 +00:00
|
|
|
}
|
2025-10-01 21:47:55 +00:00
|
|
|
|
|
|
|
|
void setLastError(const char* fmt, ...) {
|
|
|
|
|
va_list va;
|
|
|
|
|
char out[MAX_ERROR_LEN];
|
|
|
|
|
memset(out, 0, MAX_ERROR_LEN);
|
|
|
|
|
|
|
|
|
|
va_start(va, fmt);
|
2025-10-08 11:15:48 +00:00
|
|
|
vsprintf(out, fmt, va);
|
2025-10-01 21:47:55 +00:00
|
|
|
va_end(va);
|
|
|
|
|
|
|
|
|
|
memcpy(error, out, MAX_ERROR_LEN);
|
|
|
|
|
}
|