Upgraded version, added debug logfile
This commit is contained in:
parent
a4123fc91e
commit
ea98670b1e
32
ChangeLog
32
ChangeLog
@ -6,7 +6,7 @@ $Id$
|
||||
be used on production systems if you don't want to help debugging.
|
||||
Handshake and EMSI is changed, please run this version with debugging on,
|
||||
mbsetup 1.14.1 turn 5, 11 and 18 on at least. Report any problems and include
|
||||
a piece of the logfile.
|
||||
a piece of the (debug)logfile.
|
||||
|
||||
Before installing, make a copy of /opt/mbse/bin/mbcico so you can go back
|
||||
if you experience any problems.
|
||||
@ -19,7 +19,35 @@ $Id$
|
||||
menus do not work. All other programs do work on all platforms.
|
||||
All other users on Intel machines (99,9% I think) can use this version.
|
||||
|
||||
v0.37.6 10-Aug-2003
|
||||
v0.37.7 09-Sep-2003
|
||||
|
||||
upgrade:
|
||||
A bit tricky to upgrade and start using the new debug logfile:
|
||||
Before make install close the bbs "mbstat close"
|
||||
Then kill mbtask.
|
||||
Then as root a make install.
|
||||
As user mbse: start mbtask, just by typing mbtask.
|
||||
Then type "mbsetup init"
|
||||
Then open the bbs with mbstat open.
|
||||
Start mbsetup normal, enter the global menu, exit and save.
|
||||
After this is done the first time, restarting mbtask can be
|
||||
done as usual by running the mbsed init script.
|
||||
|
||||
general:
|
||||
Debug logging is now in a separate file, the normal logging is
|
||||
now only in the normal logfiles.
|
||||
|
||||
mbtask:
|
||||
Added support for debug logfile. Dropped the debug switch for
|
||||
mbtask logging, this is now allways on.
|
||||
|
||||
mbsetup:
|
||||
Added support for debug logging in menu 1.3 and removed the
|
||||
mbtask debug switch from menu 18.
|
||||
|
||||
|
||||
|
||||
v0.37.6 10-Aug-2003 - 09-Sep-2003
|
||||
|
||||
general:
|
||||
Changed all Linux references into GNU/Linux.
|
||||
|
2
configure
vendored
2
configure
vendored
@ -1268,7 +1268,7 @@ SUBDIRS="lib mbcico mbfido mbmon mbsebbs mbtask mbsetup unix lang examples html
|
||||
PACKAGE="mbsebbs"
|
||||
MAJOR="0"
|
||||
MINOR="37"
|
||||
REVISION="6"
|
||||
REVISION="7"
|
||||
VERSION="$MAJOR.$MINOR.$REVISION"
|
||||
COPYRIGHT="Copyright (C) 1997-2003 Michiel Broek, All Rights Reserved"
|
||||
SHORTRIGHT="Copyright (C) 1997-2003 M. Broek"
|
||||
|
@ -11,7 +11,7 @@ dnl After changeing the version number, run autoconf!
|
||||
PACKAGE="mbsebbs"
|
||||
MAJOR="0"
|
||||
MINOR="37"
|
||||
REVISION="6"
|
||||
REVISION="7"
|
||||
VERSION="$MAJOR.$MINOR.$REVISION"
|
||||
COPYRIGHT="Copyright (C) 1997-2003 Michiel Broek, All Rights Reserved"
|
||||
SHORTRIGHT="Copyright (C) 1997-2003 M. Broek"
|
||||
|
27
lib/clcomm.c
27
lib/clcomm.c
@ -38,6 +38,7 @@ int do_quiet = FALSE; /* Quiet flag */
|
||||
int show_log = FALSE; /* Show loglines on screen */
|
||||
int most_debug = FALSE; /* Toggle normal/most debugging */
|
||||
char progname[21]; /* Program name */
|
||||
char logdebug[PATH_MAX]; /* Debug logfile */
|
||||
char logfile[PATH_MAX]; /* Normal logfile */
|
||||
char errfile[PATH_MAX]; /* Error logfile */
|
||||
char mgrfile[PATH_MAX]; /* Area/File- mgr logfile */
|
||||
@ -100,7 +101,7 @@ char *xstrcat(char *src, char *add)
|
||||
|
||||
|
||||
|
||||
void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr)
|
||||
void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr, char *debug)
|
||||
{
|
||||
if ((getenv("MBSE_ROOT")) == NULL) {
|
||||
printf("Could not get the MBSE_ROOT environment variable\n");
|
||||
@ -113,6 +114,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
|
||||
sprintf(logfile, "%s", log);
|
||||
sprintf(errfile, "%s", err);
|
||||
sprintf(mgrfile, "%s", mgr);
|
||||
sprintf(logdebug, "%s", debug);
|
||||
loggrade = loggr;
|
||||
|
||||
sprintf(cpath, "%s/tmp/%s%d", getenv("MBSE_ROOT"), progname, getpid());
|
||||
@ -220,12 +222,14 @@ void WriteError(const char *format, ...)
|
||||
lcrc = tcrc;
|
||||
if (lcnt) {
|
||||
lcnt++;
|
||||
SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", logdebug, progname, mypid, lcnt);
|
||||
SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", logfile, progname, mypid, lcnt);
|
||||
SockS("ALOG:5,%s,%s,%d,?,Last message repeated %d times;", errfile, progname, mypid, lcnt);
|
||||
}
|
||||
lcnt = 0;
|
||||
}
|
||||
|
||||
SockS("ALOG:5,%s,%s,%d,?,%s;", logdebug, progname, mypid, *outputstr == '$' ? outputstr+1 : outputstr);
|
||||
SockS("ALOG:5,%s,%s,%d,?,%s;", logfile, progname, mypid, *outputstr == '$' ? outputstr+1 : outputstr);
|
||||
SockS("ALOG:5,%s,%s,%d,?,%s;", errfile, progname, mypid, *outputstr == '$' ? outputstr+1 : outputstr);
|
||||
free(outputstr);
|
||||
@ -258,9 +262,11 @@ void Syslog(int level, const char *format, ...)
|
||||
void Syslogp(int level, char *outstr)
|
||||
{
|
||||
long mask = 0;
|
||||
int i, upper;
|
||||
int i, upper, debug;
|
||||
|
||||
debug = isalpha(level);
|
||||
upper = isupper(level);
|
||||
|
||||
switch(tolower(level)) {
|
||||
case ' ' : mask = DLOG_ALLWAYS; break;
|
||||
case '?' : mask = DLOG_ERROR; break;
|
||||
@ -310,7 +316,9 @@ void Syslogp(int level, char *outstr)
|
||||
lcrc = tcrc;
|
||||
if (lcnt) {
|
||||
lcnt++;
|
||||
SockS("ALOG:5,%s,%s,%d,%c,Last message repeated %d times;", logfile, progname, mypid, level, lcnt);
|
||||
SockS("ALOG:5,%s,%s,%d,%c,Last message repeated %d times;", logdebug, progname, mypid, level, lcnt);
|
||||
if (!debug)
|
||||
SockS("ALOG:5,%s,%s,%d,%c,Last message repeated %d times;", logfile, progname, mypid, level, lcnt);
|
||||
}
|
||||
lcnt = 0;
|
||||
}
|
||||
@ -318,10 +326,15 @@ void Syslogp(int level, char *outstr)
|
||||
if (show_log)
|
||||
printf("%c %s\n", level, outstr);
|
||||
|
||||
if (*outstr == '$')
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s: %s;", logfile, progname, mypid, level, outstr+1, strerror(errno));
|
||||
else
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s;", logfile, progname, mypid, level, outstr);
|
||||
if (*outstr == '$') {
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s: %s;", logdebug, progname, mypid, level, outstr+1, strerror(errno));
|
||||
if (!debug)
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s: %s;", logfile, progname, mypid, level, outstr+1, strerror(errno));
|
||||
} else {
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s;", logdebug, progname, mypid, level, outstr);
|
||||
if (!debug)
|
||||
SockS("ALOG:5,%s,%s,%d,%c,%s;", logfile, progname, mypid, level, outstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ extern char SigName[32][16];
|
||||
char *xmalloc(size_t);
|
||||
char *xstrcpy(char *);
|
||||
char *xstrcat(char *, char *);
|
||||
void InitClient(char *, char *, char *, char *, long, char *, char *);
|
||||
void InitClient(char *, char *, char *, char *, long, char *, char *, char *);
|
||||
void ExitClient(int);
|
||||
void SockS(const char *, ...);
|
||||
char *SockR(const char *, ...);
|
||||
|
@ -263,7 +263,7 @@ struct taskrec {
|
||||
int max_tcp; /* maximum TCP/IP calls */
|
||||
|
||||
unsigned xipblocks : 1;
|
||||
unsigned debug : 1; /* debugging on/off */
|
||||
unsigned xdebug : 1; /* debugging on/off */
|
||||
};
|
||||
|
||||
|
||||
@ -804,6 +804,7 @@ struct sysconfig {
|
||||
unsigned ca_Check : 1; /* Flag for upgrade check */
|
||||
|
||||
char rulesdir[65]; /* Area rules directory */
|
||||
char debuglog[15]; /* Debug logfile */
|
||||
};
|
||||
|
||||
|
||||
|
@ -183,7 +183,8 @@ int main(int argc, char *argv[])
|
||||
TermInit(1);
|
||||
t_start = c_start = c_end = time(NULL);
|
||||
|
||||
InitClient(pw->pw_name, (char *)"mbcico", CFG.location, CFG.logfile, CFG.cico_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbcico", CFG.location, CFG.logfile,
|
||||
CFG.cico_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBCICO v%s", VERSION);
|
||||
|
||||
|
@ -232,7 +232,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbout", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbout", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBOUT v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
|
@ -137,7 +137,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbaff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbaff", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBAFF v%s", VERSION);
|
||||
|
@ -159,7 +159,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBDIFF v%s", VERSION);
|
||||
|
@ -423,7 +423,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbfido", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbfido", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBFIDO v%s", VERSION);
|
||||
|
@ -199,7 +199,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBFILE v%s", VERSION);
|
||||
|
@ -175,7 +175,8 @@ int main(int argc,char *argv[])
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbindex", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbindex", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBINDEX v%s", VERSION);
|
||||
|
@ -153,7 +153,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbmsg", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBMSG v%s", VERSION);
|
||||
|
@ -49,7 +49,8 @@ int main(int argc, char **argv)
|
||||
|
||||
pw = getpwuid(getuid());
|
||||
|
||||
InitClient(pw->pw_name, (char *)"mbseq", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbseq", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBSEQ v%s", VERSION);
|
||||
|
@ -174,7 +174,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mball", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mball", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBALL v%s", VERSION);
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
do_quiet = TRUE;
|
||||
InitClient((char *)"Unknown", (char *)"mbnewusr", (char *)"Unknown",
|
||||
CFG.logfile, CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
CFG.logfile, CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
IsDoing("Loging in");
|
||||
|
||||
Syslog(' ', " ");
|
||||
|
@ -101,7 +101,8 @@ int main(int argc, char **argv)
|
||||
* Initialize this client with the server.
|
||||
*/
|
||||
do_quiet = TRUE;
|
||||
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile, CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile,
|
||||
CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
IsDoing("Loging in");
|
||||
|
||||
Syslog(' ', " ");
|
||||
|
@ -151,7 +151,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbstat", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbstat", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
usleep(1);
|
||||
|
||||
Syslog(' ', " ");
|
||||
|
@ -98,7 +98,8 @@ int main(int argc, char **argv)
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbuser", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
InitClient(pw->pw_name, (char *)"mbuser", CFG.location, CFG.logfile,
|
||||
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBUSER v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
|
@ -191,31 +191,34 @@ void e_filenames(void)
|
||||
set_color(CYAN, BLACK);
|
||||
mvprintw( 7, 6, "1. System logfile");
|
||||
mvprintw( 8, 6, "2. Error logfile");
|
||||
mvprintw( 9, 6, "3. Mgr logfile");
|
||||
mvprintw(10, 6, "4. Default Menu");
|
||||
mvprintw(11, 6, "5. Default Language");
|
||||
mvprintw(12, 6, "6. Chat Logfile");
|
||||
mvprintw(13, 6, "7. Welcome Logo");
|
||||
mvprintw( 9, 6, "3. Debug logfile");
|
||||
mvprintw(10, 6, "4. Mgr logfile");
|
||||
mvprintw(11, 6, "5. Default Menu");
|
||||
mvprintw(12, 6, "6. Default Language");
|
||||
mvprintw(13, 6, "7. Chat Logfile");
|
||||
mvprintw(14, 6, "8. Welcome Logo");
|
||||
|
||||
for (;;) {
|
||||
set_color(WHITE, BLACK);
|
||||
show_str( 7,28,14, CFG.logfile);
|
||||
show_str( 8,28,14, CFG.error_log);
|
||||
show_str( 9,28,14, CFG.mgrlog);
|
||||
show_str(10,28,14, CFG.default_menu);
|
||||
show_str(11,28,14, CFG.current_language);
|
||||
show_str(12,28,14, CFG.chat_log);
|
||||
show_str(13,28,14, CFG.welcome_logo);
|
||||
show_str( 9,28,14, CFG.debuglog);
|
||||
show_str(10,28,14, CFG.mgrlog);
|
||||
show_str(11,28,14, CFG.default_menu);
|
||||
show_str(12,28,14, CFG.current_language);
|
||||
show_str(13,28,14, CFG.chat_log);
|
||||
show_str(14,28,14, CFG.welcome_logo);
|
||||
|
||||
switch(select_menu(7)) {
|
||||
switch(select_menu(8)) {
|
||||
case 0: return;
|
||||
case 1: E_STR( 7,28,14, CFG.logfile, "The name of the ^system^ logfile.")
|
||||
case 2: E_STR( 8,28,14, CFG.error_log, "The name of the ^errors^ logfile.")
|
||||
case 3: E_STR( 9,28,14, CFG.mgrlog, "The name of the ^area-/filemgr^ logfile.")
|
||||
case 4: E_STR(10,28,14, CFG.default_menu, "The name of the ^default^ (top) ^menu^.")
|
||||
case 5: E_STR(11,28,14, CFG.current_language, "The name of the ^default language^.")
|
||||
case 6: E_STR(12,28,14, CFG.chat_log, "The name of the ^chat^ logfile.")
|
||||
case 7: E_STR(13,28,14, CFG.welcome_logo, "The name of the ^BBS logo^ file.")
|
||||
case 3: E_STR( 9,28,14, CFG.debuglog, "The name of the ^debug^ logfile.")
|
||||
case 4: E_STR(10,28,14, CFG.mgrlog, "The name of the ^area-/filemgr^ logfile.")
|
||||
case 5: E_STR(11,28,14, CFG.default_menu, "The name of the ^default^ (top) ^menu^.")
|
||||
case 6: E_STR(12,28,14, CFG.current_language, "The name of the ^default language^.")
|
||||
case 7: E_STR(13,28,14, CFG.chat_log, "The name of the ^chat^ logfile.")
|
||||
case 8: E_STR(14,28,14, CFG.welcome_logo, "The name of the ^BBS logo^ file.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1481,6 +1484,11 @@ void global_menu(void)
|
||||
Syslog('+', "Main config, upgraded for manager security");
|
||||
}
|
||||
|
||||
if (strlen(CFG.debuglog) == 0) {
|
||||
sprintf(CFG.debuglog, "debug.log");
|
||||
Syslog('+', "Main config, upgraded for new debug logfile");
|
||||
}
|
||||
|
||||
if (!CFG.ca_PlusAll && !CFG.ca_Notify && !CFG.ca_Passwd && !CFG.ca_Pause && !CFG.ca_Check) {
|
||||
CFG.ca_PlusAll = TRUE;
|
||||
CFG.ca_Notify = TRUE;
|
||||
@ -1701,6 +1709,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
addtoc(fp, toc, 1, 4, page, (char *)"Global filenames");
|
||||
fprintf(fp, " System logfile %s\n", CFG.logfile);
|
||||
fprintf(fp, " Error logfile %s\n", CFG.error_log);
|
||||
fprintf(fp, " Debug logfile %s\n", CFG.debuglog);
|
||||
fprintf(fp, " Manager logfile %s\n", CFG.mgrlog);
|
||||
fprintf(fp, " Default menu %s\n", CFG.default_menu);
|
||||
fprintf(fp, " Default language %s\n", CFG.current_language);
|
||||
|
@ -125,10 +125,9 @@ int EditTask()
|
||||
mvprintw(18, 1, "13. Max TCP");
|
||||
mvprintw(19, 1, "14. Max Load");
|
||||
|
||||
mvprintw(18,29, "15. ZMH start");
|
||||
mvprintw(19,29, "16. ZMH end");
|
||||
mvprintw(18,41, "15. ZMH start");
|
||||
mvprintw(19,41, "16. ZMH end");
|
||||
|
||||
mvprintw(19,55, "17. Debug");
|
||||
|
||||
for (;;) {
|
||||
set_color(WHITE, BLACK);
|
||||
@ -148,12 +147,10 @@ int EditTask()
|
||||
sprintf(temp, "%0.2f", TCFG.maxload);
|
||||
show_str(19, 15,5, temp);
|
||||
|
||||
show_str( 18,44, 5, TCFG.zmh_start);
|
||||
show_str( 19,44, 5, TCFG.zmh_end);
|
||||
show_str( 18,56, 5, TCFG.zmh_start);
|
||||
show_str( 19,56, 5, TCFG.zmh_end);
|
||||
|
||||
show_bool(19,69, TCFG.debug);
|
||||
|
||||
j = select_menu(17);
|
||||
j = select_menu(16);
|
||||
switch(j) {
|
||||
case 0: return 0;
|
||||
case 1: E_STR( 6,15,65,TCFG.cmd_mailout, "The command to execute on semafore ^mailout^")
|
||||
@ -172,9 +169,8 @@ int EditTask()
|
||||
case 14:strcpy(temp, edit_str(19,15,5,temp, (char *)"^Maximum system load^ at which processing stops (1.00 .. 3.00)"));
|
||||
sscanf(temp, "%f", &TCFG.maxload);
|
||||
break;
|
||||
case 15:E_STR( 18,44,5, TCFG.zmh_start, "^Start^ of Zone Mail Hour in UTC")
|
||||
case 16:E_STR( 19,44,5, TCFG.zmh_end, "^End& of Zone Mail Hour in UTC")
|
||||
case 17:E_BOOL(19,69, TCFG.debug, "Enable ^debug^ logging")
|
||||
case 15:E_STR( 18,56,5, TCFG.zmh_start, "^Start^ of Zone Mail Hour in UTC")
|
||||
case 16:E_STR( 19,56,5, TCFG.zmh_end, "^End& of Zone Mail Hour in UTC")
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +219,6 @@ int task_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " ISP ping host 1 %s\n", TCFG.isp_ping1);
|
||||
fprintf(fp, " ISP ping host 2 %s\n", TCFG.isp_ping2);
|
||||
|
||||
fprintf(fp, " Enable denug logging %s\n", getboolean(TCFG.debug));
|
||||
fprintf(fp, " Maximum system load %0.2f\n", TCFG.maxload);
|
||||
fprintf(fp, " Max TCP/IP connections %d\n", TCFG.max_tcp);
|
||||
|
||||
|
@ -420,7 +420,9 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
config_check(getenv("MBSE_ROOT"));
|
||||
config_read();
|
||||
InitClient(pw->pw_name, (char *)"mbsetup", CFG.location, CFG.logfile, 0x1f, CFG.error_log, CFG.mgrlog);
|
||||
if (strlen(CFG.debuglog) == 0)
|
||||
sprintf(CFG.debuglog, "debug.log");
|
||||
InitClient(pw->pw_name, (char *)"mbsetup", CFG.location, CFG.logfile, 0x1f, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||
|
||||
/*
|
||||
* Setup several signals so when the program terminate's it
|
||||
|
@ -149,6 +149,7 @@ void load_maincfg(void)
|
||||
sprintf(CFG.chat_log, "chat.log");
|
||||
sprintf(CFG.welcome_logo, "logo.asc");
|
||||
sprintf(CFG.mgrlog, "manager.log");
|
||||
sprintf(CFG.debuglog, "debug.log");
|
||||
|
||||
/*
|
||||
* Fill Global defaults
|
||||
@ -372,6 +373,8 @@ void load_maincfg(void)
|
||||
} else {
|
||||
fread(&CFG, sizeof(CFG), 1, fp);
|
||||
fclose(fp);
|
||||
if (strlen(CFG.debuglog) == 0)
|
||||
sprintf(CFG.debuglog, "debug.log");
|
||||
}
|
||||
|
||||
cfg_time = file_time(cfgfn);
|
||||
@ -399,7 +402,6 @@ void load_taskcfg(void)
|
||||
sprintf(TCFG.cmd_mbindex2, "%s -f -q", _PATH_GOLDNODE);
|
||||
sprintf(TCFG.cmd_msglink, "%s/bin/mbmsg link -quiet", getenv("MBSE_ROOT"));
|
||||
sprintf(TCFG.cmd_reqindex, "%s/bin/mbfile index -quiet", getenv("MBSE_ROOT"));
|
||||
TCFG.debug = FALSE;
|
||||
TCFG.max_tcp = 0;
|
||||
sprintf(TCFG.isp_ping1, "192.168.1.1");
|
||||
sprintf(TCFG.isp_ping2, "192.168.1.1");
|
||||
|
@ -102,22 +102,23 @@ void Syslog(int grade, const char *format, ...)
|
||||
{
|
||||
va_list va_ptr;
|
||||
char outstr[1024];
|
||||
int oldmask;
|
||||
FILE *logfile;
|
||||
char *logname;
|
||||
int oldmask, debug;
|
||||
FILE *logfile = NULL, *debugfile;
|
||||
char *logname = NULL, *debugname;
|
||||
|
||||
if (grade == '+' || grade == '-' || grade == '!' || grade == '?' || grade == ' ' || TCFG.debug) {
|
||||
va_start(va_ptr, format);
|
||||
vsprintf(outstr, format, va_ptr);
|
||||
va_end(va_ptr);
|
||||
debug = isalpha(grade);
|
||||
va_start(va_ptr, format);
|
||||
vsprintf(outstr, format, va_ptr);
|
||||
va_end(va_ptr);
|
||||
|
||||
tcrc = StringCRC32(outstr);
|
||||
if (tcrc == lcrc) {
|
||||
lcnt++;
|
||||
return;
|
||||
}
|
||||
lcrc = tcrc;
|
||||
tcrc = StringCRC32(outstr);
|
||||
if (tcrc == lcrc) {
|
||||
lcnt++;
|
||||
return;
|
||||
}
|
||||
lcrc = tcrc;
|
||||
|
||||
if (!debug) {
|
||||
logname = calloc(PATH_MAX, sizeof(char));
|
||||
oldmask=umask(066);
|
||||
sprintf(logname, "%s/log/mbtask.log", getenv("MBSE_ROOT"));
|
||||
@ -128,13 +129,32 @@ void Syslog(int grade, const char *format, ...)
|
||||
free(logname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((lcnt) && ((lchr == '+') || (lchr == '-') || (lchr == '!') || (lchr == '?') || (lchr == ' ') || TCFG.debug)) {
|
||||
lcnt++;
|
||||
fprintf(logfile, "%c %s mbtask[%d] last message repeated %d times\n", lchr, date(), getpid(), lcnt);
|
||||
debugname = calloc(PATH_MAX, sizeof(char));
|
||||
oldmask=umask(066);
|
||||
sprintf(debugname, "%s/log/%s", getenv("MBSE_ROOT"), CFG.debuglog);
|
||||
debugfile = fopen(debugname, "a");
|
||||
umask(oldmask);
|
||||
if (debugfile == NULL) {
|
||||
printf("Cannot open logfile \"%s\"\n", debugname);
|
||||
free(debugname);
|
||||
if (!debug) {
|
||||
free(logname);
|
||||
fclose(logfile);
|
||||
}
|
||||
lcnt = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (lcnt) {
|
||||
lcnt++;
|
||||
fprintf(debugfile, "%c %s mbtask[%d] last message repeated %d times\n", lchr, date(), getpid(), lcnt);
|
||||
if (!debug)
|
||||
fprintf(logfile, "%c %s mbtask[%d] last message repeated %d times\n", lchr, date(), getpid(), lcnt);
|
||||
}
|
||||
lcnt = 0;
|
||||
|
||||
if (!debug) {
|
||||
fprintf(logfile, "%c %s mbtask[%d] ", grade, date(), getpid());
|
||||
fprintf(logfile, *outstr == '$' ? outstr+1 : outstr);
|
||||
if (*outstr == '$')
|
||||
@ -143,12 +163,26 @@ void Syslog(int grade, const char *format, ...)
|
||||
fprintf(logfile, "\n");
|
||||
|
||||
fflush(logfile);
|
||||
if (fclose(logfile) != 0)
|
||||
printf("Cannot close logfile \"%s\"\n", logname);
|
||||
if (fclose(logfile) != 0)
|
||||
printf("Cannot close logfile \"%s\"\n", logname);
|
||||
|
||||
lchr = grade;
|
||||
free(logname);
|
||||
}
|
||||
|
||||
fprintf(debugfile, "%c %s mbtask[%d] ", grade, date(), getpid());
|
||||
fprintf(debugfile, *outstr == '$' ? outstr+1 : outstr);
|
||||
if (*outstr == '$')
|
||||
fprintf(debugfile, ": %s\n", strerror(errno));
|
||||
else
|
||||
fprintf(debugfile, "\n");
|
||||
|
||||
fflush(debugfile);
|
||||
if (fclose(debugfile) != 0)
|
||||
printf("Cannot close logfile \"%s\"\n", debugname);
|
||||
|
||||
lchr = grade;
|
||||
free(debugname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user