Updated logging

This commit is contained in:
Michiel Broek 2002-05-18 13:49:55 +00:00
parent 909f055c55
commit 6808f4559a
5 changed files with 47 additions and 31 deletions

View File

@ -406,6 +406,7 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode)
* If no selected language is loaded, try default language * If no selected language is loaded, try default language
*/ */
if (fi == NULL) { if (fi == NULL) {
Syslog('-', "Macro file \"%s\" for language %c not found, trying default", filename, Language);
sprintf(temp, "%s/%s", CFG.bbs_macros, filename); sprintf(temp, "%s/%s", CFG.bbs_macros, filename);
fi = fopen(temp,"r"); fi = fopen(temp,"r");
} }
@ -413,7 +414,6 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode)
if (fi == NULL) if (fi == NULL)
WriteError("OpenMacro(%s, %c): not found", filename, Language); WriteError("OpenMacro(%s, %c): not found", filename, Language);
else { else {
Syslog('d', "OpenMacro(%s, %c): using %s", filename, Language, temp);
sprintf(temp, "%s-%s", OsName(), OsCPU()); sprintf(temp, "%s-%s", OsName(), OsCPU());
if (CFG.aka[0].point) if (CFG.aka[0].point)
sprintf(aka, "%d:%d/%d.%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].point, CFG.aka[0].domain); sprintf(aka, "%d:%d/%d.%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].point, CFG.aka[0].domain);
@ -421,7 +421,10 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode)
sprintf(aka, "%d:%d/%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].domain); sprintf(aka, "%d:%d/%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].domain);
if (htmlmode) { if (htmlmode) {
MacroVars("HMOUVYZ", "ssssssd", CFG.www_url, CFG.sysdomain, temp, CFG.sysop, VERSION, aka, 0); MacroVars("O", "s", temp);
sprintf(linebuf, "%s", CFG.sysop);
html_massage(linebuf, outbuf);
MacroVars("U", "s", outbuf);
sprintf(linebuf, "%s", CFG.location); sprintf(linebuf, "%s", CFG.location);
html_massage(linebuf, outbuf); html_massage(linebuf, outbuf);
MacroVars("L", "s", outbuf); MacroVars("L", "s", outbuf);
@ -435,9 +438,18 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode)
html_massage(linebuf, outbuf); html_massage(linebuf, outbuf);
MacroVars("T", "s", outbuf); MacroVars("T", "s", outbuf);
} else { } else {
MacroVars("HLMNOSTUVYZ", "ssssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name, temp, MacroVars("L", "s", CFG.location);
CFG.sysop_name, CFG.comment, CFG.sysop, VERSION, aka, 0); MacroVars("N", "s", CFG.bbs_name);
MacroVars("O", "s", temp);
MacroVars("S", "s", CFG.sysop_name);
MacroVars("T", "s", CFG.comment);
MacroVars("U", "s", CFG.sysop);
} }
MacroVars("H", "s", CFG.www_url);
MacroVars("M", "s", CFG.sysdomain);
MacroVars("V", "s", VERSION);
MacroVars("Y", "s", aka);
MacroVars("Z", "d", 0);
Cookie(htmlmode); Cookie(htmlmode);
} }

View File

@ -307,6 +307,9 @@ long Report(gr_list *ta, long filepos)
/* /*
* Area block header * Area block header
*/ */
#if defined(__FreeBSD__)
Syslog('-', "Area Block GJZ: \"%s\" \"%s\" 0", T_File.Echo, T_File.Comment);
#endif
MacroVars("GJZ", "ssd", T_File.Echo, T_File.Comment, 0); MacroVars("GJZ", "ssd", T_File.Echo, T_File.Comment, 0);
fseek(fi, filepos, SEEK_SET); fseek(fi, filepos, SEEK_SET);
Msg_Macro(fi); Msg_Macro(fi);
@ -327,23 +330,26 @@ long Report(gr_list *ta, long filepos)
* Report one newfile, first line. * Report one newfile, first line.
*/ */
fseek(fi, filepos1, SEEK_SET); fseek(fi, filepos1, SEEK_SET);
Syslog('-', "1");
ftime = T_File.Fdate; ftime = T_File.Fdate;
// MacroVars("slbkdt", "ssddss", T_File.Name, T_File.LName, T_File.Size, T_File.SizeKb, /* rfcdate(ftime) */ " ", #if defined (__FreeBSD__)
// To_Low(T_File.LDesc[0],newfiles.HiAscii)); Syslog('-', "start a file ...");
Syslog('-', "sl: \"%s\" \"%s\"", T_File.Name, T_File.LName);
Syslog('-', "bk: \"%d\" \"%d\"", T_File.Size, T_File.SizeKb);
Syslog('-', "dt: \"%d\" \"%d\"", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii));
#endif
MacroVars("sl", "ss", T_File.Name, T_File.LName); MacroVars("sl", "ss", T_File.Name, T_File.LName);
Syslog('-', "2");
MacroVars("bk", "dd", T_File.Size, T_File.SizeKb); MacroVars("bk", "dd", T_File.Size, T_File.SizeKb);
Syslog('-', "3");
MacroVars("dt", "ss", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii)); MacroVars("dt", "ss", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii));
Syslog('-', "4");
Msg_Macro(fi); Msg_Macro(fi);
Syslog('-', "5");
filepos2 = ftell(fi); filepos2 = ftell(fi);
/* /*
* Extra description lines follow * Extra description lines follow
*/ */
for (i = 1; i < 24; i++) { for (i = 1; i < 24; i++) {
#if defined (__FreeBSD__)
Syslog('-', "t %2d: \"%s\"", i, To_Low(T_File.LDesc[i],newfiles.HiAscii));
#endif
MacroVars("t", "s", To_Low(T_File.LDesc[i],newfiles.HiAscii)); MacroVars("t", "s", To_Low(T_File.LDesc[i],newfiles.HiAscii));
fseek(fi, filepos2, SEEK_SET); fseek(fi, filepos2, SEEK_SET);
if (strlen(T_File.LDesc[i])) { if (strlen(T_File.LDesc[i])) {

View File

@ -107,8 +107,6 @@ int GetMagicRec(int Typ, int First)
if (First) if (First)
MagicNr = 0; MagicNr = 0;
Syslog('f', "GetMagicRec(%d, %s), MagicNr = %d", Typ, First ? "true":"false", MagicNr);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/magic.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/magic.data", getenv("MBSE_ROOT"));
if ((FeM = fopen(temp, "r")) == NULL) { if ((FeM = fopen(temp, "r")) == NULL) {
@ -152,7 +150,6 @@ int GetMagicRec(int Typ, int First)
} }
*q++ = '$'; *q++ = '$';
*q = '\0'; *q = '\0';
Syslog('f', "Magic mask \"%s\" -> \"%s\"", MBSE_SS(magic.Mask), MBSE_SS(mask));
if ((re_comp(mask)) == NULL) { if ((re_comp(mask)) == NULL) {
if (re_exec(TIC.NewName)) { if (re_exec(TIC.NewName)) {

View File

@ -133,7 +133,7 @@ int pack_queue(char *name)
sprintf(pktfile, "%08lx.pkt", sequencer()); sprintf(pktfile, "%08lx.pkt", sequencer());
if (nodelock(&noden)) { if (nodelock(&noden)) {
WriteError("Node %s lock error", ascfnode(&noden, 0x1f)); Syslog('+', "Mail stays in queue, will be added later");
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);
free(arcfile); free(arcfile);
@ -318,7 +318,7 @@ int add_queue(char *name)
Syslog('p', "Outfile: %s", outfile); Syslog('p', "Outfile: %s", outfile);
if (nodelock(&noden)) { if (nodelock(&noden)) {
WriteError("Node %s lock error", ascfnode(&noden, 0x1f)); Syslog('+', "Mail stays in queue, will be added later");
free(outfile); free(outfile);
if (noden.domain) if (noden.domain)
free(noden.domain); free(noden.domain);

View File

@ -125,7 +125,6 @@ int Tic()
sort_fdlist(&fdl); sort_fdlist(&fdl);
while ((fname = pull_fdlist(&fdl)) != NULL) { while ((fname = pull_fdlist(&fdl)) != NULL) {
Syslog('f', "Tic() starting with %s", fname);
if (LoadTic(inbound, fname) == 0) if (LoadTic(inbound, fname) == 0)
rc = 1; rc = 1;
if (IsSema((char *)"upsalarm")) { if (IsSema((char *)"upsalarm")) {
@ -138,7 +137,6 @@ int Tic()
break; break;
} }
} }
Syslog('f', "Tic() finished all files");
if (!do_quiet) { if (!do_quiet) {
printf("\r"); printf("\r");
@ -171,7 +169,6 @@ int LoadTic(char *inb, char *tfn)
fa_list *sbl = NULL; fa_list *sbl = NULL;
int DescCnt = FALSE; int DescCnt = FALSE;
Syslog('f', "Entering LoadTic()");
if (CFG.slow_util && do_quiet) if (CFG.slow_util && do_quiet)
usleep(1); usleep(1);
@ -179,8 +176,7 @@ int LoadTic(char *inb, char *tfn)
memset(&T_File, 0, sizeof(T_File)); memset(&T_File, 0, sizeof(T_File));
sprintf(TIC.Inbound, "%s", inb); sprintf(TIC.Inbound, "%s", inb);
// strncpy(TIC.TicName, tfn, 12); strncpy(TIC.TicName, tfn, 12);
sprintf(TIC.TicName, "%s", tfn);
chdir(inb); chdir(inb);
if ((tfp = fopen(tfn, "r")) == NULL) { if ((tfp = fopen(tfn, "r")) == NULL) {
@ -188,15 +184,23 @@ int LoadTic(char *inb, char *tfn)
return 1; return 1;
} }
/*
* Although a TIC line may only be 255 characters long,
* nobody seems to care and lines are up to 1024 characters
* long.
*/
if (PATH_MAX > 1024) if (PATH_MAX > 1024)
bufsize = PATH_MAX; bufsize = PATH_MAX;
else else
bufsize = 1024; bufsize = 1024;
Temp = calloc(bufsize+1, sizeof(char)); Temp = calloc(bufsize+1, sizeof(char));
Buf = calloc(bufsize+1, sizeof(char)); Buf = calloc(bufsize+1, sizeof(char));
Syslog('f', "Tic buffersize %d", bufsize);
while ((fgets(Buf, bufsize, tfp)) != NULL) { while ((fgets(Buf, bufsize, tfp)) != NULL) {
if (strlen(Buf) == bufsize)
Syslog('!', "Detected a TIC file line of %d characters long", bufsize);
/* /*
* Remove all garbage from the .TIC file. * Remove all garbage from the .TIC file.
*/ */
@ -209,11 +213,6 @@ int LoadTic(char *inb, char *tfn)
} }
Temp[j] = '\0'; Temp[j] = '\0';
// if (strlen(Temp) > 255) {
// Syslog('+', "Truncating TIC line of %d characters", strlen(Temp));
// Temp[255] = '\0';
// }
Syslog('f', "TIC: %s", Temp); Syslog('f', "TIC: %s", Temp);
if (strncasecmp(Temp, "hatch", 5) == 0) { if (strncasecmp(Temp, "hatch", 5) == 0) {
TIC.TicIn.Hatch = TRUE; TIC.TicIn.Hatch = TRUE;
@ -292,6 +291,9 @@ int LoadTic(char *inb, char *tfn)
TIC.TicIn.Size = atoi(Temp+5); TIC.TicIn.Size = atoi(Temp+5);
} else if (strncasecmp(Temp, "date ", 5) == 0) { } else if (strncasecmp(Temp, "date ", 5) == 0) {
/*
* Drop this one and log
*/
Syslog('f', "Date: %s", Temp+5); Syslog('f', "Date: %s", Temp+5);
} else if (strncasecmp(Temp, "cost ", 5) == 0) { } else if (strncasecmp(Temp, "cost ", 5) == 0) {
@ -471,7 +473,6 @@ int LoadTic(char *inb, char *tfn)
tic_in++; tic_in++;
rc = ProcessTic(sbl); rc = ProcessTic(sbl);
tidy_falist(&sbl); tidy_falist(&sbl);
Syslog('f', "Finishing LoadTic()");
return rc; return rc;
} }