From 6808f4559a155eab9d68032aac7009ad4e156009 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 18 May 2002 13:49:55 +0000 Subject: [PATCH] Updated logging --- lib/mbdiesel.c | 20 ++++++++++++++++---- mbfido/announce.c | 26 ++++++++++++++++---------- mbfido/magic.c | 3 --- mbfido/pack.c | 4 ++-- mbfido/tic.c | 25 +++++++++++++------------ 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/lib/mbdiesel.c b/lib/mbdiesel.c index bf6579b0..efca5301 100644 --- a/lib/mbdiesel.c +++ b/lib/mbdiesel.c @@ -406,6 +406,7 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode) * If no selected language is loaded, try default language */ if (fi == NULL) { + Syslog('-', "Macro file \"%s\" for language %c not found, trying default", filename, Language); sprintf(temp, "%s/%s", CFG.bbs_macros, filename); fi = fopen(temp,"r"); } @@ -413,7 +414,6 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode) if (fi == NULL) WriteError("OpenMacro(%s, %c): not found", filename, Language); else { - Syslog('d', "OpenMacro(%s, %c): using %s", filename, Language, temp); sprintf(temp, "%s-%s", OsName(), OsCPU()); 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); @@ -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); 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); html_massage(linebuf, outbuf); MacroVars("L", "s", outbuf); @@ -435,9 +438,18 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode) html_massage(linebuf, outbuf); MacroVars("T", "s", outbuf); } else { - MacroVars("HLMNOSTUVYZ", "ssssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name, temp, - CFG.sysop_name, CFG.comment, CFG.sysop, VERSION, aka, 0); + MacroVars("L", "s", CFG.location); + 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); } diff --git a/mbfido/announce.c b/mbfido/announce.c index 173a549d..0cc17d83 100644 --- a/mbfido/announce.c +++ b/mbfido/announce.c @@ -307,6 +307,9 @@ long Report(gr_list *ta, long filepos) /* * 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); fseek(fi, filepos, SEEK_SET); Msg_Macro(fi); @@ -327,23 +330,26 @@ long Report(gr_list *ta, long filepos) * Report one newfile, first line. */ fseek(fi, filepos1, SEEK_SET); - Syslog('-', "1"); ftime = T_File.Fdate; -// MacroVars("slbkdt", "ssddss", T_File.Name, T_File.LName, T_File.Size, T_File.SizeKb, /* rfcdate(ftime) */ " ", - // To_Low(T_File.LDesc[0],newfiles.HiAscii)); - MacroVars("sl", "ss", T_File.Name, T_File.LName); - Syslog('-', "2"); - MacroVars("bk", "dd", T_File.Size, T_File.SizeKb); - Syslog('-', "3"); - MacroVars("dt", "ss", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii)); - Syslog('-', "4"); +#if defined (__FreeBSD__) + 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("bk", "dd", T_File.Size, T_File.SizeKb); + MacroVars("dt", "ss", rfcdate(ftime), To_Low(T_File.LDesc[0],newfiles.HiAscii)); Msg_Macro(fi); - Syslog('-', "5"); filepos2 = ftell(fi); + /* * Extra description lines follow */ 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)); fseek(fi, filepos2, SEEK_SET); if (strlen(T_File.LDesc[i])) { diff --git a/mbfido/magic.c b/mbfido/magic.c index 43daf710..1cbfa7dc 100644 --- a/mbfido/magic.c +++ b/mbfido/magic.c @@ -107,8 +107,6 @@ int GetMagicRec(int Typ, int First) if (First) MagicNr = 0; - Syslog('f', "GetMagicRec(%d, %s), MagicNr = %d", Typ, First ? "true":"false", MagicNr); - temp = calloc(PATH_MAX, sizeof(char)); sprintf(temp, "%s/etc/magic.data", getenv("MBSE_ROOT")); if ((FeM = fopen(temp, "r")) == NULL) { @@ -152,7 +150,6 @@ int GetMagicRec(int Typ, int First) } *q++ = '$'; *q = '\0'; - Syslog('f', "Magic mask \"%s\" -> \"%s\"", MBSE_SS(magic.Mask), MBSE_SS(mask)); if ((re_comp(mask)) == NULL) { if (re_exec(TIC.NewName)) { diff --git a/mbfido/pack.c b/mbfido/pack.c index 14b4130d..e1d83a3f 100644 --- a/mbfido/pack.c +++ b/mbfido/pack.c @@ -133,7 +133,7 @@ int pack_queue(char *name) sprintf(pktfile, "%08lx.pkt", sequencer()); if (nodelock(&noden)) { - WriteError("Node %s lock error", ascfnode(&noden, 0x1f)); + Syslog('+', "Mail stays in queue, will be added later"); if (noden.domain) free(noden.domain); free(arcfile); @@ -318,7 +318,7 @@ int add_queue(char *name) Syslog('p', "Outfile: %s", outfile); if (nodelock(&noden)) { - WriteError("Node %s lock error", ascfnode(&noden, 0x1f)); + Syslog('+', "Mail stays in queue, will be added later"); free(outfile); if (noden.domain) free(noden.domain); diff --git a/mbfido/tic.c b/mbfido/tic.c index dbda1e34..6bd1c1c6 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -125,7 +125,6 @@ int Tic() sort_fdlist(&fdl); while ((fname = pull_fdlist(&fdl)) != NULL) { - Syslog('f', "Tic() starting with %s", fname); if (LoadTic(inbound, fname) == 0) rc = 1; if (IsSema((char *)"upsalarm")) { @@ -138,7 +137,6 @@ int Tic() break; } } - Syslog('f', "Tic() finished all files"); if (!do_quiet) { printf("\r"); @@ -171,7 +169,6 @@ int LoadTic(char *inb, char *tfn) fa_list *sbl = NULL; int DescCnt = FALSE; - Syslog('f', "Entering LoadTic()"); if (CFG.slow_util && do_quiet) usleep(1); @@ -179,8 +176,7 @@ int LoadTic(char *inb, char *tfn) memset(&T_File, 0, sizeof(T_File)); sprintf(TIC.Inbound, "%s", inb); -// strncpy(TIC.TicName, tfn, 12); - sprintf(TIC.TicName, "%s", tfn); + strncpy(TIC.TicName, tfn, 12); chdir(inb); if ((tfp = fopen(tfn, "r")) == NULL) { @@ -188,15 +184,23 @@ int LoadTic(char *inb, char *tfn) 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) bufsize = PATH_MAX; else bufsize = 1024; Temp = calloc(bufsize+1, sizeof(char)); Buf = calloc(bufsize+1, sizeof(char)); - Syslog('f', "Tic buffersize %d", bufsize); 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. */ @@ -209,11 +213,6 @@ int LoadTic(char *inb, char *tfn) } Temp[j] = '\0'; -// if (strlen(Temp) > 255) { -// Syslog('+', "Truncating TIC line of %d characters", strlen(Temp)); -// Temp[255] = '\0'; -// } - Syslog('f', "TIC: %s", Temp); if (strncasecmp(Temp, "hatch", 5) == 0) { TIC.TicIn.Hatch = TRUE; @@ -292,6 +291,9 @@ int LoadTic(char *inb, char *tfn) TIC.TicIn.Size = atoi(Temp+5); } else if (strncasecmp(Temp, "date ", 5) == 0) { + /* + * Drop this one and log + */ Syslog('f', "Date: %s", Temp+5); } else if (strncasecmp(Temp, "cost ", 5) == 0) { @@ -471,7 +473,6 @@ int LoadTic(char *inb, char *tfn) tic_in++; rc = ProcessTic(sbl); tidy_falist(&sbl); - Syslog('f', "Finishing LoadTic()"); return rc; }