diff --git a/ChangeLog b/ChangeLog index 0151febb..5a3b2fa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,7 @@ $Id$ v0.39.4 08-Dec-2003 Added --enable-experiment mbtask debugging code for Hans. - + general: Added French language file created by Francois Thunus. This translation is not yet complete. @@ -19,6 +19,9 @@ v0.39.4 08-Dec-2003 also fixed the message renumbering bug introduced with previous version. + mbsebbs: + A lot of small fixes for problems found with valgrind. + mbsetup: Added default record for french language. diff --git a/TODO b/TODO index e61c2f81..61ea5e20 100644 --- a/TODO +++ b/TODO @@ -58,6 +58,8 @@ mbsebbs: N: Reimplememnt CHRS kludge. + N: There are some bugs in the bbs list menu. Make it a door? + newuser: N: Test with valgrind. diff --git a/lib/clcomm.c b/lib/clcomm.c index 284a97cf..7725f1db 100644 --- a/lib/clcomm.c +++ b/lib/clcomm.c @@ -102,7 +102,7 @@ char *xstrcat(char *src, char *add) -void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr, char *debug) +void InitClient(char *user, char *myname, char *where, char *logfname, long loggr, char *err, char *mgr, char *debug) { if ((getenv("MBSE_ROOT")) == NULL) { printf("Could not get the MBSE_ROOT environment variable\n"); @@ -112,7 +112,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch } sprintf(progname, "%s", myname); - sprintf(logfile, "%s", log); + sprintf(logfile, "%s", logfname); sprintf(errfile, "%s", err); sprintf(mgrfile, "%s", mgr); sprintf(logdebug, "%s", debug); diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 4d947f19..ae7a114a 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -1112,7 +1112,7 @@ void fill_binkp_list(binkp_list **bll, file_list *fal, off_t offs) if (stat(fal->local, &tstat) != 0) { Syslog('!', "$Can't add %s to sendlist", fal->local); - exit; + return; } if (strstr(fal->remote, (char *)".pkt")) nethold += tstat.st_size; diff --git a/mbfido/forward.c b/mbfido/forward.c index c7506405..29adee4a 100644 --- a/mbfido/forward.c +++ b/mbfido/forward.c @@ -4,7 +4,7 @@ * Purpose ...............: File forward to a node * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -71,7 +71,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl) T_File.Cost = TIC.FileCost + (TIC.FileCost * nodes.AddPerc / 1000); if ((nodes.Credit < (nodes.StopLevel + T_File.Cost)) && (!TIC.Charge)) { Syslog('!', "No forward to %s, not enough credit left", aka2str(Node)); - exit; + return; } /* diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index 75809cad..3a78d558 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -134,7 +134,7 @@ lineedit.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/user mblang.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h mbuser.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbuser.h page.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h -bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h dispfile.h misc.h language.h bye.h +bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h funcs.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h ../lib/mberrors.h funcs.h mail.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h newuser.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h diff --git a/mbsebbs/bbslist.c b/mbsebbs/bbslist.c index 5864e903..693ef5c3 100644 --- a/mbsebbs/bbslist.c +++ b/mbsebbs/bbslist.c @@ -7,7 +7,7 @@ * Intro New BBS at logon * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -597,115 +597,114 @@ void BBS_Show(void) void BBS_Delete(void) { - FILE *pBBSLine; - int recno = 0; - long int offset; - int nrecno = 0; - char srecno[7]; - char *sFileName; - char stemp[50]; - char sUser[35]; + FILE *pBBSLine; + int recno = 0, nrecno = 0; + long offset; + char srecno[7], *sFileName, stemp[50], sUser[35]; - sFileName = calloc(PATH_MAX, sizeof(char)); - sprintf(sFileName,"%s/etc/bbslist.data", getenv("MBSE_ROOT")); + sFileName = calloc(PATH_MAX, sizeof(char)); + sprintf(sFileName,"%s/etc/bbslist.data", getenv("MBSE_ROOT")); - if((pBBSLine = fopen(sFileName, "r+")) == NULL) { - WriteError("Can't open file: %s", sFileName); - free(sFileName); - return; - } + if ((pBBSLine = fopen(sFileName, "r+")) == NULL) { + WriteError("Can't open file: %s", sFileName); free(sFileName); - fread(&bbshdr, sizeof(bbshdr),1 , pBBSLine); + return; + } + fread(&bbshdr, sizeof(bbshdr),1 , pBBSLine); - if(exitinfo.GraphMode) { - colour(9, 0); - printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177); - printf("\t\t\t\t%c%c", 177, 177); - colour(15, 0); - /* Delete BBS */ - printf(" %s", (char *) Language(330)); - colour(9, 0); - printf("%c%c %c\n", 177, 177, 219); - printf("\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c %c\n", 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 219); - printf("\t\t\t\t %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n\n", 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 219); - } else { - printf("\n\t\t\t\t+--------------+\n"); - /* Delete BBS */ - printf("\t\t\t\t| %s |\n", (char *) Language(330)); - printf("\t\t\t\t+--------------+\n\n"); - } + if (exitinfo.GraphMode) { + colour(9, 0); + printf("\n\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177); + printf("\t\t\t\t%c%c", 177, 177); + colour(15, 0); + /* Delete BBS */ + printf(" %s", (char *) Language(330)); + colour(9, 0); + printf("%c%c %c\n", 177, 177, 219); + printf("\t\t\t\t%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c %c\n", 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 219); + printf("\t\t\t\t %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n\n", 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 219); + } else { + printf("\n\t\t\t\t+--------------+\n"); + /* Delete BBS */ + printf("\t\t\t\t| %s |\n", (char *) Language(330)); + printf("\t\t\t\t+--------------+\n\n"); + } - Enter(1); - /* Please enter number to delete: */ - pout(15, 0, (char *) Language(331)); - colour(CFG.InputColourF, CFG.InputColourB); - GetstrC(srecno, 9); + Enter(1); + /* Please enter number to delete: */ + pout(15, 0, (char *) Language(331)); + colour(CFG.InputColourF, CFG.InputColourB); + GetstrC(srecno, 9); - if((strcmp(srecno,"")) == 0) - return; + if ((strcmp(srecno,"")) == 0) + return; - recno = atoi(srecno); - nrecno = recno; - recno = 0; + recno = atoi(srecno); + nrecno = recno; + recno = 0; - while (fread(&bbs, bbshdr.recsize, 1, pBBSLine) == 1) - recno++; + while (fread(&bbs, bbshdr.recsize, 1, pBBSLine) == 1) + recno++; - if(nrecno >= recno) { - Enter(1); - /* Record does not exist */ - pout(12, 0, (char *) Language(319)); - Enter(2); - fclose(pBBSLine); - Pause(); - return; - } else { - offset = bbshdr.hdrsize + (nrecno * bbshdr.recsize); - if (fseek(pBBSLine, offset, 0) != 0) - WriteError("Can't move pointer there. %s",sFileName); + if (nrecno >= recno) { + Enter(1); + /* Record does not exist */ + pout(12, 0, (char *) Language(319)); + Enter(2); + fclose(pBBSLine); + free(sFileName); + Pause(); + return; + } else { + offset = bbshdr.hdrsize + (nrecno * bbshdr.recsize); + if (fseek(pBBSLine, offset, 0) != 0) + WriteError("Can't move pointer there. %s",sFileName); - fread(&bbs, sizeof(bbs), 1, pBBSLine); + fread(&bbs, sizeof(bbs), 1, pBBSLine); - /* Convert Record Int to string, so we can print to logfiles */ - sprintf(stemp,"%d", nrecno); + /* Convert Record Int to string, so we can print to logfiles */ + sprintf(stemp,"%d", nrecno); - /* Print UserName to String, so we can compare for deletion */ - sprintf(sUser,"%s", exitinfo.sUserName); + /* Print UserName to String, so we can compare for deletion */ + sprintf(sUser,"%s", exitinfo.sUserName); - if((strcmp(sUser, bbs.UserName)) != 0) { - if((!SYSOP) && (exitinfo.Security.level < CFG.sysop_access)) { - /* Record */ /* does not belong to you.*/ - printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333)); - Syslog('!', "User tried to delete somebody else's bbslist record: %s", stemp); - return; - } - } - - if ((bbs.Available == FALSE)) { - colour(12, 0); - /* Record */ - printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(334)); - Syslog('!', "User tried to mark an already marked bbslist record: %s", stemp); - } else { - bbs.Available = FALSE; - colour(10, 0); - /* Record: */ - printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(335)); - Syslog('+', "User marked bbslist record for deletion: %s", stemp); - colour(15, 2); - /* The Sysop will purge the list once he has *//* seen you have marked a record for deletion. */ - printf("%s\n%s\n\n", (char *) Language(336), (char *) Language(337)); - Pause(); - } - - offset = bbshdr.hdrsize + (nrecno * bbshdr.recsize); - if(fseek(pBBSLine, offset, 0) != 0) - WriteError("Can't move pointer there. %s",sFileName); - fwrite(&bbs, sizeof(bbs), 1, pBBSLine); + if ((strcmp(sUser, bbs.UserName)) != 0) { + if ((!SYSOP) && (exitinfo.Security.level < CFG.sysop_access)) { + /* Record */ /* does not belong to you.*/ + printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333)); + Syslog('!', "User tried to delete somebody else's bbslist record: %s", stemp); + free(sFileName); + fclose(pBBSLine); + return; + } } - fclose(pBBSLine); - chmod(sFileName, 0660); + if ((bbs.Available == FALSE)) { + colour(12, 0); + /* Record */ + printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(334)); + Syslog('!', "User tried to mark an already marked bbslist record: %s", stemp); + } else { + bbs.Available = FALSE; + colour(10, 0); + /* Record: */ + printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(335)); + Syslog('+', "User marked bbslist record for deletion: %s", stemp); + colour(15, 2); + /* The Sysop will purge the list once he has *//* seen you have marked a record for deletion. */ + printf("%s\n%s\n\n", (char *) Language(336), (char *) Language(337)); + Pause(); + } + + offset = bbshdr.hdrsize + (nrecno * bbshdr.recsize); + if (fseek(pBBSLine, offset, 0) != 0) + WriteError("Can't move pointer there. %s",sFileName); + fwrite(&bbs, sizeof(bbs), 1, pBBSLine); + } + + fclose(pBBSLine); + chmod(sFileName, 0660); + free(sFileName); } diff --git a/mbsebbs/bye.c b/mbsebbs/bye.c index 584cbb98..fa61ba87 100644 --- a/mbsebbs/bye.c +++ b/mbsebbs/bye.c @@ -37,6 +37,7 @@ #include "../lib/clcomm.h" #include "../lib/common.h" #include "../lib/mberrors.h" +#include "../lib/nodelist.h" #include "dispfile.h" #include "misc.h" #include "language.h" @@ -45,6 +46,9 @@ extern pid_t mypid; extern time_t t_start; +extern char *StartTime; + + int do_mailout = FALSE; @@ -129,6 +133,9 @@ void Good_Bye(int onsig) Unsetraw(); Free_Language(); free(pTTY); + if (StartTime) + free(StartTime); + deinitnl(); exit(onsig); } @@ -152,6 +159,8 @@ void Quick_Bye(int onsig) Free_Language(); free(pTTY); + if (StartTime) + free(StartTime); exit(MBERR_OK); } diff --git a/mbsebbs/email.c b/mbsebbs/email.c index ad810579..35a53ab6 100644 --- a/mbsebbs/email.c +++ b/mbsebbs/email.c @@ -807,96 +807,101 @@ void Reply_Email(int IsReply) void Write_Email(void) { - faddr *Dest = NULL; - int i; - char *orgbox; + faddr *Dest = NULL; + int i; + char *orgbox; - if (HasNoEmail()) - return; + if (HasNoEmail()) + return; - orgbox = xstrcpy(sMailbox); - SetEmailArea((char *)"mailbox"); + orgbox = xstrcpy(sMailbox); + SetEmailArea((char *)"mailbox"); - WhosDoingWhat(READ_POST, NULL); - clear(); + WhosDoingWhat(READ_POST, NULL); + clear(); + for (i = 0; i < (TEXTBUFSIZE + 1); i++) + Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char)); + Line = 1; + + Msg_New(); + + colour(9, 0); + /* Posting message in area: */ + printf("\n%s\"%s\"\n", (char *) Language(156), "mailbox"); + + Enter(1); + /* From : */ + pout(14, 0, (char *) Language(157)); + if (CFG.EmailMode != E_PRMISP) { + /* + * If not permanent connected to the internet, use fidonet.org style addressing. + */ + Dest = fido2faddr(CFG.EmailFidoAka); + sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName); + } else + sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName); + + for (i = 0; i < strlen(Msg.From); i++) { + if (Msg.From[i] == ' ') + Msg.From[i] = '_'; + if (Msg.From[i] == '@') + break; + } + + colour(CFG.MsgInputColourF, CFG.MsgInputColourB); + printf("%s", Msg.From); + Syslog('b', "Setting From: %s", Msg.From); + + Enter(1); + /* To : */ + pout(14, 0, (char *) Language(158)); + + colour(CFG.MsgInputColourF, CFG.MsgInputColourB); + GetstrU(Msg.To, 63); + + if ((strcmp(Msg.To, "")) == 0) { for (i = 0; i < (TEXTBUFSIZE + 1); i++) - Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char)); - Line = 1; + free(Message[i]); + SetEmailArea(orgbox); + free(orgbox); + return; + } - Msg_New(); - - colour(9, 0); - /* Posting message in area: */ - printf("\n%s\"%s\"\n", (char *) Language(156), "mailbox"); + /* Subject : */ + pout(14, 0, (char *) Language(161)); + colour(CFG.MsgInputColourF, CFG.MsgInputColourB); + fflush(stdout); + alarm_on(); + GetstrP(Msg.Subject, 65, 0); + if ((strcmp(Msg.Subject, "")) == 0) { Enter(1); - /* From : */ - pout(14, 0, (char *) Language(157)); - if (CFG.EmailMode != E_PRMISP) { - /* - * If not permanent connected to the internet, use fidonet.org style addressing. - */ - Dest = fido2faddr(CFG.EmailFidoAka); - sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName); - } else - sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName); - for (i = 0; i < strlen(Msg.From); i++) { - if (Msg.From[i] == ' ') - Msg.From[i] = '_'; - if (Msg.From[i] == '@') - break; - } - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - printf("%s", Msg.From); - Syslog('b', "Setting From: %s", Msg.From); - - Enter(1); - /* To : */ - pout(14, 0, (char *) Language(158)); - - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); - GetstrU(Msg.To, 63); - - if ((strcmp(Msg.To, "")) == 0) { - for(i = 0; i < (TEXTBUFSIZE + 1); i++) - free(Message[i]); - SetEmailArea(orgbox); - return; - } - - /* Subject : */ - pout(14, 0, (char *) Language(161)); - colour(CFG.MsgInputColourF, CFG.MsgInputColourB); + /* Abort Message [y/N] ?: */ + pout(3, 0, (char *) Language(162)); fflush(stdout); alarm_on(); - GetstrP(Msg.Subject, 65, 0); - if((strcmp(Msg.Subject, "")) == 0) { - Enter(1); - /* Abort Message [y/N] ?: */ - pout(3, 0, (char *) Language(162)); - fflush(stdout); - alarm_on(); - - if (toupper(Getone()) == Keystroke(162, 0)) { - for(i = 0; i < (TEXTBUFSIZE + 1); i++) - free(Message[i]); - SetEmailArea(orgbox); - return; - } - } - - Msg.Private = TRUE; - - if (Edit_Msg()) { - Save_Email(FALSE); - } - - for (i = 0; i < (TEXTBUFSIZE + 1); i++) + if (toupper(Getone()) == Keystroke(162, 0)) { + for (i = 0; i < (TEXTBUFSIZE + 1); i++) free(Message[i]); + SetEmailArea(orgbox); + free(orgbox); + return; + } + } - SetEmailArea(orgbox); + Msg.Private = TRUE; + + if (Edit_Msg()) { + Save_Email(FALSE); + } + + for (i = 0; i < (TEXTBUFSIZE + 1); i++) + free(Message[i]); + + SetEmailArea(orgbox); + free(orgbox); } diff --git a/mbsebbs/file.c b/mbsebbs/file.c index 6d1d4fd9..005f7180 100644 --- a/mbsebbs/file.c +++ b/mbsebbs/file.c @@ -297,12 +297,12 @@ void Download(void) } } } - + fclose(tf); + /* * If anything left to download... */ if (!Count) { - fclose(tf); SetFileArea(OldArea); unlink("taglist"); /* No files marked for download */ @@ -458,6 +458,7 @@ void Download(void) } } } + fclose(tf); } /* @@ -844,147 +845,151 @@ int FilenameScan() */ int NewfileScan(int AskStart) { - FILE *pAreas, *pFile; - long ifDate, itDate; - char *temp, *Date; - int Found, Count = 0; - _Tag T; + FILE *pAreas, *pFile; + long ifDate, itDate; + char *temp, *Date; + int Found, Count = 0; + _Tag T; - Date = calloc(81, sizeof(char)); - temp = calloc(81, sizeof(char)); + Date = calloc(81, sizeof(char)); + temp = calloc(81, sizeof(char)); - iLineCount = 2; - arecno = 1; /* Reset Area Number to One */ + iLineCount = 2; + arecno = 1; /* Reset Area Number to One */ - if (AskStart) { - Enter(2); - /* Search for new since your last call [Y/n]: */ - pout(11, 0, (char *) Language(273)); - colour(CFG.InputColourF, CFG.InputColourB); - fflush(stdout); - - if (toupper(Getone()) == Keystroke(273, 1)) { - Enter(1); - /* Enter new date to search for [DD-MM-YYYY]: */ - pout(2, 0, (char *) Language(274)); - colour(CFG.InputColourF, CFG.InputColourB); - fflush(stdout); - GetDate(temp, 10); - } else - strcpy(temp, LastLoginDate); - } else - strcpy(temp, LastLoginDate); - - Syslog('+', "NewfileScan() since %s", temp); - clear(); - /* File Search by Date */ - pout(15, 0, (char *) Language(275)); + if (AskStart) { Enter(2); + /* Search for new since your last call [Y/n]: */ + pout(11, 0, (char *) Language(273)); + colour(CFG.InputColourF, CFG.InputColourB); + fflush(stdout); - Date[0] = temp[6]; /* Swap the date around */ - Date[1] = temp[7]; /* Instead of DD-MM-YYYY */ - Date[2] = temp[8]; /* Let it equal YYYYMMDD */ - Date[3] = temp[9]; /* Swap the date around */ - Date[4] = temp[3]; /* Swap the date around */ - Date[5] = temp[4]; /* because when you convert */ - Date[6] = temp[0]; /* a string to an int you */ - Date[7] = temp[1]; /* loose the front Zero */ - Date[8] = '\0'; /* making the number smaller */ - itDate = atol(Date); + if (toupper(Getone()) == Keystroke(273, 1)) { + Enter(1); + /* Enter new date to search for [DD-MM-YYYY]: */ + pout(2, 0, (char *) Language(274)); + colour(CFG.InputColourF, CFG.InputColourB); + fflush(stdout); + GetDate(temp, 10); + } else + strcpy(temp, LastLoginDate); + } else + strcpy(temp, LastLoginDate); - InitTag(); + Syslog('+', "NewfileScan() since %s", temp); + clear(); + /* File Search by Date */ + pout(15, 0, (char *) Language(275)); + Enter(2); - if ((pAreas = OpenFareas(FALSE)) == NULL) - return 0; + Date[0] = temp[6]; /* Swap the date around */ + Date[1] = temp[7]; /* Instead of DD-MM-YYYY */ + Date[2] = temp[8]; /* Let it equal YYYYMMDD */ + Date[3] = temp[9]; /* Swap the date around */ + Date[4] = temp[3]; /* Swap the date around */ + Date[5] = temp[4]; /* because when you convert */ + Date[6] = temp[0]; /* a string to an int you */ + Date[7] = temp[1]; /* loose the front Zero */ + Date[8] = '\0'; /* making the number smaller */ + itDate = atol(Date); - while (fread(&area, areahdr.recsize, 1, pAreas) == 1) { + InitTag(); - if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && - (strlen(area.Password) == 0) && (area.New)) { + if ((pAreas = OpenFareas(FALSE)) == NULL) + return 0; - if ((pFile = OpenFileBase(arecno, FALSE)) != NULL ) { + while (fread(&area, areahdr.recsize, 1, pAreas) == 1) { - Sheader(); - Found = FALSE; - Nopper(); + if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && (strlen(area.Password) == 0) && (area.New)) { - while (fread(&file, sizeof(file), 1, pFile) == 1) { - strcpy(temp, StrDateDMY(file.UploadDate)); /* Realloc Space for Date */ - Date[0] = temp[6]; /* Swap the date around */ - Date[1] = temp[7]; /* Instead of DD-MM-YYYY */ - Date[2] = temp[8]; /* Let it equal YYYYMMDD */ - Date[3] = temp[9]; /* Swap the date around */ - Date[4] = temp[3]; /* Swap the date around */ - Date[5] = temp[4]; /* because when you convert */ - Date[6] = temp[0]; /* a string to an int you */ - Date[7] = temp[1]; /* loose the front Zero */ - Date[8] = '\0'; /* making the number smaller */ - /* and invalid to this cause */ - ifDate = atol(Date); + if ((pFile = OpenFileBase(arecno, FALSE)) != NULL ) { - if(ifDate >= itDate) { - if (!Found) { - printf("\n\n"); - if (iLC(2) == 1) { - free(Date); - free(temp); - return 1; - } - Found = TRUE; - } + Sheader(); + Found = FALSE; + Nopper(); - memset(&T, 0, sizeof(T)); - T.Area = arecno; - T.Active = FALSE; - T.Cost = file.Cost; - T.Size = file.Size; - strncpy(T.SFile, file.Name, 12); - strncpy(T.LFile, file.LName, 80); - SetTag(T); - - Count++; - if (ShowOneFile() == 1) { - free(Date); - free(temp); - return 1; - } - - } /* End of if */ - } /* End of while */ + while (fread(&file, sizeof(file), 1, pFile) == 1) { + strcpy(temp, StrDateDMY(file.UploadDate)); /* Realloc Space for Date */ + Date[0] = temp[6]; /* Swap the date around */ + Date[1] = temp[7]; /* Instead of DD-MM-YYYY */ + Date[2] = temp[8]; /* Let it equal YYYYMMDD */ + Date[3] = temp[9]; /* Swap the date around */ + Date[4] = temp[3]; /* Swap the date around */ + Date[5] = temp[4]; /* because when you convert */ + Date[6] = temp[0]; /* a string to an int you */ + Date[7] = temp[1]; /* loose the front Zero */ + Date[8] = '\0'; /* making the number smaller */ + /* and invalid to this cause */ + ifDate = atol(Date); + if (ifDate >= itDate) { + if (!Found) { + printf("\n\n"); + if (iLC(2) == 1) { + free(Date); + free(temp); fclose(pFile); + fclose(pAreas); + return 1; + } + Found = TRUE; + } - /* - * Add 2 blank lines after found files. - */ - if (Found) { - printf("\n\n"); - if (iLC(2) == 1) { - free(Date); - free(temp); - return 1; - } - } + memset(&T, 0, sizeof(T)); + T.Area = arecno; + T.Active = FALSE; + T.Cost = file.Cost; + T.Size = file.Size; + strncpy(T.SFile, file.Name, 12); + strncpy(T.LFile, file.LName, 80); + SetTag(T); - } /* End of open filebase */ + Count++; + if (ShowOneFile() == 1) { + free(Date); + free(temp); + fclose(pFile); + fclose(pAreas); + return 1; + } - } /* End of check new files scan */ - arecno++; /* Go to next file area */ + } /* End of if */ + } /* End of while */ - } /* End of Main */ + fclose(pFile); - if (Count) - Syslog('+', "Found %d new files", Count); - fclose(pAreas); - printf("\n"); - if (Count) - Mark(); - else - Pause(); + /* + * Add 2 blank lines after found files. + */ + if (Found) { + printf("\n\n"); + if (iLC(2) == 1) { + free(Date); + free(temp); + fclose(pAreas); + return 1; + } + } - free(temp); - free(Date); - return 1; + } /* End of open filebase */ + + } /* End of check new files scan */ + arecno++; /* Go to next file area */ + + } /* End of Main */ + + if (Count) + Syslog('+', "Found %d new files", Count); + fclose(pAreas); + printf("\n"); + if (Count) + Mark(); + else + Pause(); + + free(temp); + free(Date); + return 1; } diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 312ef1c6..ab0f9a67 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -225,6 +225,13 @@ int Crash_Option(faddr *Dest) printf("%c", Keystroke(462, 1)); } fflush(stdout); + + if (Nlent->addr.domain) + free(Nlent->addr.domain); + Nlent->addr.domain = NULL; + if (Nlent->url) + free(Nlent->url); + Nlent->url = NULL; } Dest->point = point; @@ -399,7 +406,7 @@ void Post_Msg() int i, x, cc; char *FidoNode; faddr *Dest = NULL; - node *Nlent; + node *Nlent = NULL; unsigned short point; Line = 1; @@ -505,6 +512,13 @@ void Post_Msg() point = Dest->point; Dest->point = 0; if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) { + if (Nlent->url) + free(Nlent->url); + Nlent->url = NULL; + if (Nlent->addr.domain) + free(Nlent->addr.domain); + Nlent->addr.domain = NULL; + colour(YELLOW, BLACK); if (point) printf("Boss : "); @@ -577,6 +591,7 @@ void Post_Msg() if (toupper(Getone()) == Keystroke(162, 0)) { for(i = 0; i < (TEXTBUFSIZE + 1); i++) free(Message[i]); + tidy_faddr(Dest); return; } } @@ -642,6 +657,7 @@ void Post_Msg() for (i = 0; i < (TEXTBUFSIZE + 1); i++) free(Message[i]); + tidy_faddr(Dest); } diff --git a/mbsebbs/mbsebbs.c b/mbsebbs/mbsebbs.c index 409c4b25..8604c2b2 100644 --- a/mbsebbs/mbsebbs.c +++ b/mbsebbs/mbsebbs.c @@ -143,9 +143,9 @@ int main(int argc, char **argv) * Trap signals */ for(i = 0; i < NSIG; i++) { - if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) + if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) signal(i, (void (*))die); - else + else if ((i != SIGKILL) && (i != SIGSTOP)) signal(i, SIG_IGN); } diff --git a/mbsebbs/misc.c b/mbsebbs/misc.c index 50ad24c8..b4144dee 100644 --- a/mbsebbs/misc.c +++ b/mbsebbs/misc.c @@ -4,7 +4,7 @@ * Purpose ...............: Misc functions * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -62,75 +62,74 @@ int LC_Door = FALSE; int ChkFiles() { - FILE *pCallerLog, *pUsersFile; - char *sDataFile; - time_t Now; - char *temp; + FILE *fp; + char *temp; + time_t Now; - sDataFile = calloc(PATH_MAX, sizeof(char)); - temp = calloc(PATH_MAX, sizeof(char)); - sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT")); - chmod(sDataFile, 0660); + temp = calloc(PATH_MAX, sizeof(char)); - /* - * Check if users.data exists, if not create a new one. - */ - sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); - if ((pUsersFile = fopen(temp,"rb")) == NULL) { - if((pUsersFile = fopen(temp,"wb")) == NULL) { - WriteError("$Can't create %s", temp); - ExitClient(MBERR_INIT_ERROR); - } else { - usrconfighdr.hdrsize = sizeof(usrconfighdr); - usrconfighdr.recsize = sizeof(usrconfig); - fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, pUsersFile); - fclose(pUsersFile); - chmod(temp, 0660); - } + /* + * Check if users.data exists, if not create a new one. + */ + sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); + if ((fp = fopen(temp,"rb")) == NULL) { + if ((fp = fopen(temp,"wb")) == NULL) { + WriteError("$Can't create %s", temp); + ExitClient(MBERR_INIT_ERROR); + } else { + usrconfighdr.hdrsize = sizeof(usrconfighdr); + usrconfighdr.recsize = sizeof(usrconfig); + fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fp); + fclose(fp); } + } else { + fclose(fp); + } + chmod(temp, 0660); - /* - * Check if sysinfo.data exists, if not, create a new one. - */ - if ((pCallerLog = fopen(sDataFile, "rb")) == NULL) { - if((pCallerLog = fopen(sDataFile, "wb")) == NULL) - WriteError("$ChkFiles: Can't create %s", sDataFile); - else { - memset((char *)&SYSINFO, 0, sizeof(SYSINFO)); - Now = time(NULL); - SYSINFO.StartDate = Now; - - rewind(pCallerLog); - fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog); - fclose(pCallerLog); - chmod(sDataFile, 0660); - } + /* + * Check if sysinfo.data exists, if not, create a new one. + */ + sprintf(temp, "%s/etc/sysinfo.data", getenv("MBSE_ROOT")); + if ((fp = fopen(temp, "rb")) == NULL) { + if ((fp = fopen(temp, "wb")) == NULL) { + WriteError("$ChkFiles: Can't create %s", temp); + } else { + memset((char *)&SYSINFO, 0, sizeof(SYSINFO)); + Now = time(NULL); + SYSINFO.StartDate = Now; + fwrite(&SYSINFO, sizeof(SYSINFO), 1, fp); + fclose(fp); } - free(temp); - free(sDataFile); - return 1; + } else { + fclose(fp); + } + chmod(temp, 0660); + + free(temp); + return 1; } void DisplayLogo() { - FILE *pLogo; - char *sString, *temp; + FILE *pLogo; + char *sString, *temp; - temp = calloc(PATH_MAX, sizeof(char)); - sString = calloc(81, sizeof(char)); + temp = calloc(PATH_MAX, sizeof(char)); + sString = calloc(81, sizeof(char)); - sprintf(temp, "%s/%s", CFG.bbs_txtfiles, CFG.welcome_logo); - if((pLogo = fopen(temp,"rb")) == NULL) - WriteError("$DisplayLogo: Can't open %s", temp); - else { - while( fgets(sString,80,pLogo) != NULL) - printf("%s", sString); - fclose(pLogo); - } - free(sString); - free(temp); + sprintf(temp, "%s/%s", CFG.bbs_txtfiles, CFG.welcome_logo); + if ((pLogo = fopen(temp,"rb")) == NULL) + WriteError("$DisplayLogo: Can't open %s", temp); + else { + while (fgets(sString, 80, pLogo) != NULL) + printf("%s", sString); + fclose(pLogo); + } + free(sString); + free(temp); } @@ -140,85 +139,86 @@ void DisplayLogo() */ void Setup(char *Option, char *variable) { - ReadExitinfo(); - strcpy(Option, variable); - WriteExitinfo(); + ReadExitinfo(); + strcpy(Option, variable); + WriteExitinfo(); } void SaveLastCallers() { - FILE *pGLC; - char *sFileName; - char sFileDate[9]; - char sDate[9]; - struct stat statfile; + FILE *pGLC; + char *sFileName, sFileDate[9], sDate[9]; + struct stat statfile; - /* - * First check if we passed midnight, in that case we - * create a fresh file. - */ - sFileName = calloc(PATH_MAX, sizeof(char)); - sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT")); - stat(sFileName, &statfile); + /* + * First check if we passed midnight, in that case we create a fresh file. + */ + sFileName = calloc(PATH_MAX, sizeof(char)); + sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT")); + stat(sFileName, &statfile); - sprintf(sFileDate,"%s", StrDateDMY(statfile.st_mtime)); - sprintf(sDate,"%s", (char *) GetDateDMY()); + sprintf(sFileDate,"%s", StrDateDMY(statfile.st_mtime)); + sprintf(sDate,"%s", (char *) GetDateDMY()); - if ((strcmp(sDate,sFileDate)) != 0) { - unlink(sFileName); - Syslog('+', "Erased old lastcall.data"); + if ((strcmp(sDate,sFileDate)) != 0) { + unlink(sFileName); + Syslog('+', "Erased old lastcall.data"); + } + + /* + * Check if file exists, if not create the file and write the fileheader. + */ + if ((pGLC = fopen(sFileName, "r")) == NULL) { + if ((pGLC = fopen(sFileName, "w")) != NULL) { + LCALLhdr.hdrsize = sizeof(LCALLhdr); + LCALLhdr.recsize = sizeof(LCALL); + fwrite(&LCALLhdr, sizeof(LCALLhdr), 1, pGLC); + fclose(pGLC); + Syslog('+', "Created new lastcall.data"); } + } else { + fclose(pGLC); + } + chmod(sFileName, 0660); - /* - * Check if file exists, if not create the file and - * write the fileheader. - */ - if ((pGLC = fopen(sFileName, "r")) == NULL) { - if ((pGLC = fopen(sFileName, "w")) != NULL) { - LCALLhdr.hdrsize = sizeof(LCALLhdr); - LCALLhdr.recsize = sizeof(LCALL); - fwrite(&LCALLhdr, sizeof(LCALLhdr), 1, pGLC); - Syslog('+', "Created new lastcall.data"); - } - fclose(pGLC); - } - chmod(sFileName, 0660); + /* + * Now append a record + */ + if ((pGLC = fopen(sFileName,"a+")) == NULL) { + WriteError("$Can't open %s", sFileName); + return; + } else { + ReadExitinfo(); + memset(&LCALL, 0, sizeof(LCALL)); + sprintf(LCALL.UserName,"%s", exitinfo.sUserName); + sprintf(LCALL.Handle,"%s", exitinfo.sHandle); + sprintf(LCALL.Name, "%s", exitinfo.Name); + sprintf(LCALL.TimeOn,"%s", StartTime); + sprintf(LCALL.Device,"%s", pTTY); + LCALL.SecLevel = exitinfo.Security.level; + LCALL.Calls = exitinfo.iTotalCalls; + LCALL.CallTime = exitinfo.iConnectTime; + LCALL.Download = LC_Download; + LCALL.Upload = LC_Upload; + LCALL.Read = LC_Read; + LCALL.Wrote = LC_Wrote; + LCALL.Chat = LC_Chat; + LCALL.Olr = LC_Olr; + LCALL.Door = LC_Door; + sprintf(LCALL.Speed, "%s", ttyinfo.speed); - if ((pGLC = fopen(sFileName,"a+")) == NULL) { - WriteError("$Can't open %s", sFileName); - return; - } else { - ReadExitinfo(); - memset(&LCALL, 0, sizeof(LCALL)); - sprintf(LCALL.UserName,"%s", exitinfo.sUserName); - sprintf(LCALL.Handle,"%s", exitinfo.sHandle); - sprintf(LCALL.Name, "%s", exitinfo.Name); - sprintf(LCALL.TimeOn,"%s", StartTime); - sprintf(LCALL.Device,"%s", pTTY); - LCALL.SecLevel = exitinfo.Security.level; - LCALL.Calls = exitinfo.iTotalCalls; - LCALL.CallTime = exitinfo.iConnectTime; - LCALL.Download = LC_Download; - LCALL.Upload = LC_Upload; - LCALL.Read = LC_Read; - LCALL.Wrote = LC_Wrote; - LCALL.Chat = LC_Chat; - LCALL.Olr = LC_Olr; - LCALL.Door = LC_Door; - sprintf(LCALL.Speed, "%s", ttyinfo.speed); + /* If true then set hidden so it doesn't display in lastcallers function */ + LCALL.Hidden = exitinfo.Hidden; - /* If true then set hidden so it doesn't display in lastcallers function */ - LCALL.Hidden = exitinfo.Hidden; + sprintf(LCALL.Location,"%s", exitinfo.sLocation); - sprintf(LCALL.Location,"%s", exitinfo.sLocation); - - rewind(pGLC); /* ???????????? */ - fwrite(&LCALL, sizeof(LCALL), 1, pGLC); - fclose(pGLC); - } - free(sFileName); + rewind(pGLC); /* ???????????? */ + fwrite(&LCALL, sizeof(LCALL), 1, pGLC); + fclose(pGLC); + } + free(sFileName); } @@ -226,14 +226,14 @@ void SaveLastCallers() /* Gets Date for GetLastCallers(), returns DD:Mmm */ char *GLCdate() { - static char GLcdate[15]; + static char GLcdate[15]; - Time_Now = time(NULL); - l_date = localtime(&Time_Now); - sprintf(GLcdate,"%02d-", l_date->tm_mday); + Time_Now = time(NULL); + l_date = localtime(&Time_Now); + sprintf(GLcdate,"%02d-", l_date->tm_mday); - strcat(GLcdate,GetMonth(l_date->tm_mon+1)); - return(GLcdate); + strcat(GLcdate,GetMonth(l_date->tm_mon+1)); + return(GLcdate); } diff --git a/mbsebbs/offline.c b/mbsebbs/offline.c index 61a9d6ef..5c5bc4bd 100644 --- a/mbsebbs/offline.c +++ b/mbsebbs/offline.c @@ -4,7 +4,7 @@ * Purpose ...............: Offline Reader * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -2544,13 +2544,13 @@ union Converter { float IEEToMSBIN(float f) { - int sign, exp; + int sign, expo; union Converter t; t.f[0] = f; sign = t.uc[3] / 0x80; - exp = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF; - t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (exp << 8); + expo = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF; + t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (expo << 8); return t.f[0]; } @@ -2560,12 +2560,12 @@ float IEEToMSBIN(float f) float MSBINToIEEE(float f) { union Converter t; - int sign, exp; + int sign, expo; t.f[0] = f; sign = t.uc[2] / 0x80; - exp = (t.uc[3] - 0x81 + 0x7f) & 0xff; - t.ui[1] = (t.ui[1] & 0x7f) | (exp << 7) | (sign << 15); + expo = (t.uc[3] - 0x81 + 0x7f) & 0xff; + t.ui[1] = (t.ui[1] & 0x7f) | (expo << 7) | (sign << 15); return t.f[0]; } diff --git a/mbsebbs/oneline.c b/mbsebbs/oneline.c index 6d1c0718..7953d221 100644 --- a/mbsebbs/oneline.c +++ b/mbsebbs/oneline.c @@ -4,7 +4,7 @@ * Purpose ...............: Oneliner functions. * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -48,23 +48,26 @@ int iColour; /* Current color */ void Oneliner_Check() { - FILE *pOneline; - char *sFileName; + FILE *pOneline; + char *sFileName; - sFileName = calloc(128, sizeof(char)); - sprintf(sFileName, "%s/etc/oneline.data", getenv("MBSE_ROOT")); + sFileName = calloc(PATH_MAX, sizeof(char)); + sprintf(sFileName, "%s/etc/oneline.data", getenv("MBSE_ROOT")); - if ((pOneline = fopen(sFileName, "r")) == NULL) { - if ((pOneline = fopen(sFileName, "w")) != NULL) { - olhdr.hdrsize = sizeof(olhdr); - olhdr.recsize = sizeof(ol); - fwrite(&olhdr, sizeof(olhdr), 1, pOneline); - fclose(pOneline); - chmod(sFileName, 0660); - Syslog('-', "Created oneliner database"); - } + if ((pOneline = fopen(sFileName, "r")) == NULL) { + if ((pOneline = fopen(sFileName, "w")) != NULL) { + olhdr.hdrsize = sizeof(olhdr); + olhdr.recsize = sizeof(ol); + fwrite(&olhdr, sizeof(olhdr), 1, pOneline); + fclose(pOneline); + Syslog('-', "Created oneliner database"); } - free(sFileName); + } else { + fclose(pOneline); + } + + chmod(sFileName, 0660); + free(sFileName); } diff --git a/mbsebbs/user.c b/mbsebbs/user.c index 14bee36c..af43c093 100644 --- a/mbsebbs/user.c +++ b/mbsebbs/user.c @@ -59,7 +59,7 @@ extern int sock; extern pid_t mypid; -char *StartTime; +char *StartTime = NULL; /* diff --git a/mbtask/taskchat.c b/mbtask/taskchat.c index 7c675c16..6f905651 100644 --- a/mbtask/taskchat.c +++ b/mbtask/taskchat.c @@ -352,7 +352,7 @@ void chat_cleanuser(pid_t pid) void chat_msg(int channel, char *nick, char *msg) { int i; - char buf[128], *log; + char buf[128], *logm; if (nick == NULL) sprintf(buf, "%s", msg); @@ -360,10 +360,10 @@ void chat_msg(int channel, char *nick, char *msg) sprintf(buf, "<%s> %s", nick, msg); if (CFG.iAutoLog && strlen(CFG.chat_log)) { - log = calloc(PATH_MAX, sizeof(char)); - sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log); - ulog(log, (char *)"+", chat_channels[channel].name, (char *)"-1", buf); - free(log); + logm = calloc(PATH_MAX, sizeof(char)); + sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log); + ulog(logm, (char *)"+", chat_channels[channel].name, (char *)"-1", buf); + free(logm); } buf[79] = '\0'; diff --git a/mbtask/taskregs.c b/mbtask/taskregs.c index c67b4616..f5ee4763 100644 --- a/mbtask/taskregs.c +++ b/mbtask/taskregs.c @@ -422,7 +422,7 @@ char *reg_ipm(char *data) */ int reg_spm(char *data) { - char *cnt, *from, *too, *txt, *log; + char *cnt, *from, *too, *txt, *logm; int i; cnt = strtok(data, ","); @@ -463,10 +463,10 @@ int reg_spm(char *data) reginfo[i].ismsg = TRUE; if (CFG.iAutoLog && strlen(CFG.chat_log)) { - log = calloc(PATH_MAX, sizeof(char)); - sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log); - ulog(log, (char *)"+", from, (char *)"-1", txt); - free(log); + logm = calloc(PATH_MAX, sizeof(char)); + sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log); + ulog(logm, (char *)"+", from, (char *)"-1", txt); + free(logm); } Syslog('+', "reg_spm: rec=%d in=%d out=%d ismsg=%d", i, reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg); diff --git a/mbtask/taskutil.c b/mbtask/taskutil.c index 06ffebf9..76283935 100644 --- a/mbtask/taskutil.c +++ b/mbtask/taskutil.c @@ -4,7 +4,7 @@ * Purpose ...............: MBSE BBS Task Manager, utilities * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -194,30 +194,30 @@ void Syslog(int grade, const char *format, ...) int ulog(char *fn, char *grade, char *prname, char *prpid, char *format) { int i, oldmask; - FILE *log; + FILE *fp; oldmask = umask(066); - log = fopen(fn, "a"); + fp = fopen(fn, "a"); umask(oldmask); - if (log == NULL) { + if (fp == NULL) { oserr = errno; Syslog('!', "$Cannot open user logfile %s", fn); return -1; } - fprintf(log, "%s %s %s[%s] ", grade, date(), prname, prpid); + fprintf(fp, "%s %s %s[%s] ", grade, date(), prname, prpid); for (i = 0; i < strlen(format); i++) { if (iscntrl(format[i])) { - fputc('^', log); - fputc(format[i] + 64, log); + fputc('^', fp); + fputc(format[i] + 64, fp); } else { - fputc(format[i], log); + fputc(format[i], fp); } } - fputc('\n', log); - fflush(log); + fputc('\n', fp); + fflush(fp); - if (fclose(log) != 0) { + if (fclose(fp) != 0) { oserr = errno; Syslog('!', "$Cannot close user logfile %s", fn); return -1;