summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/slibtool/slibtool.h13
-rw-r--r--src/internal/slibtool_errinfo_impl.c25
-rw-r--r--src/internal/slibtool_errinfo_impl.h16
-rw-r--r--src/output/slbt_output_error.c24
4 files changed, 40 insertions, 38 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 4aa2552..812efd3 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -160,12 +160,13 @@ struct slbt_version_info {
};
struct slbt_error_info {
- int syserror;
- int liberror;
- const char * function;
- int line;
- unsigned flags;
- void * ctx;
+ const struct slbt_driver_ctx * edctx;
+ int esyscode;
+ int elibcode;
+ const char * efunction;
+ int eline;
+ unsigned eflags;
+ void * eany;
};
struct slbt_host_params {
diff --git a/src/internal/slibtool_errinfo_impl.c b/src/internal/slibtool_errinfo_impl.c
index 889f566..c12241d 100644
--- a/src/internal/slibtool_errinfo_impl.c
+++ b/src/internal/slibtool_errinfo_impl.c
@@ -10,12 +10,12 @@
int slbt_record_error(
const struct slbt_driver_ctx * dctx,
- int syserror,
- int liberror,
- const char * function,
- int line,
- unsigned flags,
- void * ctx)
+ int esyscode,
+ int elibcode,
+ const char * efunction,
+ int eline,
+ unsigned eflags,
+ void * eany)
{
struct slbt_driver_ctx_impl * ictx;
struct slbt_error_info * erri;
@@ -28,12 +28,13 @@ int slbt_record_error(
*ictx->errinfp = &ictx->erribuf[ictx->errinfp - ictx->erriptr];
erri = *ictx->errinfp;
- erri->syserror = syserror;
- erri->liberror = liberror;
- erri->function = function;
- erri->line = line;
- erri->flags = flags;
- erri->ctx = ctx;
+ erri->edctx = dctx;
+ erri->esyscode = esyscode;
+ erri->elibcode = elibcode;
+ erri->efunction = efunction;
+ erri->eline = eline;
+ erri->eflags = eflags;
+ erri->eany = eany;
ictx->errinfp++;
diff --git a/src/internal/slibtool_errinfo_impl.h b/src/internal/slibtool_errinfo_impl.h
index c830975..23c8263 100644
--- a/src/internal/slibtool_errinfo_impl.h
+++ b/src/internal/slibtool_errinfo_impl.h
@@ -9,12 +9,12 @@
int slbt_record_error(
const struct slbt_driver_ctx *,
- int syserror,
- int liberror,
- const char * function,
- int line,
- unsigned flags,
- void * ctx);
+ int esyscode,
+ int elibcode,
+ const char * efunction,
+ int eline,
+ unsigned eflags,
+ void * eany);
#define SLBT_SYSTEM_ERROR(dctx) \
slbt_record_error( \
@@ -58,11 +58,11 @@ int slbt_record_error(
SLBT_ERROR_TOP_LEVEL, \
0)
-#define SLBT_CUSTOM_ERROR(dctx,liberror) \
+#define SLBT_CUSTOM_ERROR(dctx,elibcode) \
slbt_record_error( \
dctx, \
0, \
- liberror, \
+ elibcode, \
__func__, \
__LINE__, \
SLBT_ERROR_TOP_LEVEL \
diff --git a/src/output/slbt_output_error.c b/src/output/slbt_output_error.c
index cfea7dc..0b8e21d 100644
--- a/src/output/slbt_output_error.c
+++ b/src/output/slbt_output_error.c
@@ -19,13 +19,13 @@ static const char aclr_magenta[] = "\x1b[35m";
static const char * slbt_output_error_header(const struct slbt_error_info * erri)
{
- if (erri->flags & SLBT_ERROR_CHILD)
+ if (erri->eflags & SLBT_ERROR_CHILD)
return "exec error upon";
- else if (erri->flags & SLBT_ERROR_TOP_LEVEL)
+ else if (erri->eflags & SLBT_ERROR_TOP_LEVEL)
return "error logged in";
- else if (erri->flags & SLBT_ERROR_NESTED)
+ else if (erri->eflags & SLBT_ERROR_NESTED)
return "< returned to >";
else
@@ -34,20 +34,20 @@ static const char * slbt_output_error_header(const struct slbt_error_info * erri
static const char * slbt_output_strerror(const struct slbt_error_info * erri)
{
- if (erri->flags & SLBT_ERROR_CUSTOM)
+ if (erri->eflags & SLBT_ERROR_CUSTOM)
return "flow error: unexpected condition or other";
- else if (erri->flags & SLBT_ERROR_NESTED)
+ else if (erri->eflags & SLBT_ERROR_NESTED)
return "";
- else if (erri->flags & SLBT_ERROR_CHILD)
+ else if (erri->eflags & SLBT_ERROR_CHILD)
return "(see child process error messages)";
- else if (erri->syserror == ENOBUFS)
+ else if (erri->esyscode == ENOBUFS)
return "input error: string length exceeds buffer size.";
else
- return strerror(erri->syserror);
+ return strerror(erri->esyscode);
}
static int slbt_output_error_record_plain(
@@ -59,8 +59,8 @@ static int slbt_output_error_record_plain(
if (fprintf(stderr,"%s: %s %s(), line %d%s%s.\n",
dctx->program,
slbt_output_error_header(erri),
- erri->function,
- erri->line,
+ erri->efunction,
+ erri->eline,
strlen(errdesc) ? ": " : "",
errdesc) < 0)
return -1;
@@ -87,11 +87,11 @@ static int slbt_output_error_record_annotated(
aclr_reset,
aclr_bold,aclr_blue,
- erri->function,
+ erri->efunction,
aclr_reset,
aclr_bold,aclr_green,
- erri->line,
+ erri->eline,
aclr_reset,
strlen(errdesc) ? ": " : "",