--- l2_env.c 2001/11/16 19:45:12 1.4
+++ l2_env.c 2001/12/14 12:39:08 1.5
@@ -152,15 +152,23 @@
{
va_list ap;
+ /* remember error information */
+ va_start(ap, fmt);
+ l2_env_verrorinfo(env, rv, fmt, ap);
+ va_end(ap);
+
+ return L2_OK;
+}
+
+l2_result_t l2_env_verrorinfo(l2_env_t *env, l2_result_t rv, const char *fmt, va_list ap)
+{
/* argument sanity check */
if (env == NULL || rv == L2_OK || fmt == NULL)
return L2_ERR_ARG;
/* remember error information */
- va_start(ap, fmt);
l2_util_vsprintf(env->szErrorInfo, sizeof(env->szErrorInfo), fmt, ap);
env->rvErrorInfo = rv;
- va_end(ap);
return L2_OK;
}
@@ -190,6 +198,7 @@
else if (rv == L2_ERR_IO) sz = "input/output error";
else if (rv == L2_ERR_FMT) sz = "formatting error";
else if (rv == L2_ERR_INT) sz = "internal error";
+ else if (rv == L2_ERR_SYN) sz = "syntax error";
else sz = "unknown error";
n = l2_util_sprintf(cpBuf, nBuf, "%s", sz);
cpBuf += n;
|