Changed all error return codes

This commit is contained in:
Michiel Broek
2002-10-20 20:58:55 +00:00
parent 1d819c9201
commit 02a1621f62
73 changed files with 2103 additions and 2022 deletions

View File

@@ -136,8 +136,8 @@ depend:
# Dependencies generated by make depend
bank.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
filesub.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h
language.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h
mbtoberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h
language.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h input.h language.h
mbtoberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mberrors.h
msgutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
oneline.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h funcs.h input.h language.h
bbslist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
@@ -145,20 +145,20 @@ morefile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/str
email.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
fsedit.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h pinfo.h fsedit.h
lineedit.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h lineedit.h
mblang.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h
mbuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbuser.h
mblang.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h
mbuser.o: ../config.h ../lib/libs.h ../lib/memwatch.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/memwatch.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/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
funcs.o: ../config.h ../lib/libs.h ../lib/memwatch.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 funcs.h
bye.o: ../config.h ../lib/libs.h ../lib/memwatch.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
funcs.o: ../config.h ../lib/libs.h ../lib/memwatch.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/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.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/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
newuser.o: ../config.h ../lib/libs.h ../lib/memwatch.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
pinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pinfo.h input.h
timecheck.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
timecheck.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
change.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h
exitinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
mball.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h mball.h
mbsebbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h
mball.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h ../lib/mberrors.h mball.h
mbsebbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/mberrors.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h
nextuser.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h input.h language.h timeout.h
pop3.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
lastcallers.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
@@ -166,15 +166,15 @@ safe.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs
timeout.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
file.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
mbchat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h
mbstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbstat.h
misc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
mbchat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h
mbstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbstat.h
misc.o: ../config.h ../lib/libs.h ../lib/memwatch.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 language.h misc.h timeout.h exitinfo.h
offline.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/mbse.h ../lib/users.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
user.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h
mbnewusr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
input.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h timeout.h language.h
user.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h
mbnewusr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
input.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h input.h timeout.h language.h
whoson.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h exitinfo.h whoson.h
door.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h timeout.h exitinfo.h whoson.h door.h
door.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h input.h timeout.h exitinfo.h whoson.h door.h
dispfile.o: ../config.h ../lib/libs.h ../lib/memwatch.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 funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
userlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h userlist.h language.h input.h timeout.h
timestats.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/mberrors.h"
#include "dispfile.h"
#include "misc.h"
#include "language.h"
@@ -95,7 +96,7 @@ void Good_Bye(int onsig)
offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize);
if(fseek(pUsrConfig, offset, 0) != 0) {
WriteError("Can't move pointer in file %s", temp);
ExitClient(1);
ExitClient(MBERR_GENERAL);
}
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
@@ -160,7 +161,7 @@ void Quick_Bye(int onsig)
#ifdef MEMWATCH
mwTerm();
#endif
exit(0);
exit(MBERR_OK);
}

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "input.h"
#include "timeout.h"
#include "exitinfo.h"
@@ -263,7 +264,7 @@ int exec_nosuid(char *mandato)
argv[2] = mandato;
argv[3] = 0;
execve("/bin/sh", argv, environ);
exit(127);
exit(MBERR_EXEC_FAILED);
}
e_pid = pid;

View File

@@ -39,6 +39,7 @@
#include "../lib/msgtext.h"
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "funcs.h"
@@ -197,7 +198,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
}
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
@@ -208,7 +209,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
}
/*
@@ -217,7 +218,7 @@ char *ChangeHomeDir(char *Name, int Mailboxes)
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
}
setenv("HOME", temp1, 1);
@@ -319,7 +320,7 @@ void FindMBSE()
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
@@ -331,7 +332,7 @@ void FindMBSE()
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_CONFIG_ERROR);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/mberrors.h"
#include "input.h"
#include "timeout.h"
#include "language.h"
@@ -497,7 +498,7 @@ void Getpass(char *theword)
*/
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
perror("open 7");
ExitClient(1);
ExitClient(MBERR_TTYIO_ERROR);
}
/* Set Raw mode so that the characters don't echo */

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "input.h"
#include "language.h"
@@ -132,7 +133,7 @@ void InitLanguage()
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.current_language);
if ((pLang = fopen(temp, "rb")) == NULL) {
WriteError("$FATAL: Can't open %s", temp);
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
}
while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) {
@@ -144,7 +145,7 @@ void InitLanguage()
if(iLang >= LANG) {
printf("FATAL: Language file has to many lines in it");
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
}
}

View File

@@ -38,6 +38,7 @@
#include "../lib/common.h"
#include "../lib/dbcfg.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "mball.h"
@@ -124,7 +125,7 @@ void Help()
printf(" -z -zip Create .zip archives\n");
colour(7, 0);
printf("\n");
die(0);
die(MBERR_COMMANDLINE);
}
@@ -148,8 +149,7 @@ int main(int argc, char **argv)
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) ||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
if ((i == SIGHUP) || (i == SIGKILL) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
if (!do_quiet)
printf("Done!\n");
die(0);
die(MBERR_OK);
return 0;
}
@@ -286,7 +286,7 @@ void Masterlist()
if(( pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open File Areas File: %s", sAreas);
colour(7,0);
die(1);
die(MBERR_GENERAL);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@@ -295,12 +295,12 @@ void Masterlist()
if ((fp = fopen("allfiles.tmp", "a+")) == NULL) {
WriteError("$Can't open allfiles.tmp");
die(1);
die(MBERR_GENERAL);
}
if ((np = fopen("newfiles.tmp", "a+")) == NULL) {
WriteError("$Can't open newfiles.tmp");
fclose(fp);
die(1);
die(MBERR_GENERAL);
}
TopBox(fp, TRUE);

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Sysop chat utility.
*
*****************************************************************************
* Copyright (C) 1997-2000
* Copyright (C) 1997-2002
*
* Michiel Broek FIDO: 2:2801/2802
* Beekmansbos 10
@@ -34,6 +34,7 @@
#include "../lib/structs.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
char *ttime2(void); /* Returns current time HH:MM */
@@ -72,7 +73,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
sprintf(FileName, "%s/etc/config.data", BBSpath);
@@ -84,7 +85,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_CONFIG_ERROR);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
fclose(pDataFile);
@@ -106,7 +107,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(0);
exit(MBERR_COMMANDLINE);
}
printf("\f");
@@ -130,7 +131,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_COMMANDLINE);
} else {
fgets(pid1,19,pPid);
fclose(pPid);
@@ -232,7 +233,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(0);
exit(MBERR_OK);
}

View File

@@ -34,6 +34,7 @@
#include "../lib/structs.h"
#include "../lib/users.h"
#include "../lib/records.h"
#include "../lib/mberrors.h"
int main(int argc, char **argv)
@@ -56,7 +57,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_COMMANDLINE);
}
sprintf(temp1, "%s", *(argv + 1));
@@ -68,7 +69,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_COMMANDLINE);
}
sprintf(temp1, "%s", *(argv + 1));
if ((fp = fopen(temp1, "a+")) == NULL) {
@@ -76,7 +77,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_COMMANDLINE);
}
lines = 0;
@@ -97,7 +98,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_GENERAL);
}
/*
@@ -115,7 +116,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_GENERAL);
}
fwrite(&ldata, sizeof(ldata), 1, fp);

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "mbnewusr.h"
#include "funcs.h"
#include "input.h"
@@ -76,7 +77,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_CONFIG_ERROR);
}
/*
@@ -87,7 +88,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
/*
@@ -98,7 +99,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
/*
@@ -137,7 +138,7 @@ int main(int argc, char **argv)
if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty");
Fast_Bye(0);
Fast_Bye(MBERR_OK);
}
if (strncmp("/dev/", tty, 5) == 0)
@@ -154,8 +155,7 @@ 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) || (i == SIGKILL))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
*/
if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed");
Fast_Bye(0);
Fast_Bye(MBERR_OK);
}
colour(YELLOW, BLACK);
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Fast_Bye(0);
Fast_Bye(MBERR_OK);
}
/*
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
Pause();
newuser();
Fast_Bye(0);
Fast_Bye(MBERR_OK);
return 0;
}

View File

@@ -38,6 +38,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/msg.h"
#include "../lib/mberrors.h"
#include "mbsebbs.h"
#include "user.h"
#include "dispfile.h"
@@ -78,7 +79,7 @@ int main(int argc, char **argv)
strcpy(sUnixName, getenv("USER"));
} else {
WriteError("No username in environment");
Quick_Bye(0);
Quick_Bye(MBERR_OK);
}
/*
@@ -128,7 +129,7 @@ int main(int argc, char **argv)
if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty");
Quick_Bye(0);
Quick_Bye(MBERR_OK);
}
if (strncmp("/dev/", tty, 5) == 0)
@@ -145,8 +146,7 @@ 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) || (i == SIGKILL))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@@ -168,7 +168,7 @@ int main(int argc, char **argv)
*/
if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed");
Quick_Bye(0);
Quick_Bye(MBERR_OK);
}
clear();
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Quick_Bye(0);
Quick_Bye(MBERR_OK);
}
Syslog('b', "Node number %d", iNode);

View File

@@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbstat.h"
@@ -63,7 +64,7 @@ void Help(void)
colour(3, 0);
printf(" -q -quiet Quiet, no screen output\n");
colour(7, 0);
die(0);
die(MBERR_COMMANDLINE);
}
@@ -123,9 +124,7 @@ int main(int argc, char **argv)
* Catch or ignore signals
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) ||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) ||
(i == SIGKILL))
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@@ -191,7 +190,7 @@ int main(int argc, char **argv)
Help();
usleep(1);
die(0);
die(MBERR_OK);
return 0;
}

View File

@@ -32,6 +32,7 @@
#include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/structs.h"
#include "../lib/mberrors.h"
int main(int argc, char **argv)
@@ -50,7 +51,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
temp = calloc(PATH_MAX, sizeof(char));
@@ -62,7 +63,7 @@ int main(int argc, char **argv)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_INIT_ERROR);
}
while (fread(&rep, sizeof(rep), 1, fp) == 1) {

View File

@@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbuser.h"
@@ -108,7 +109,7 @@ int main(int argc, char **argv)
free(cmd);
if (!diskfree(CFG.freespace))
ExitClient(101);
ExitClient(MBERR_DISK_FULL);
oldmask = umask(027);
if (!do_quiet)
@@ -121,7 +122,7 @@ int main(int argc, char **argv)
if (!do_quiet)
colour(7, 0);
ExitClient(0);
ExitClient(MBERR_OK);
return 0;
}
@@ -163,7 +164,7 @@ void Help(void)
colour(7, 0);
printf("\n");
ExitClient(1);
ExitClient(MBERR_COMMANDLINE);
}

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "oneline.h"
#include "mail.h"
#include "bbslist.h"
@@ -92,160 +93,160 @@ void InitMenu()
void menu()
{
FILE *pMenuFile;
int iFoundKey = FALSE, Key, IsANSI;
char *Input, *Semfile;
char *sMenuPathFileName;
FILE *pMenuFile;
int iFoundKey = FALSE, Key, IsANSI;
char *Input, *Semfile, *sMenuPathFileName;
Input = calloc(81, sizeof(char));
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
Input = calloc(PATH_MAX, sizeof(char));
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
/*
* Loop forever, this is what a BBS should do until a user logs out.
/*
* Loop forever, this is what a BBS should do until a user logs out.
*/
while (TRUE) {
WhosDoingWhat(BROWSING);
/*
* Open menufile, first users language menu, if it fails
* try to open the default menu.
*/
while (TRUE) {
sprintf(sMenuPathFileName,"%s/%s", lang.MenuPath, Menus[MenuLevel]);
if ((pMenuFile = fopen(sMenuPathFileName, "r")) == NULL) {
sprintf(sMenuPathFileName,"%s/%s", CFG.bbs_menus, Menus[MenuLevel]);
pMenuFile = fopen(sMenuPathFileName,"r");
if (pMenuFile != NULL)
Syslog('+', "Menu %s (Default)", Menus[MenuLevel]);
} else {
Syslog('+', "Menu %s (%s)", Menus[MenuLevel], lang.Name);
}
WhosDoingWhat(BROWSING);
if (pMenuFile == NULL) {
clear();
WriteError("Can't open menu file: %s", sMenuPathFileName);
MenuError++;
/*
* Open menufile, first users language menu, if it fails
* try to open the default menu.
*/
sprintf(sMenuPathFileName,"%s/%s", lang.MenuPath, Menus[MenuLevel]);
if ((pMenuFile = fopen(sMenuPathFileName, "r")) == NULL) {
sprintf(sMenuPathFileName,"%s/%s", CFG.bbs_menus, Menus[MenuLevel]);
pMenuFile = fopen(sMenuPathFileName,"r");
if (pMenuFile != NULL)
Syslog('+', "Menu %s (Default)", Menus[MenuLevel]);
} else {
Syslog('+', "Menu %s (%s)", Menus[MenuLevel], lang.Name);
/*
* Is this the last attempt to open the default menu?
*/
if (MenuError == 10) {
WriteError("FATAL ERROR: Too many menu errors");
printf("Too many menu errors, notifying Sysop\n\n");
sleep(3);
die(MBERR_CONFIG_ERROR);
}
/*
* Switch back to the default menu
*/
MenuLevel = 0;
strcpy(Menus[0], CFG.default_menu);
} else {
/*
* Display Menu Text Fields and Perform all autoexec menus in order of menu file.
* First check if there are any ANSI menus, if not, send a clearscreen first.
*/
IsANSI = FALSE;
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20))
IsANSI = TRUE;
}
}
fseek(pMenuFile, 0, SEEK_SET);
if (! IsANSI)
clear();
if (pMenuFile == NULL) {
clear();
WriteError("Can't open menu file: %s", sMenuPathFileName);
MenuError++;
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
if ( menus.AutoExec ) {
DoMenu( menus.MenuType );
}
DisplayMenu( );
}
}
/*
* Is this the last attempt to open the default menu?
*/
if (MenuError == 10) {
WriteError("FATAL ERROR: Too many menu errors");
printf("Too many menu errors, notifying Sysop\n\n");
sleep(3);
die(SIGILL);
}
/*
* Check if the BBS closed down for Zone Mail Hour or
* system shutdown. If so, we run the Goodbye show.
*/
if (CheckStatus() == FALSE) {
fclose(pMenuFile);
Syslog('+', "Kicking user out, the BBS is closed.");
sleep(3);
Good_Bye(MBERR_OK);
}
/*
* Switch back to the default menu
*/
MenuLevel = 0;
strcpy(Menus[0], CFG.default_menu);
} else {
/*
* Display Menu Text Fields and Perform all autoexec menus in order of menu file.
* First check if there are any ANSI menus, if not, send a clearscreen first.
*/
IsANSI = FALSE;
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20))
IsANSI = TRUE;
}
}
fseek(pMenuFile, 0, SEEK_SET);
if (! IsANSI)
clear();
/*
* Check the upsdown semafore
*/
Semfile = calloc(PATH_MAX, sizeof(char));
sprintf(Semfile, "%s/sema/upsdown", getenv("MBSE_ROOT"));
if (file_exist(Semfile, R_OK) == 0) {
fclose(pMenuFile);
Syslog('+', "Kicking user out, upsdown semafore detected");
printf("System power failure, closing the bbs\n\n");
free(Semfile);
sleep(3);
Good_Bye(MBERR_OK);
}
free(Semfile);
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){
if ( menus.AutoExec ) {
DoMenu( menus.MenuType );
}
DisplayMenu( );
}
}
/*
* Check if SysOp wants to chat to user everytime user
* gets prompt. Make sure /tmp/chatdev exists before
* before calling chat(). Make sure if a second user
* logs in, that .BusyChatting does exist.
*/
if(CFG.iChatPromptChk && (access("/tmp/chatdev", R_OK) == 0) && (access("/tmp/.BusyChatting", F_OK) != 0))
Chat();
/*
* Check if the BBS closed down for Zone Mail Hour or
* system shutdown. If so, we run the Goodbye show.
*/
if (CheckStatus() == FALSE) {
fclose(pMenuFile);
Syslog('+', "Kicking user out, the BBS is closed.");
sleep(3);
Good_Bye(0);
}
/*
* Check users timeleft
*/
TimeCheck();
/*
* Check the upsdown semafore
*/
Semfile = calloc(PATH_MAX, sizeof(char));
sprintf(Semfile, "%s/sema/upsdown", getenv("MBSE_ROOT"));
if (file_exist(Semfile, R_OK) == 0) {
fclose(pMenuFile);
Syslog('+', "Kicking user out, upsdown semafore detected");
printf("System power failure, closing the bbs\n\n");
free(Semfile);
sleep(3);
Good_Bye(0);
}
free(Semfile);
alarm_on();
/*
* Check if SysOp wants to chat to user everytime user
* gets prompt. Make sure /tmp/chatdev exists before
* before calling chat(). Make sure if a second user
* logs in, that .BusyChatting does exist.
*/
if(CFG.iChatPromptChk && (access("/tmp/chatdev", R_OK) == 0) && (access("/tmp/.BusyChatting", F_OK) != 0))
Chat();
if (exitinfo.HotKeys) {
fflush(stdout);
Key = Getone();
sprintf(Input, "%c", Key);
printf("\n");
} else {
colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(Input, 80);
}
/*
* Check users timeleft
*/
TimeCheck();
if ((strcmp(Input, "")) != 0) {
alarm_on();
fseek(pMenuFile, 0, SEEK_SET);
if (exitinfo.HotKeys) {
fflush(stdout);
Key = Getone();
sprintf(Input, "%c", Key);
printf("\n");
} else {
colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(Input, 80);
}
if((strcmp(Input, "")) != 0) {
fseek(pMenuFile, 0, SEEK_SET);
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) {
if ((strcmp(tu(Input), menus.MenuKey)) == 0) {
if ((Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= menus.Age)) {
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType, menus.TypeDesc, menus.OptionalData);
if (menus.MenuType == 13) {
/*
* Terminate call, cleanup here
*/
free(Input);
free(sMenuPathFileName);
fclose(pMenuFile);
}
DoMenu(menus.MenuType);
iFoundKey = TRUE;
break;
}
}
}
if ((strcmp(tu(Input), menus.MenuKey)) == 0) {
if ((Access(exitinfo.Security, menus.MenuSecurity)) && (UserAge >= menus.Age)) {
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType,
menus.TypeDesc, menus.OptionalData);
if (menus.MenuType == 13) {
/*
* Terminate call, cleanup here
*/
free(Input);
free(sMenuPathFileName);
fclose(pMenuFile);
}
DoMenu(menus.MenuType);
iFoundKey = TRUE;
break;
}
fclose(pMenuFile);
}
}
}
fclose(pMenuFile);
} /* If menu open */
} /* while true */
} /* If menu open */
} /* while true */
}
@@ -370,7 +371,7 @@ void DoMenu(int Type)
free(sPrompt);
free(sPromptBak);
free(temp);
Good_Bye(0);
Good_Bye(MBERR_OK);
break;
case 14:

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/mberrors.h"
#include "funcs.h"
#include "input.h"
#include "language.h"
@@ -79,7 +80,7 @@ int ChkFiles()
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
if((pUsersFile = fopen(temp,"wb")) == NULL) {
WriteError("$Can't create %s", temp);
ExitClient(1);
ExitClient(MBERR_INIT_ERROR);
} else {
usrconfighdr.hdrsize = sizeof(usrconfighdr);
usrconfighdr.recsize = sizeof(usrconfig);

View File

@@ -38,6 +38,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/mberrors.h"
#include "funcs.h"
#include "input.h"
#include "newuser.h"
@@ -85,7 +86,7 @@ int newuser()
clear();
DisplayFile((char *)"newuser");
if ((iLang = Chg_Language(TRUE)) == 0)
Fast_Bye(1);
Fast_Bye(MBERR_INIT_ERROR);
Enter(1);
/* MBSE BBS - NEW USER REGISTRATION */
@@ -119,7 +120,7 @@ int newuser()
*/
if ((strcasecmp(temp, "off")) == 0) {
Syslog('+', "Quick \"off\" logout");
Fast_Bye(0);
Fast_Bye(MBERR_OK);
}
Count++;
@@ -129,7 +130,7 @@ int newuser()
language(CFG.HiliteF, CFG.HiliteB, 2);
Enter(2);
Syslog('!', "Exceeded maximum login attempts");
Fast_Bye(0);
Fast_Bye(MBERR_OK);
}
/*
@@ -486,7 +487,7 @@ int newuser()
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "r+")) == NULL) {
WriteError("Can't open file: %s", temp);
ExitClient(1);
ExitClient(MBERR_GENERAL);
}
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
@@ -582,7 +583,7 @@ void Fast_Bye(int onsig)
#ifdef MEMWATCH
mwTerm();
#endif
exit(0);
exit(MBERR_OK);
}
@@ -659,7 +660,7 @@ char *NameCreate(char *Name, char *Comment, char *Password)
perror("");
WriteError("Failed to create unix account");
free(progname);
ExitClient(1);
ExitClient(MBERR_GENERAL);
}
sprintf(progname, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
@@ -671,7 +672,7 @@ char *NameCreate(char *Name, char *Comment, char *Password)
perror("");
WriteError("Failed to set unix password");
free(progname);
ExitClient(1);
ExitClient(MBERR_GENERAL);
}
colour(YELLOW, BLACK);

View File

@@ -37,6 +37,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/mberrors.h"
#include "timecheck.h"
#include "funcs.h"
#include "bye.h"
@@ -116,7 +117,7 @@ void TimeCheck(void)
sleep(3);
Syslog('!', "Users time limit exceeded ... user disconnected!");
iExpired = TRUE;
Good_Bye(1);
Good_Bye(MBERR_TIMEOUT);
}
/*

View File

@@ -39,6 +39,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "timeout.h"
#include "user.h"
#include "dispfile.h"
@@ -195,7 +196,7 @@ void user()
*/
WriteError("$Can't open %s", temp);
printf("Can't open userfile, run \"newuser\" first");
ExitClient(0);
ExitClient(MBERR_OK);
}
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
@@ -215,7 +216,7 @@ void user()
printf("%s\n", (char *) Language(390));
Syslog('?', "FATAL: Could not find user in BBS users file.");
Syslog('?', " and system is using unix accounts\n");
ExitClient(0);
ExitClient(MBERR_OK);
}
/*
@@ -411,7 +412,7 @@ void user()
* A copy of the userrecord is also in the variable exitinfo.
*/
if (! InitExitinfo())
Good_Bye(1);
Good_Bye(MBERR_INIT_ERROR);
GetLastUser();
StartTime = xstrcpy(GetLocalHM());