update controller code
This commit is contained in:
parent
2836d196da
commit
41f56fa6ed
54 changed files with 9688 additions and 214 deletions
59
src/controller/wrap.c
Normal file
59
src/controller/wrap.c
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "xce/errnox.h"
|
||||
|
||||
int __wrap___xpg_strerror_r(int errnum,
|
||||
char* buf,
|
||||
size_t bufsize)
|
||||
{
|
||||
return xce_strerror_r(errnum, buf, bufsize);
|
||||
}
|
||||
|
||||
static void xce_perror_(const char* s, int errnum)
|
||||
{
|
||||
char buf[XCE_MAX_ERRMSG_LEN];
|
||||
ectx_t* ectx = get_ectx();
|
||||
|
||||
xce_strerror_r(errnum, buf, sizeof(buf));
|
||||
|
||||
if (tlog_get_root() == NULL) {
|
||||
if ((ectx->file != NULL) && (ectx->func != NULL) && (ectx->line > 0) && (ectx->code == errnum)) {
|
||||
fprintf(stderr, "%s: %s at %s:%d %s\n",
|
||||
s, buf, ectx->file,
|
||||
ectx->line, ectx->func);
|
||||
} else {
|
||||
fprintf(stderr, "%s: %s", s, buf);
|
||||
}
|
||||
} else {
|
||||
if ((ectx->file != NULL) && (ectx->func != NULL) && (ectx->line > 0) && (ectx->code == errnum)) {
|
||||
tlog_error("%s: %s at %s:%d %s\n",
|
||||
s, buf, ectx->file,
|
||||
ectx->line, ectx->func);
|
||||
} else {
|
||||
tlog_error("%s: %s", s, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xce_perror(const char* s)
|
||||
{
|
||||
xce_perror_(s, errno);
|
||||
}
|
||||
|
||||
void __wrap_perror(const char* s)
|
||||
{
|
||||
xce_perror(s);
|
||||
}
|
||||
|
||||
int __wrap_printf(const char* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int rc;
|
||||
|
||||
va_start(ap, fmt);
|
||||
rc = xce_vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return rc;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue