--- rc_error.c 2003/07/08 15:09:50 1.10
+++ rc_error.c 2003/07/11 09:18:20 1.11
@@ -30,6 +30,7 @@
#include <stdlib.h> /* Just for calling 'exit(3)' once */
#include "rc.h" /* Public interfaces */
#include "rc_config.h" /* Interface to the configuration */
+#include "rc_const.h" /* Error message string constants */
/************************************************
@@ -44,78 +45,78 @@
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, " API usage is wrong.\n");
+ fprintf(stderr, RC_ERRTXT_USE);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
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");
+ fprintf(stderr, RC_ERRTXT_MEM);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
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");
+ fprintf(stderr, RC_ERRTXT_SYS);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
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");
+ fprintf(stderr, RC_ERRTXT_IO);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
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");
+ fprintf(stderr, RC_ERRTXT_INT);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else if ((rc_return_t)Localerr.ex_value == RC_ERR_FNC) {
- fprintf(stderr, " Function file %s could not be opened.\n", \
+ fprintf(stderr, RC_ERRTXT_FNC, \
configGetval(RC_FNC_VAL));
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else if ((rc_return_t)Localerr.ex_value == RC_ERR_LOC) {
- fprintf(stderr, " Location dir %s could not be opened.\n", \
+ fprintf(stderr, RC_ERRTXT_LOC, \
configGetval(RC_LOC_VAL));
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else if ((rc_return_t)Localerr.ex_value == RC_ERR_TMP) {
- fprintf(stderr, " Temporary dir %s could not be opened.\n", \
+ fprintf(stderr, RC_ERRTXT_TMP, \
configGetval(RC_TMP_VAL));
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else if ((rc_return_t)Localerr.ex_value == RC_ERR_RCF) {
- fprintf(stderr, " One or more rc files could not be opened.\n");
+ fprintf(stderr, RC_ERRTXT_RCF);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else if ((rc_return_t)Localerr.ex_value == RC_ERR_CFG) {
- fprintf(stderr, " Configuration failure.\n");
+ fprintf(stderr, RC_ERRTXT_CFG);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
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");
+ fprintf(stderr, RC_ERRTXT_ROOT);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
else {
- fprintf(stderr, " Generic failure condition of class '%s',.\n", (char *)Localerr.ex_class);
+ fprintf(stderr, RC_ERRTXT_GEN, (char *)Localerr.ex_class);
if (configGetval(RC_DBG_VAL))
- fprintf(stderr, " Error condition in %s:%s():%d.\n", \
+ fprintf(stderr, RC_ERRTXT_ALL, \
Localerr.ex_file, Localerr.ex_func, Localerr.ex_line);
}
|