3 #include <grass/dbmi.h>
7 static int err_flag = 0;
8 static int err_code = DB_OK;
9 static char *err_msg = 0;
10 static int auto_print_errors = 1;
11 static int auto_print_protocol_errors = 1;
12 static void (*user_print_function) (
const char *);
14 static char *who =
NULL;
24 user_print_function = f;
48 return who ? who :
"";
60 s =
"<NULL error message>";
65 if (auto_print_errors)
80 flag = auto_print_errors;
81 auto_print_errors = auto_print_protocol_errors;
83 auto_print_errors =
flag;
84 err_code = DB_PROTOCOL_ERR;
121 return err_flag ? err_code : DB_OK;
133 err_code = DB_MEMORY_ERR;
146 sprintf(msg,
"dbmi: %s() not implemented", name);
148 err_code = DB_NOPROC;
163 err_code = DB_NOPROC;
196 if (user_print_function) {
199 sprintf(buf,
"%s%s\n", lead, err_msg);
200 user_print_function(buf);
203 fprintf(stderr,
"%s%s\n", lead, err_msg);
207 static int debug_on = 0;
240 fprintf(stderr,
"debug(%s): %s\n", who ? who :
"", s ? s :
"<NULL>");
251 return err_flag ? err_msg : (
const char *)
NULL;
262 auto_print_errors =
flag;
263 auto_print_protocol_errors =
flag;
274 auto_print_protocol_errors =
flag;
const char * db_get_error_msg(void)
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void db_auto_print_protocol_errors(int flag)
void db_auto_print_errors(int flag)
void db_protocol_error(void)
void db_error(const char *s)
void db_memory_error(void)
void db_noproc_error(procnum)
void db_on_error(void(*f)(const char *))
void db_print_error(void)
void db_syserror(const char *s)
int db_get_error_code(void)
void db_procedure_not_implemented(const char *name)
void db_set_error_who(const char *me)
void db_clear_error(void)
void db_debug(const char *s)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
char * db_store(const char *s)
const char * db_get_error_who(void)