Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 04bc6ad5 authored by rswindell's avatar rswindell

errormsg() uses a string constant for the 'action' parameter, instead of the

enum constants (only used to map to strings) - this gives more flexibility in
error reporting (e.g. "ERROR - compiling JS script").
parent a6860b83
......@@ -624,7 +624,7 @@ long sbbs_t::js_execfile(const char *cmd)
if(js_scope==NULL || js_script==NULL) {
JS_ReportPendingException(js_cx); /* Added Feb-2-2006, rswindell */
errormsg(WHERE,ERR_EXEC,path,0);
errormsg(WHERE,"compiling",path,0);
return(-1);
}
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -217,13 +217,12 @@ void sbbs_t::logch(char ch, bool comma)
/* information, function, action, object and access and then attempts to */
/* write the error information into the file ERROR.LOG and NODE.LOG */
/****************************************************************************/
void sbbs_t::errormsg(int line, const char *source, char action, const char *object
void sbbs_t::errormsg(int line, const char *source, const char* action, const char *object
,ulong access, const char *extinfo)
{
const char* src;
char str[2048];
char tmp[512];
char* actstr;
/* prevent recursion */
if(errormsg_inside)
......@@ -232,7 +231,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
/* Don't log path to source code */
src=getfname(source);
#if 0
switch(action) {
case ERR_OPEN:
actstr="opening";
......@@ -286,6 +285,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
actstr="UNKNOWN";
break;
}
#endif
sprintf(str,"Node %d !ERROR %d "
#ifdef _WIN32
"(WinError %d) "
......@@ -295,12 +295,12 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
#ifdef _WIN32
,GetLastError()
#endif
,src, line, actstr, object, access);
,src, line, action, object, access);
if(online==ON_LOCAL)
eprintf(LOG_ERR,"%s",str);
else {
lprintf(LOG_ERR,"%s",str);
bprintf("\7\r\nERROR - action: %s",actstr); /* tell user about error */
bprintf("\7\r\nERROR - action: %s",action); /* tell user about error */
bprintf("\7\r\n object: %s",object);
bprintf("\7\r\n access: %ld",access);
if(access>9 && (long)access!=-1 && (short)access!=-1 && (char)access!=-1)
......@@ -316,7 +316,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
}
sprintf(str,"\r\n source: %s\r\n line: %d\r\n action: %s\r\n"
" object: %s\r\n access: %ld"
,src,line,actstr,object,access);
,src,line,action,object,access);
if(access>9 && (long)access!=-1 && (short)access!=-1 && (char)access!=-1) {
sprintf(tmp," (0x%lX)",access);
strcat(str,tmp); }
......
......@@ -674,7 +674,7 @@ public:
void errorlog(char *text); /* Logs errors to ERROR.LOG and NODE.LOG */
bool errorlog_inside;
bool errormsg_inside;
void errormsg(int line, const char *file, char action, const char *object
void errormsg(int line, const char *file, const char* action, const char *object
,ulong access, const char *extinfo=NULL);
/* qwk.cpp */
......
......@@ -281,26 +281,23 @@ typedef struct {
/* Bit values for cfg.msg_misc */
#define MM_REALNAME (1<<16) /* Allow receipt of e-mail using real names */
enum { /* errormsg() codes */
ERR_OPEN /* opening a file */
,ERR_CLOSE /* close a file */
,ERR_FDOPEN /* associating a stream with fd */
,ERR_READ /* reading from file */
,ERR_WRITE /* writing to file */
,ERR_REMOVE /* removing a file */
,ERR_ALLOC /* allocating memory */
,ERR_CHK /* checking */
,ERR_LEN /* file length */
,ERR_EXEC /* executing */
,ERR_CHDIR /* changing directory */
,ERR_CREATE /* creating */
,ERR_LOCK /* locking */
,ERR_UNLOCK /* unlocking */
,ERR_TIMEOUT /* timeout waiting for resource */
,ERR_IOCTL /* IOCTL error */
,ERR_SEEK /* SEEKing error */
};
/* errormsg() codes */
#define ERR_OPEN "opening" /* opening a file */
#define ERR_CLOSE "closing" /* close a file */
#define ERR_FDOPEN "fdopen" /* associating a stream with fd */
#define ERR_READ "reading" /* reading from file */
#define ERR_WRITE "writing" /* writing to file */
#define ERR_REMOVE "removing" /* removing a file */
#define ERR_ALLOC "allocating" /* allocating memory */
#define ERR_CHK "checking" /* checking */
#define ERR_LEN "checking length"
#define ERR_EXEC "executing" /* executing */
#define ERR_CREATE "creating" /* creating */
#define ERR_LOCK "locking" /* locking */
#define ERR_UNLOCK "unlocking" /* unlocking */
#define ERR_TIMEOUT "timeout" /* timeout waiting for resource */
#define ERR_IOCTL "sending IOCTL" /* IOCTL error */
#define ERR_SEEK "seeking" /* SEEKing error */
enum { /* Values for dir[x].sort */
SORT_NAME_A /* Sort by filename, ascending */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment