OSSP CVS Repository

ossp - Check-in [1426]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1426
Date: 2001-Dec-14 13:39:08 (local)
2001-Dec-14 12:39:08 (UTC)
User:rse
Branch:
Comment: provide l2_env_verrorinfo() and a new L2_ERR_SYN
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2.h.in      1.24 -> 1.25     2 inserted, 0 deleted
ossp-pkg/l2/l2_env.c      1.4 -> 1.5     11 inserted, 2 deleted

ossp-pkg/l2/l2.h.in 1.24 -> 1.25

--- l2.h.in      2001/11/30 09:44:47     1.24
+++ l2.h.in      2001/12/14 12:39:08     1.25
@@ -114,6 +114,7 @@
     L2_ERR_IO,     /* input/output error */
     L2_ERR_FMT,    /* message formating error */
     L2_ERR_INT,    /* internal error */
+    L2_ERR_SYN,    /* syntax error */
     L2_ERR_CH      /* no (more) channel found */
 } l2_result_t;
 
@@ -207,6 +208,7 @@
 l2_result_t   l2_env_formatter      (l2_env_t *env, char id, l2_formatter_t cb, l2_context_t *ctx);
 l2_result_t   l2_env_handler        (l2_env_t *env, l2_handler_t *h);
 l2_result_t   l2_env_errorinfo      (l2_env_t *env, l2_result_t rv, const char *fmt, ...);
+l2_result_t   l2_env_verrorinfo     (l2_env_t *env, l2_result_t rv, const char *fmt, va_list ap);
 char         *l2_env_strerror       (l2_env_t *env, l2_result_t rv);
 l2_result_t   l2_env_settimer       (l2_env_t *env, int iInterval);
 


ossp-pkg/l2/l2_env.c 1.4 -> 1.5

--- 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;

CVSTrac 2.0.1