OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_error.c versions 1.4 and 1.5
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_error.c 1.4 -> 1.5

--- rc_error.c   2003/06/30 15:27:38     1.4
+++ rc_error.c   2003/07/02 12:40:15     1.5
@@ -40,39 +40,75 @@
     if (FAILED((rc_return_t)Localerr.ex_value)) { /* Error condition */
         if ((rc_return_t)Localerr.ex_value == RC_ERR_TRM)
             exit(0);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_USE)
-            fprintf(stderr, "    Error condition, API usage is wrong in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_MEM)
-            fprintf(stderr, "    Error condition, memory allocation failure in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_SYS)
-            fprintf(stderr, "    Error condition, underlying system failure in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_IO)
-            fprintf(stderr, "    Error condition, input output failure in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_INT)
-            fprintf(stderr, "    Error condition, internal failure in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_FNC)
-            fprintf(stderr, "    Error condition, function file could not be opened in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_DIR)
-            fprintf(stderr, "    Error condition, location dir could not be opened in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_RCF)
-            fprintf(stderr, "    Error condition, rc file could not be opened in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_CFG)
-            fprintf(stderr, "    Error condition, configuration and options failure in %s:%s():%d.\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else if ((rc_return_t)Localerr.ex_value == RC_ERR_ROOT)
-            fprintf(stderr, "    Error condition, in %s:%s():%d. You must be root to run these commands\n", \
-                Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        else
-            fprintf(stderr, "    Error condition of class '%s',\n    exception %d in %s:%s():%d.\n", (char *)Localerr.ex_class, (int)Localerr.ex_value, Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
-        exit((int)Localerr.ex_value); /* Return failure */
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_USE) {
+            fprintf(stderr, "    API usage is wrong\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_MEM) {
+            fprintf(stderr, "    Memory allocation failure\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_SYS) {
+            fprintf(stderr, "    Underlying system failure\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_IO) {
+            fprintf(stderr, "    Input output failure\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_INT) {
+            fprintf(stderr, "    Internal failure\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_FNC) {
+            fprintf(stderr, "    Function file could not be opened\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_DIR) {
+            fprintf(stderr, "    Location dir could not be opened\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_RCF) {
+            fprintf(stderr, "    Rc file could not be opened\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_CFG) {
+            fprintf(stderr, "    Configuration and options failure\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else if ((rc_return_t)Localerr.ex_value == RC_ERR_ROOT) {
+            fprintf(stderr, "    You must be root to run these commands\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+        else {
+            fprintf(stderr, "    \n    Generic failure condition of class '%s',\n.");
+            if (configGetvar(RC_DBG_VAL))
+                fprintf(stderr, "    Error condition in %s:%s():%d.\n", \
+                    Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
+        }
+
+        /* Return a corresponding failure code in every case */
+        exit((int)Localerr.ex_value);
     }
 #ifdef DEBUG
     else        /* Warning condition */

CVSTrac 2.0.1