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

@ -8,6 +8,8 @@ v0.35.05 19-Oct-2002
general:
This may become release 0.36.00
There is now a mberrors.h file that defines all errorcodes
returned by all programs.

View File

@ -33,7 +33,7 @@ DIESEL_OBJS = diesel.o mbdiesel.o
MEMWATCH_SRCS = memwatch.c
MEMWATCH_OBJS = memwatch.o
MEMWATCH_HDRS = memwatch.h
OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h
OTHER_HDRS = ansi.h bluewave.h libs.h mbse.h records.h structs.h users.h mberrors.h
SRCS = ${CLCOMM_SRCS} ${COMMON_SRCS} ${DBASE_SRCS} ${MSGBASE_SRCS} ${MBINET_SRCS} \
${DIESEL_SRCS} ${MEMWATCH_SRCS}
OBJS = ${CLCOMM_OBJS} ${COMMON_OBJS} ${DBASE_OBJS} ${MSGBASE_OBJS} ${MBINET_OBJS} \
@ -115,7 +115,7 @@ depend: ftscprod.c
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
clcomm.o: ../config.h libs.h memwatch.h clcomm.h
clcomm.o: ../config.h libs.h memwatch.h mberrors.h clcomm.h
client.o: ../config.h libs.h memwatch.h clcomm.h
crc.o: ../config.h libs.h memwatch.h clcomm.h
semafore.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
@ -139,11 +139,11 @@ dostran.o: ../config.h libs.h memwatch.h structs.h users.h records.h common.h
ftnmsg.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
mbfile.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
nodelock.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
rawio.o: ../config.h libs.h memwatch.h structs.h common.h
rawio.o: ../config.h libs.h memwatch.h structs.h common.h mberrors.h
strcasestr.o: ../config.h libs.h memwatch.h
charconv_hz.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
execute.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
expipe.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
execute.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h
expipe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h common.h
getheader.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h
mime.o: ../config.h libs.h memwatch.h structs.h clcomm.h common.h
noderecord.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h dbnode.h common.h
@ -155,8 +155,8 @@ gmtoffset.o: ../config.h libs.h memwatch.h structs.h common.h
packet.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h common.h dbnode.h
rfcdate.o: ../config.h libs.h memwatch.h structs.h common.h clcomm.h
term.o: ../config.h libs.h memwatch.h structs.h users.h ansi.h records.h common.h
dbcfg.o: ../config.h libs.h memwatch.h mbse.h structs.h users.h records.h dbcfg.h
dbdupe.o: ../config.h libs.h memwatch.h structs.h clcomm.h dbdupe.h
dbcfg.o: ../config.h libs.h memwatch.h mbse.h structs.h users.h records.h mberrors.h dbcfg.h
dbdupe.o: ../config.h libs.h memwatch.h structs.h clcomm.h mberrors.h dbdupe.h
dbftn.o: ../config.h libs.h memwatch.h structs.h users.h records.h dbcfg.h dbftn.h
dbmsgs.o: ../config.h libs.h memwatch.h structs.h users.h records.h clcomm.h dbcfg.h dbmsgs.h
dbnode.o: ../config.h libs.h memwatch.h structs.h common.h users.h records.h clcomm.h dbcfg.h dbnode.h

View File

@ -31,6 +31,7 @@
#include "../config.h"
#include "libs.h"
#include "memwatch.h"
#include "mberrors.h"
#include "clcomm.h"
@ -106,7 +107,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
printf("Could not get the MBSE_ROOT environment variable\n");
printf("Please set the environment variable ie:\n");
printf("\"MBSE_ROOT=/opt/mbse; export MBSE_ROOT\"\n\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
sprintf(progname, "%s", myname);
@ -125,7 +126,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
mypid = getpid();
if (socket_connect(user, myname, where) == -1) {
printf("PANIC: cannot access socket\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
}

View File

@ -35,6 +35,7 @@
#include "structs.h"
#include "users.h"
#include "records.h"
#include "mberrors.h"
#include "dbcfg.h"
@ -46,7 +47,7 @@ void InitConfig(void)
printf("Could not get MBSE_ROOT environment variable\n");
printf("Please set the environment variable ie:\n");
printf("\"MBSE_ROOT=/opt/mbse;export MBSE_ROOT\"\n\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
LoadConfig();
}
@ -69,7 +70,7 @@ void LoadConfig(void)
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
exit(MBERR_CONFIG_ERROR);
}
free(FileName);

View File

@ -33,9 +33,11 @@
#include "memwatch.h"
#include "structs.h"
#include "clcomm.h"
#include "mberrors.h"
#include "dbdupe.h"
typedef struct _dupesrec {
unsigned long *crcs;
int loaded;
@ -85,7 +87,7 @@ int CheckDupe(unsigned long crc, int idx, int max)
if ((fil = fopen(dfile, "w")) == NULL) {
WriteError("$PANIC: dbdupe.c, can't create %s", dfile);
free(dfile);
exit(1);
exit(MBERR_INIT_ERROR);
}
fclose(fil);
fil = fopen(dfile, "r+");

View File

@ -1,11 +1,10 @@
/*****************************************************************************
*
* File ..................: execute.c
* $Id$
* Purpose ...............: Execute subprogram
* Last modification date : 16-Feb-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2002
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -34,6 +33,7 @@
#include "memwatch.h"
#include "structs.h"
#include "clcomm.h"
#include "mberrors.h"
#include "common.h"
@ -45,8 +45,7 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
{
char buf[512];
char *vector[16];
int i;
int pid, status, rc;
int i, pid, status, rc;
if (pkt == NULL)
sprintf(buf, "%s %s", cmd, file);
@ -66,21 +65,21 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
close(0);
if (open(in,O_RDONLY) != 0) {
WriteError("$Reopen of stdin to %s failed", MBSE_SS(in));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
if (out) {
close(1);
if (open(out,O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
WriteError("$Reopen of stdout to %s failed", MBSE_SS(out));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
if (err) {
close(2);
if (open(err,O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
WriteError("$Reopen of stderr to %s failed", MBSE_SS(err));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
errno = 0;
@ -93,7 +92,7 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
rc = execv(vector[0],vector);
WriteError("$execv \"%s\" returned %d", MBSE_SS(vector[0]), rc);
setpriority(PRIO_PROCESS, 0, 0);
exit(-1);
exit(MBERR_EXEC_FAILED);
}
e_pid = pid;
@ -107,7 +106,7 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
switch (rc) {
case -1:
WriteError("$Wait returned %d, status %d,%d", rc,status>>8,status&0xff);
return -1;
return MBERR_EXEC_FAILED;
case 0:
return 0;
default:
@ -115,7 +114,7 @@ int execute(char *cmd, char *file, char *pkt, char *in, char *out, char *err)
rc = WEXITSTATUS(status);
if (rc) {
WriteError("Execute: returned error %d", rc);
return rc;
return (rc + MBERR_EXTERNAL);
}
}
if (WIFSIGNALED(status)) {
@ -147,27 +146,27 @@ int execsh(char *cmd, char *in, char *out, char *err)
close(0);
if (open(in, O_RDONLY) != 0) {
WriteError("$Reopen of stdin to %s failed",MBSE_SS(in));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
if (out) {
close(1);
if (open(out, O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
WriteError("$Reopen of stdout to %s failed",MBSE_SS(out));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
if (err) {
close(2);
if (open(err, O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
WriteError("$Reopen of stderr to %s failed",MBSE_SS(err));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
}
rc = execl(SHELL, "sh", "-c", cmd, NULL);
WriteError("$execl \"%s\" returned %d", MBSE_SS(cmd), rc);
exit(-1);
exit(MBERR_EXEC_FAILED);
}
e_pid = pid;
@ -183,7 +182,7 @@ int execsh(char *cmd, char *in, char *out, char *err)
while (((rc > 0) && (rc != pid)) || ((rc == -1) && (sverr == EINTR)));
if (rc == -1) {
WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
return -1;
return MBERR_EXEC_FAILED;
}
return status;

View File

@ -33,6 +33,7 @@
#include "memwatch.h"
#include "structs.h"
#include "clcomm.h"
#include "mberrors.h"
#include "common.h"
@ -50,13 +51,9 @@ static struct _fppid {
FILE *expipe(char *cmd, char *from, char *to)
{
char buf[256], *buflimit;
char *vector[16];
int i, rc;
char *p, *q, *f=from, *t=to;
int pipedes[2];
char buf[256], *buflimit, *vector[16], *p, *q, *f=from, *t=to;
FILE *fp;
int pid, slot;
int i, rc, pid, slot, pipedes[2];
buflimit = buf + sizeof(buf) -1 - (f&&t&&(strlen(f)>strlen(t))?strlen(f):t?strlen(t):0);
@ -119,11 +116,11 @@ FILE *expipe(char *cmd, char *from, char *to)
close(0);
if (dup(pipedes[0]) != 0) {
WriteError("$Reopen of stdin for command %s failed", MBSE_SS(vector[0]));
exit(-1);
exit(MBERR_EXEC_FAILED);
}
rc = execv(vector[0],vector);
WriteError("$Exec \"%s\" returned %d", MBSE_SS(vector[0]), rc);
exit(-1);
exit(MBERR_EXEC_FAILED);
}
close(pipedes[0]);
@ -141,8 +138,7 @@ FILE *expipe(char *cmd, char *from, char *to)
int exclose(FILE *fp)
{
int status, rc;
int pid, slot, sverr;
int status, rc, pid, slot, sverr;
for (slot = 0; slot <= maxfppid; slot++) {
if (fppid[slot].fp == fp)
@ -172,14 +168,14 @@ int exclose(FILE *fp)
switch (rc) {
case -1:WriteError("$Wait returned %d, status %d,%d", rc, status >> 8, status & 0xff);
return -1;
return MBERR_EXEC_FAILED;
case 0: return 0;
default:
if (WIFEXITED(status)) {
rc = WEXITSTATUS(status);
if (rc) {
WriteError("Expipe: returned error %d", rc);
return rc;
return (rc + MBERR_EXTERNAL);
}
}
if (WIFSIGNALED(status)) {

47
lib/mberrors.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef _MBERRORS_H
#define _MBERRORS_H
/* $Id$ */
/*
* Exit status values
*/
#define MBERR_OK 0 /* No errors */
#define MBERR_COMMANDLINE 100 /* Commandline error */
#define MBERR_CONFIG_ERROR 101 /* Configuration error */
#define MBERR_INIT_ERROR 102 /* Initialisation error */
#define MBERR_DISK_FULL 103 /* Some disk partition full */
#define MBERR_UPS_ALARM 104 /* UPS alarm detected */
#define MBERR_NO_RECIPIENTS 105 /* No valid recipients */
#define MBERR_EXEC_FAILED 106 /* Execute external prog failed */
#define MBERR_TTYIO_ERROR 107 /* Set tty failed */
#define MBERR_FTRANSFER 108 /* File transfer error */
#define MBERR_ATTACH_FAILED 109 /* File attach failed */
#define MBERR_NO_PROGLOCK 110 /* Cannot lock program, retry later */
#define MBERR_NODE_NOT_IN_LIST 111 /* Node not in nodelist */
#define MBERR_NODE_MAY_NOT_CALL 112 /* Node may not be called */
#define MBERR_NO_CONNECTION 113 /* Cannot make connection */
#define MBERR_PORTERROR 114 /* Cannot open tty port */
#define MBERR_NODE_LOCKED 115 /* Node is locked */
#define MBERR_NO_IP_ADDRESS 116 /* Node IP address not found */
#define MBERR_UNKNOWN_SESSION 117 /* Unknown session */
#define MBERR_NOT_ZMH 118 /* Not Zone Mail Hour */
#define MBERR_MODEM_ERROR 119 /* Modem error */
#define MBERR_NO_PORT_AVAILABLE 120 /* No modemport available */
#define MBERR_SESSION_ERROR 121 /* Session error (password) */
#define MBERR_EMSI 122 /* EMSI session error */
#define MBERR_FTSC 123 /* FTSC session error */
#define MBERR_WAZOO 124 /* WAZOO session error */
#define MBERR_YOOHOO 125 /* YOOHOO session error */
#define MBERR_OUTBOUND_SCAN 126 /* Outbound scan error */
#define MBERR_CANNOT_MAKE_POLL 127 /* Cannot make poll */
#define MBERR_REQUEST 128 /* File request error */
#define MBERR_DIFF_ERROR 129 /* Error processing nodediff */
#define MBERR_VIRUS_FOUND 130 /* Virus found */
#define MBERR_GENERAL 131 /* General error */
#define MBERR_TIMEOUT 132 /* Timeout error */
#define MBERR_TTYIO 200 /* Base for ttyio errors */
#define MBERR_MEMWATCH 255 /* Memwatch error */
#define MBERR_EXTERNAL 256 /* Status external prog + 256 */
#endif

View File

@ -33,6 +33,7 @@
#include "memwatch.h"
#include "structs.h"
#include "common.h"
#include "mberrors.h"
int rawset = FALSE;
@ -48,7 +49,7 @@ void Setraw()
if ((rc = tcgetattr(ttyfd, &tbufs))) {
perror("");
printf("$tcgetattr(0, save) return %d\n", rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
tbufsavs = tbufs;
@ -64,7 +65,7 @@ void Setraw()
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
perror("");
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
rawset = TRUE;
@ -86,7 +87,7 @@ void Unsetraw()
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
perror("");
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
}
rawset = FALSE;
@ -104,7 +105,7 @@ unsigned char Getone()
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 8");
exit(1);
exit(MBERR_TTYIO_ERROR);
}
Setraw();

View File

@ -90,15 +90,15 @@ zmmisc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/co
zmrle.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ttyio.h session.h zmodem.h
zmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h
zmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h
binkp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h
binkp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h
xmsend.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h
xmrecv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h
m7recv.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h
m7send.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h
hydra.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h
answer.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/dbnode.h lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h
hydra.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h
answer.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/dbnode.h ../lib/mberrors.h lutil.h session.h config.h answer.h openport.h portsel.h dial.h rdoptions.h mbcico.h
chat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h config.h chat.h ttyio.h
dial.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/dbnode.h config.h chat.h ttyio.h session.h dial.h
dial.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/dbnode.h ../lib/mberrors.h config.h chat.h ttyio.h session.h dial.h
dietifna.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
emsidat.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/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h
filelist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h config.h session.h filelist.h
@ -106,27 +106,27 @@ openfile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/
openport.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h
opentcp.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/dbnode.h session.h ttyio.h openport.h opentcp.h
rdoptions.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/dbnode.h session.h config.h
yoohoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/dbnode.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h
yoohoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h
recvbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h
respfreq.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h
sendbark.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h
tcp.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h
tcpproto.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h
wazoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h
tcpproto.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h
wazoo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h wazoo.h zmodem.h
filetime.o: ../config.h ../lib/libs.h ../lib/memwatch.h filetime.h
ftsc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h
ftsc.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/mberrors.h session.h ttyio.h statetbl.h config.h ftsc.h rdoptions.h recvbark.h filelist.h sendbark.h respfreq.h xmrecv.h xmsend.h
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
portsel.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h portsel.h
ttyio.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h lutil.h
lutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h lutil.h
scanout.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/dbftn.h config.h scanout.h lutil.h
emsi.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h
emsi.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ../lib/mberrors.h ttyio.h session.h statetbl.h config.h emsi.h emsidat.h hydra.h rdoptions.h tcp.h wazoo.h
ulock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h
callstat.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h callstat.h
session.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h
call.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/dbnode.h session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h
mbcico.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/dbnode.h ../lib/dbftn.h config.h answer.h call.h lutil.h mbcico.h session.h
outstat.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/dbnode.h ../lib/dbftn.h scanout.h callstat.h outstat.h
session.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/mberrors.h ttyio.h statetbl.h emsi.h ftsc.h session.h yoohoo.h mbcico.h binkp.h callstat.h
call.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/dbnode.h ../lib/mberrors.h session.h callstat.h call.h config.h dial.h lutil.h portsel.h openport.h opentcp.h rdoptions.h
mbcico.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/dbnode.h ../lib/dbftn.h ../lib/mberrors.h config.h answer.h call.h lutil.h mbcico.h session.h
outstat.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/dbnode.h ../lib/dbftn.h ../lib/mberrors.h scanout.h callstat.h outstat.h
nlinfo.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h nlinfo.h
mbout.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/dbnode.h ../lib/dbftn.h outstat.h nlinfo.h
mbout.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/dbnode.h ../lib/dbftn.h ../lib/mberrors.h outstat.h nlinfo.h
# End of generated dependencies

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbnode.h"
#include "../lib/mberrors.h"
#include "lutil.h"
#include "session.h"
#include "config.h"
@ -89,7 +90,7 @@ int answer(char *stype)
if ((nlent = getnlent(NULL)) == NULL) {
WriteError("could not get dummy nodelist entry");
return 1;
return MBERR_NODE_NOT_IN_LIST;
}
c_start = time(NULL);
@ -153,6 +154,7 @@ int answer(char *stype)
fclose(fp);
}
free(p);
if (Loaded) {
nodes.LastDate = time(NULL);
UpdateNode();

View File

@ -38,6 +38,7 @@
#include "../lib/common.h"
#include "../lib/dbnode.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "ttyio.h"
#include "session.h"
#include "statetbl.h"
@ -95,7 +96,7 @@ int batchnr = 0, crc_errors = 0;
int binkp(int role)
{
int rc = 0;
int rc = MBERR_OK;
fa_list *eff_remote;
file_list *tosend = NULL, *request = NULL, *respond = NULL, *tmpfl;
char *nonhold_mail;
@ -103,12 +104,12 @@ int binkp(int role)
if (role == 1) {
Syslog('+', "BINKP start outbound session");
if (orgbinkp()) {
rc = 5;
rc = MBERR_FTRANSFER;
}
} else {
Syslog('+', "BINKP start inbound session");
if (ansbinkp()) {
rc = 5;
rc = MBERR_FTRANSFER;
}
}
@ -854,7 +855,7 @@ int binkp_batch(file_list *to_send, int role)
RxState = RxDone;
TxState = TxDone;
binkp_send_control(MM_ERR, "Transfer timeout");
rc = -2;
rc = MBERR_FTRANSFER;
break;
}
@ -876,7 +877,7 @@ int binkp_batch(file_list *to_send, int role)
Syslog('?', "Binkp: receiver status %s", ttystat[c]);
TxState = TxDone;
RxState = RxDone;
rc = -c;
rc = (MBERR_TTYIO + (-c));
break;
} else {
switch (rxlen) {
@ -1056,13 +1057,13 @@ int binkp_batch(file_list *to_send, int role)
case MM_ERR: Syslog('+', "Binkp: got ERR: %s", rxbuf+1);
RxState = RxDone;
TxState = TxDone;
rc = -10;
rc = MBERR_FTRANSFER;
break;
case MM_BSY: Syslog('+', "Binkp: got BSY: %s", rxbuf+1);
RxState = RxDone;
TxState = TxDone;
rc = -11;
rc = MBERR_FTRANSFER;
break;
case MM_SKIP: Syslog('+', "Binkp: got SKIP: %s", rxbuf+1);
@ -1151,7 +1152,7 @@ int binkp_batch(file_list *to_send, int role)
WriteError("File CRC error nr %d, aborting session", crc_errors);
binkp_send_control(MM_ERR, "Too much CRC errors, aborting session");
RxState = RxDone;
rc = -12;
rc = MBERR_FTRANSFER;
}
closefile(FALSE);
}
@ -1205,7 +1206,7 @@ int binkp_batch(file_list *to_send, int role)
binkp_send_control(MM_BSY, "Low diskspace, try again later");
RxState = RxDone;
TxState = TxDone;
rc = -13;
rc = MBERR_FTRANSFER;
break;
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbnode.h"
#include "../lib/mberrors.h"
#include "session.h"
#include "callstat.h"
#include "call.h"
@ -68,10 +69,10 @@ int portopen(faddr *addr)
if ((rc = opentcp(inetaddr))) {
Syslog('+', "Cannot connect %s", inetaddr);
nodeulock(addr);
putstatus(addr,1,ST_NOCONN);
return ST_NOCONN;
putstatus(addr,1,MBERR_NO_CONNECTION);
return MBERR_NO_CONNECTION;
}
return 0;
return MBERR_OK;
}
if (forcedline) {
@ -83,19 +84,19 @@ int portopen(faddr *addr)
if ((rc = openport(p, ttyinfo.portspeed))) {
Syslog('+', "Cannot open port %s",p);
nodeulock(addr);
putstatus(addr, 10, ST_PORTERR);
return ST_PORTERR;
putstatus(addr, 10, MBERR_PORTERROR);
return MBERR_PORTERROR;
}
return ST_PORTOK;
return MBERR_OK;
} else {
nodeulock(addr);
putstatus(addr, 0, ST_PORTERR);
return ST_PORTERR;
putstatus(addr, 0, MBERR_PORTERROR);
return MBERR_PORTERROR;
}
}
WriteError("No call method available, maybe missing parameters");
return ST_PORTERR;
return MBERR_NO_CONNECTION;
}
@ -116,15 +117,15 @@ int call(faddr *addr)
*/
if (nodelock(addr)) {
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
putstatus(addr, 0, ST_LOCKED);
return ST_LOCKED;
putstatus(addr, 0, MBERR_NODE_LOCKED);
return MBERR_NODE_LOCKED;
}
if ((nlent = getnlent(addr)) == NULL) {
WriteError("Cannot call %s: fatal in nodelist lookup", ascfnode(addr, 0x1f));
putstatus(addr,0,ST_LOOKUP);
putstatus(addr,0,MBERR_NODE_NOT_IN_LIST);
nodeulock(addr);
return ST_LOOKUP;
return MBERR_NODE_NOT_IN_LIST;
}
/*
@ -215,7 +216,7 @@ int call(faddr *addr)
}
} else {
WriteError("No IP address, abort call");
rc = ST_NOCALL8;
rc = MBERR_NO_IP_ADDRESS;
putstatus(addr, 10, rc);
nodeulock(addr);
return rc;
@ -244,15 +245,14 @@ int call(faddr *addr)
IsDoing("Call %s", ascfnode(addr, 0x0f));
rc = portopen(addr);
if ((rc == 0) && (!inetaddr)) {
if ((rc == MBERR_OK) && (!inetaddr)) {
if ((rc = dialphone(forcedphone?forcedphone:nlent->phone))) {
Syslog('+', "Dial failed");
nodeulock(addr);
rc+=1; /* rc=2 - dial fail, rc=3 - could not reset */
}
}
if (rc == 0) {
if (rc == MBERR_OK) {
if (!inetaddr)
nolocalport();
@ -260,9 +260,6 @@ int call(faddr *addr)
rc = session(addr,nlent,SESSION_MASTER,SESSION_BINKP,NULL);
else
rc = session(addr,nlent,SESSION_MASTER,SESSION_UNKNOWN,NULL);
if (rc)
rc=abs(rc)+10;
}
IsDoing("Disconnect");
@ -285,18 +282,15 @@ int call(faddr *addr)
} else {
IsDoing("NoCall");
Syslog('+', "Cannot call %s (%s, phone %s)", ascfnode(addr,0x1f),MBSE_SS(nlent->name), MBSE_SS(nlent->phone));
if ((nlent->phone || forcedphone || inetaddr ))
rc=ST_NOCALL8;
else
rc=ST_NOCALL7;
rc = MBERR_NO_CONNECTION;
putstatus(addr, 10, rc);
nodeulock(addr);
return rc;
}
if ((rc > 10) && (rc < 20)) /* Session error */
if ((rc == MBERR_NOT_ZMH) || (rc == MBERR_UNKNOWN_SESSION)) /* Session error */
putstatus(addr, 5, rc);
else if ((rc == 2) || (rc == 30))
else if ((rc == MBERR_NO_CONNECTION) || (rc == MBERR_SESSION_ERROR))
putstatus(addr,1,rc);
else
putstatus(addr,0,rc);

View File

@ -72,6 +72,7 @@ void putstatus(faddr *addr, int incr, int sts)
} else {
cst->tryno += incr;
srand(getpid());
Syslog('d', "putstatus %s, incr=%d, tryno=%d, status=%d", ascfnode(addr, 0xf), incr, cst->tryno, sts);
while (TRUE) {
j = 1+(int) (1.0 * CFG.dialdelay * rand() / (RAND_MAX + 1.0));
if ((j > (CFG.dialdelay / 10)) && (j > 9))

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbnode.h"
#include "../lib/mberrors.h"
#include "config.h"
#include "chat.h"
#include "ttyio.h"
@ -62,9 +63,9 @@ int initmodem(void)
if (strlen(modem.init[i]))
if (chat(modem.init[i], CFG.timeoutreset, FALSE, NULL)) {
WriteError("dial: could not reset the modem");
return 1;
return MBERR_MODEM_ERROR;
}
return 0;
return MBERR_OK;
}
@ -77,7 +78,7 @@ int dialphone(char *Phone)
carrier = FALSE;
if (initmodem())
return 2;
return MBERR_MODEM_ERROR;
rc = 0;
if (strlen(nodes.phone[0])) {
@ -100,11 +101,11 @@ int dialphone(char *Phone)
if (rc) {
Syslog('+', "Could not connect to the remote");
return 1;
return MBERR_NO_CONNECTION;
} else {
c_start = time(NULL);
carrier = TRUE;
return 0;
return MBERR_OK;
}
}
@ -147,7 +148,7 @@ int hangup()
}
FLUSHIN();
FLUSHOUT();
return 0;
return MBERR_OK;
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/dbnode.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "ttyio.h"
#include "session.h"
#include "statetbl.h"
@ -105,7 +106,7 @@ int rx_emsi(char *data)
caller=0;
if ((rc=rxemsi()))
return rc;
return MBERR_EMSI;
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
Syslog('i', "remote lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_remote_lcodes,emsi_remote_protos,emsi_remote_opts);
@ -179,7 +180,7 @@ int rx_emsi(char *data)
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
if ((rc=txemsi()))
return rc;
return MBERR_EMSI;
if (denypw || (emsi_local_protos == 0)) {
Syslog('+', "Refusing remote: %s", emsi_local_protos?"bad password presented": "no common protocols");
@ -243,10 +244,10 @@ int tx_emsi(char *data)
Syslog('i', "local lcodes 0x%04x, protos 0x%04x, opts 0x%04x", emsi_local_lcodes,emsi_local_protos,emsi_local_opts);
if ((rc=txemsi()))
return rc;
return MBERR_EMSI;
else {
if ((rc=rxemsi()))
return rc;
return MBERR_EMSI;
}
if ((emsi_remote_opts & OPT_EII) == 0) {

View File

@ -36,6 +36,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "session.h"
#include "ttyio.h"
#include "statetbl.h"
@ -78,7 +79,10 @@ int rx_ftsc(void)
tidy_filelist(tosend, (rc == 0));
tosend = NULL;
return rc;
if (rc)
return MBERR_FTSC;
else
return 0;
}
@ -101,7 +105,10 @@ int tx_ftsc(void)
tidy_filelist(tosend, (rc == 0));
tosend = NULL;
return rc;
if (rc)
return MBERR_FTSC;
else
return 0;
}

View File

@ -47,6 +47,7 @@
#include "../lib/structs.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "session.h"
#include "filelist.h"
#include "filetime.h"
@ -278,7 +279,7 @@ enum HyPktTypes hyrxpkt(char *rxbuf, int *rxlen, int tot)
if ((i & ~0x0f) || (n & ~ 0x0f)) {
Syslog('+', "Hydra: RXPKT assert");
die(1);
die(MBERR_FTRANSFER);
break;
}
@ -295,7 +296,7 @@ enum HyPktTypes hyrxpkt(char *rxbuf, int *rxlen, int tot)
case HCHR_UUEPKT:
default:
Syslog('+', "Hydra: RXPKT assert");
die(1);
die(MBERR_FTRANSFER);
}
if ((format != HCHR_HEXPKT) && (rxoptions & HOPT_CRC32)) {
@ -449,7 +450,7 @@ void hytxpkt(enum HyPktTypes pkttype, char *txbuf, int txlen)
case HCHR_UUEPKT:
default:
Syslog('+', "Hydra: TXPKT assert");
die(1);
die(MBERR_FTRANSFER);
}
*outbuf++ = H_DLE;
@ -1196,7 +1197,7 @@ int hydra_batch(int role, file_list *to_send)
break;
default:
die(1);
die(MBERR_FTRANSFER);
} /* switch (txstate) */
switch (rxstate) {
@ -1586,10 +1587,10 @@ int hydra_batch(int role, file_list *to_send)
sleep(4); /* wait a few seconds... */
FLUSHIN();
return 2;
return MBERR_FTRANSFER;
}
return 0;
return MBERR_OK;
}

View File

@ -39,6 +39,7 @@
#include "../lib/dbcfg.h"
#include "../lib/dbnode.h"
#include "../lib/dbftn.h"
#include "../lib/mberrors.h"
#include "config.h"
#include "answer.h"
#include "call.h"
@ -182,7 +183,7 @@ int main(int argc, char *argv[])
#ifdef MEMWATCH
mwTerm();
#endif
exit(101);
exit(MBERR_COMMANDLINE);
}
InitConfig();
@ -254,7 +255,7 @@ int main(int argc, char *argv[])
tcp_mode = TCPMODE_IBN;
else {
usage();
die(101);
die(MBERR_COMMANDLINE);
}
free(p);
RegTCP();
@ -267,7 +268,7 @@ int main(int argc, char *argv[])
break;
default: usage();
die(101);
die(MBERR_COMMANDLINE);
}
/*
@ -305,7 +306,7 @@ int main(int argc, char *argv[])
#ifdef MEMWATCH
mwTerm();
#endif
exit(100);
exit(MBERROR_EXEC_FAILED);
}
#endif
if ((strcasecmp(argv[optind],"tsync") == 0) ||
@ -364,11 +365,11 @@ int main(int argc, char *argv[])
* Don't do outbound calls if low diskspace
*/
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (callist == NULL) {
WriteError("Calling mbcico without node address not supported anymore");
die(101);
die(MBERR_COMMANDLINE);
}
for (tmpl = &callist; *tmpl; tmpl = &((*tmpl)->next)) {
@ -401,9 +402,9 @@ int main(int argc, char *argv[])
tidy_falist(&callist);
if (maxrc)
die(maxrc+100);
die(maxrc);
else
die(0);
die(MBERR_OK);
return 0;
}

View File

@ -39,6 +39,7 @@
#include "../lib/dbcfg.h"
#include "../lib/dbnode.h"
#include "../lib/dbftn.h"
#include "../lib/mberrors.h"
#include "outstat.h"
#include "nlinfo.h"
@ -147,13 +148,13 @@ void Help()
colour(3, 0);
printf(" -quiet Quiet mode\n");
colour(7, 0);
die(0);
die(MBERR_OK);
}
void Fatal(char *);
void Fatal(char *msg)
void Fatal(char *, int);
void Fatal(char *msg, int error)
{
show_log = TRUE;
if (!do_quiet) {
@ -161,7 +162,7 @@ void Fatal(char *msg)
printf("%s\n", msg);
}
WriteError(msg);
die(100);
die(error);
}
@ -243,12 +244,10 @@ int main(int argc, char *argv[])
}
if (strcmp(pw->pw_name, "mbse"))
Fatal((char *)"You are not user 'mbse'");
Fatal((char *)"You are not user 'mbse'", MBERR_COMMANDLINE);
if (do_stat) {
rc = outstat();
if (rc)
rc += 100;
die(rc);
}
@ -257,19 +256,17 @@ int main(int argc, char *argv[])
*/
if (do_attach || do_node || do_poll || do_stop || do_req || do_reset) {
if (argc < 3)
Fatal((char *)"Not enough parameters");
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
}
if (do_attach || do_node || do_req || do_reset) {
if ((addr = parsefaddr(argv[2])) == NULL)
Fatal((char *)"Unrecognizable address");
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
}
if (do_node) {
rc = nlinfo(addr);
tidy_faddr(addr);
if (rc)
rc += 100;
die(rc);
}
@ -277,15 +274,13 @@ int main(int argc, char *argv[])
for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL)
Fatal((char *)"Unrecognizable address");
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
j = poll(addr, do_stop);
tidy_faddr(addr);
if (j > rc)
if (j)
rc = j;
}
}
if (rc)
rc = 100;
die(rc);
}
@ -293,50 +288,48 @@ int main(int argc, char *argv[])
for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL)
Fatal((char *)"Unrecognizable address");
Fatal((char *)"Unrecognizable address", MBERR_COMMANDLINE);
j = reset(addr);
tidy_faddr(addr);
if (j > rc)
if (j)
rc = j;
}
}
if (rc)
rc = 100;
die(rc);
}
if (do_attach) {
if (argc < 5)
Fatal((char *)"Not enough parameters");
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
flavor = tolower(argv[3][0]);
switch (flavor) {
case 'n' : flavor = 'f'; break;
case 'i' : flavor = 'i'; break;
case 'c' : flavor = 'c'; break;
case 'h' : flavor = 'h'; break;
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold");
default : Fatal((char *)"Invalid flavor, must be: immediate, crash, normal or hold", MBERR_COMMANDLINE);
}
nlent = getnlent(addr);
if (nlent->pflag == NL_DUMMY)
Fatal((char *)"Node is not in nodelist");
Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST);
if (nlent->pflag == NL_DOWN)
Fatal((char *)"Node has status Down");
Fatal((char *)"Node has status Down", MBERR_NODE_MAY_NOT_CALL);
if (nlent->pflag == NL_HOLD)
Fatal((char *)"Node has status Hold");
Fatal((char *)"Node has status Hold", MBERR_NODE_MAY_NOT_CALL);
if (((nlent->oflags & OL_CM) == 0) && (flavor == 'c'))
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor");
Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor", MBERR_NODE_MAY_NOT_CALL);
if (argv[4][0] == '-')
Fatal((char *)"Invalid filename given");
Fatal((char *)"Invalid filename given", MBERR_COMMANDLINE);
if (file_exist(argv[4], R_OK) != 0)
Fatal((char *)"File doesn't exist");
Fatal((char *)"File doesn't exist", MBERR_COMMANDLINE);
cmd = calloc(PATH_MAX, sizeof(char));
sprintf(cmd, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, addr->zone, addr->net, addr->node, addr->point);
mkdirs(cmd, 0750);
if ((fl = fopen(cmd, "a+")) == NULL) {
Fatal((char *)"File attach failed");
Fatal((char *)"File attach failed", MBERR_ATTACH_FAILED);
} else {
fprintf(fl, "%c LEAVE %s\n", flavor, argv[4]);
Syslog('+', "File attach %s is successfull", argv[4]);
@ -347,14 +340,14 @@ int main(int argc, char *argv[])
fsync(fileno(fl));
fclose(fl);
free(cmd);
die(0);
die(MBERR_OK);
}
free(cmd);
}
if (do_req) {
if (argc < 4)
Fatal((char *)"Not enough parameters");
Fatal((char *)"Not enough parameters", MBERR_COMMANDLINE);
for (i = 4; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) {
rc = freq(addr, argv[i-1]);
@ -362,8 +355,6 @@ int main(int argc, char *argv[])
break;
}
}
if (rc)
rc += 100;
die(rc);
}
@ -371,7 +362,7 @@ int main(int argc, char *argv[])
#ifdef MEMWATCH
mwTerm();
#endif
return 0;
return MBERR_OK;
}

View File

@ -39,6 +39,7 @@
#include "../lib/dbcfg.h"
#include "../lib/dbnode.h"
#include "../lib/dbftn.h"
#include "../lib/mberrors.h"
#include "scanout.h"
#include "callstat.h"
#include "outstat.h"
@ -82,7 +83,7 @@ int outstat()
if ((rc = scanout(each))) {
WriteError("Error scanning outbound, aborting");
return rc;
return MBERR_OUTBOUND_SCAN;
}
/*
@ -93,7 +94,7 @@ int outstat()
if ((fp = fopen(temp, "r")) == NULL) {
WriteError("Error open %s, aborting", temp);
free(temp);
return 1;
return MBERR_OUTBOUND_SCAN;
}
fread(&nodeshdr, sizeof(nodeshdr), 1, fp);
fseek(fp, 0, SEEK_SET);
@ -364,24 +365,24 @@ int poll(faddr *addr, int stop)
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
return 1;
return MBERR_NODE_NOT_IN_LIST;
}
if (nlent->pflag == NL_DOWN) {
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Down", ascfnode(addr, 0x1f));
return 1;
return MBERR_NODE_MAY_NOT_CALL;
}
if (nlent->pflag == NL_HOLD) {
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
return 1;
return MBERR_NODE_MAY_NOT_CALL;
}
if ((fp = fopen(pol, "w+")) == NULL) {
WriteError("$Can't create poll for %s", ascfnode(addr, 0x1f));
rc = 1;
rc = MBERR_CANNOT_MAKE_POLL;
} else {
fclose(fp);
if (((nlent->oflags & OL_CM) == 0) && (!IsZMH())) {
@ -394,12 +395,13 @@ int poll(faddr *addr, int stop)
printf("Created poll for %s\n", ascfnode(addr, 0x1f));
}
cst = getstatus(addr);
if ((cst->trystat == 5) ||
(cst->trystat == ST_NOTZMH) ||
(cst->trystat == ST_NOCONN) ||
(cst->trystat == ST_NOCALL7) ||
(cst->trystat == ST_NOCALL8) ||
(cst->trystat > 10)) {
if ((cst->trystat == MBERR_NODE_LOCKED) ||
(cst->trystat == MBERR_NOT_ZMH) ||
(cst->trystat == MBERR_NO_CONNECTION) ||
(cst->trystat == MBERR_SESSION_ERROR) ||
(cst->trystat == MBERR_UNKNOWN_SESSION) ||
(cst->trystat == MBERR_NO_PORT_AVAILABLE) ||
(cst->trystat == MBERR_MODEM_ERROR)) {
putstatus(addr, 0, 0);
}
CreateSema((char *)"scanout");
@ -443,7 +445,7 @@ int freq(faddr *addr, char *fname)
if (!do_quiet)
printf("File request failed\n");
free(req);
return 1;
return MBERR_REQUEST;
}
fprintf(fp, "%s\r\n", fname);
fclose(fp);

View File

@ -36,6 +36,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "ttyio.h"
#include "statetbl.h"
#include "emsi.h"
@ -79,7 +80,7 @@ char *typestr(int tp)
int session(faddr *a, node *nl, int role, int tp, char *dt)
{
int rc = 1;
int rc = MBERR_OK;
fa_list *tmpl;
struct sockaddr_in peeraddr;
int addrlen = sizeof(struct sockaddr_in);
@ -108,7 +109,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
IsDoing("Incoming IFC/TCP");
} else if (tcp_mode == TCPMODE_NONE) {
WriteError("Unknown TCP connection, parameter missing");
die(101);
die(MBERR_COMMANDLINE);
}
}
session_flags |= SESSION_TCP;
@ -147,7 +148,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
if (type == SESSION_UNKNOWN)
(void)tx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc=20; break;
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = tx_ftsc(); break;
case SESSION_YOOHOO: rc = tx_yoohoo(); break;
case SESSION_EMSI: rc = tx_emsi(data); break;
@ -159,7 +160,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
if (type == SESSION_UNKNOWN)
(void)rx_define_type();
switch(type) {
case SESSION_UNKNOWN: rc=20; break;
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = rx_ftsc(); break;
case SESSION_YOOHOO: rc = rx_yoohoo(); break;
case SESSION_EMSI: rc = rx_emsi(data); break;

View File

@ -38,6 +38,7 @@
#include "../lib/structs.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "ttyio.h"
#include "session.h"
#include "config.h"
@ -84,7 +85,7 @@ int tcpsndfiles(file_list *lst)
if (getsync()) {
WriteError("Can't get synchronization");
return 1;
return MBERR_FTRANSFER;
}
for (tmpf = lst; tmpf && (maxrc == 0); tmpf = tmpf->next) {
@ -108,9 +109,11 @@ int tcpsndfiles(file_list *lst)
if (rc > maxrc)
maxrc=rc;
if (rc)
if (rc) {
WriteError("TCP send error: rc=%d",maxrc);
return maxrc;
return MBERR_FTRANSFER;
} else
return 0;
}
@ -124,7 +127,7 @@ int tcprcvfiles(void)
Syslog('+', "Start TCP receive");
if (getsync()) {
WriteError("Can't get synchronization");
return 1;
return MBERR_FTRANSFER;
}
next:
if ((rc = tcp_rblk(rxbuf, &bufl)) == 0) {
@ -155,9 +158,11 @@ next:
goto next;
}
if (rc)
if (rc) {
WriteError("TCP receive error: rc=%d", rc);
return abs(rc);
return MBERR_FTRANSFER;
} else
return 0;
}

View File

@ -34,6 +34,7 @@
#include "../lib/structs.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "ttyio.h"
#include "session.h"
#include "statetbl.h"
@ -85,11 +86,13 @@ int rxwazoo(void)
tidy_filelist(tosend, (rc == 0));
if (rc)
if (rc) {
WriteError("WaZOO session failed: rc=%d", rc);
else
return MBERR_WAZOO;
}
Syslog('+', "WaZOO session completed");
return rc;
return MBERR_OK;
}
@ -120,10 +123,13 @@ int txwazoo(void)
tidy_filelist(tosend,(rc == 0));
tidy_filelist(respond,0);
if (rc)
if (rc) {
WriteError("WaZOO session failed: rc=%d", rc);
else
Syslog('+', "WaZOO session completed");
return rc;
return MBERR_WAZOO;
}
Syslog('+', "WaZOO session completed");
return MBERR_OK;
}

View File

@ -45,6 +45,7 @@
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/dbnode.h"
#include "../lib/mberrors.h"
#include "statetbl.h"
#include "ttyio.h"
#include "session.h"
@ -184,6 +185,7 @@ int rx_yoohoo(void)
}
} else
Syslog('s', "No YooHoo password check");
fillhello(localcaps,pwd);
rc = txyoohoo();
@ -196,7 +198,7 @@ int rx_yoohoo(void)
return 0;
}
if (rc)
return rc;
return MBERR_YOOHOO;
IsDoing("Inbound %s", ascfnode(remote->addr, 0x0f));
@ -211,9 +213,9 @@ int rx_yoohoo(void)
return rxwazoo();
} else if (localcaps & Y_DIETIFNA)
return rxdietifna();
else
WriteError("YooHoo internal error - no proto for 0x%04xh",localcaps);
return 1;
return MBERR_YOOHOO;
}
@ -262,7 +264,7 @@ int tx_yoohoo(void)
}
if (rc)
return rc;
return MBERR_YOOHOO;
IsDoing("Outbound %s", ascfnode(remote->addr, 0x0f));
@ -277,9 +279,9 @@ int tx_yoohoo(void)
return txwazoo();
} else if (capabilities & Y_DIETIFNA)
return txdietifna();
else
WriteError("YooHoo internal error - no proto for 0x%04xh",capabilities);
return 1;
return MBERR_YOOHOO;
}

View File

@ -139,7 +139,7 @@ addbbs.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
backalias.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h backalias.h
flock.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h flock.h
hatch.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/dbtic.h utic.h rollover.h hatch.h
mbdiff.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 mbdiff.h
mbdiff.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 mbdiff.h
mgrutil.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/dbnode.h ../lib/diesel.h sendmail.h rollover.h addpkt.h createm.h createf.h mgrutil.h
ptic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbtic.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbdupe.h unpack.h mover.h toberep.h tic.h utic.h addbbs.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h
sendmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ../lib/dbmsgs.h addpkt.h rollover.h sendmail.h
@ -148,7 +148,7 @@ addpkt.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
bwrite.o: ../config.h ../lib/libs.h ../lib/memwatch.h bwrite.h
forward.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/dbnode.h ../lib/dbtic.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h
lhash.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h lhash.h
mbfido.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/dbdupe.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbuser.h ../lib/dbftn.h ../lib/dbtic.h ../lib/msg.h flock.h tosspkt.h unpack.h tic.h fsort.h scan.h mbfido.h tracker.h notify.h rollover.h hatch.h scannews.h maketags.h makestat.h newspost.h rnews.h mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h
mbfido.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/dbdupe.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbuser.h ../lib/dbftn.h ../lib/dbtic.h ../lib/msg.h ../lib/mberrors.h flock.h tosspkt.h unpack.h tic.h fsort.h scan.h mbfido.h tracker.h notify.h rollover.h hatch.h scannews.h maketags.h makestat.h newspost.h rnews.h mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h
mkftnhdr.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 atoul.h hash.h msgflags.h aliasdb.h mkftnhdr.h
ping.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
rfc2ftn.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h postnetmail.h postecho.h msgflags.h rfc2ftn.h
@ -157,17 +157,17 @@ unpack.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
aliasdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h aliasdb.h
fsort.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h fsort.h
magic.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/dbtic.h tic.h utic.h magic.h
mbfile.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 mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfmove.h mbfdel.h mbfutil.h mbfile.h
mbfile.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 mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfmove.h mbfdel.h mbfutil.h mbfile.h
mover.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h
post.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/msg.h ../lib/msgtext.h post.h
rnews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h rfc2ftn.h mbfido.h ../paths.h rnews.h
rnews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h ../lib/mberrors.h rfc2ftn.h mbfido.h ../paths.h rnews.h
storenet.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/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h msgflags.h rollover.h storenet.h
utic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h tic.h utic.h
announce.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/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
fflist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h ../lib/msg.h fflist.h
ftn2rfc.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h msgflags.h ftn2rfc.h
makestat.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/diesel.h ../lib/msg.h mgrutil.h makestat.h
mbindex.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/dbftn.h mbindex.h
mbindex.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/dbftn.h ../lib/mberrors.h mbindex.h
msgutil.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/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h
postecho.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h
rollover.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
@ -176,7 +176,7 @@ areamgr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
filefind.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/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h
grlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/clcomm.h grlist.h
maketags.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h
mbmsg.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/msg.h ../lib/dbcfg.h post.h mbmsg.h
mbmsg.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/msg.h ../lib/dbcfg.h ../lib/mberrors.h post.h mbmsg.h
newspost.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/mbinet.h newspost.h
postemail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h postemail.h
scan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msg.h ../lib/clcomm.h ../lib/msgtext.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h tracker.h ftn2rfc.h rfc2ftn.h postemail.h scan.h
@ -184,24 +184,24 @@ toberep.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
atoul.o: ../config.h ../lib/libs.h ../lib/memwatch.h atoul.h
filemgr.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ../lib/diesel.h sendmail.h mgrutil.h createf.h filemgr.h
hash.o: ../config.h ../lib/libs.h ../lib/memwatch.h hash.h lhash.h
mbaff.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/msg.h announce.h filefind.h mbaff.h
mbaff.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/msg.h ../lib/mberrors.h announce.h filefind.h mbaff.h
mbseq.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 mbseq.h
notify.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/msg.h ../lib/msgtext.h ../lib/dbnode.h filemgr.h areamgr.h sendmail.h mgrutil.h notify.h
postnetmail.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/common.h ../lib/records.h ../lib/dbcfg.h ../lib/dbuser.h ../lib/dbnode.h ../lib/dbftn.h ../lib/clcomm.h tracker.h addpkt.h storenet.h ftn2rfc.h areamgr.h filemgr.h ping.h bounce.h postemail.h
scannews.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/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h storeecho.h rfc2ftn.h scannews.h
tosspkt.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h
mbfkill.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 mbfkill.h mbfutil.h
mbfutil.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 mbfutil.h mbfile.h
mbfindex.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/diesel.h mbfutil.h mbfindex.h
mbfcheck.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 mbfutil.h mbfcheck.h
mbfpack.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 mbfutil.h mbfpack.h
mbflist.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 mbfutil.h mbflist.h
mbfadopt.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 virscan.h mbfutil.h mbflist.h
mbfimport.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 virscan.h mbfutil.h mbfimport.h
mbfkill.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 mbfkill.h mbfutil.h
mbfutil.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 mbfutil.h mbfile.h
mbfindex.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/diesel.h ../lib/mberrors.h mbfutil.h mbfindex.h
mbfcheck.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 mbfutil.h mbfcheck.h
mbfpack.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 mbfutil.h mbfpack.h
mbflist.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 mbfutil.h mbflist.h
mbfadopt.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 virscan.h mbfutil.h mbflist.h
mbfimport.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 virscan.h mbfutil.h mbfimport.h
virscan.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h virscan.h
mbftoberep.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 mbfutil.h mbftoberep.h
mbfmove.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 mbfutil.h mbfmove.h
mbfdel.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 mbfutil.h mbfmove.h
mbfmove.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 mbfutil.h mbfmove.h
mbfdel.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 mbfutil.h mbfmove.h
bounce.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/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
createm.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/msg.h mgrutil.h createm.h
createf.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mgrutil.h createf.h

View File

@ -38,6 +38,7 @@
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/msg.h"
#include "../lib/mberrors.h"
#include "announce.h"
#include "filefind.h"
#include "mbaff.h"
@ -152,7 +153,7 @@ int main(int argc, char **argv)
printf("\n");
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
memset(&MsgBase, 0, sizeof(MsgBase));
@ -169,7 +170,7 @@ int main(int argc, char **argv)
CreateSema((char *)"msglink");
}
die(0);
die(MBERR_OK);
return 0;
}
@ -193,7 +194,7 @@ void Help(void)
printf(" -q -quiet Quiet mode\n");
colour(7, 0);
printf("\n");
die(0);
die(MBERR_COMMANDLINE);
}

View File

@ -38,6 +38,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbdiff.h"
@ -115,12 +116,9 @@ void die(int onsig)
int main(int argc, char **argv)
{
int i, Match;
char *cmd, *nl = NULL, *nd = NULL, *nn;
int rc;
char *p, *q, *arc;
int i, Match, rc;
char *cmd, *nl = NULL, *nd = NULL, *nn, *p, *q, *arc, *wrk, *onl, *ond;
struct passwd *pw;
char *wrk, *onl, *ond;
DIR *dp;
struct dirent *de;
@ -136,8 +134,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 == SIGINT) || (i == SIGBUS) ||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGKILL))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@ -179,7 +176,7 @@ int main(int argc, char **argv)
}
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
/*
* Extract work directory from the first commandline parameter
@ -190,17 +187,17 @@ int main(int argc, char **argv)
if (strrchr(wrk, '/') == NULL) {
WriteError("No path in nodelist name");
free(wrk);
die(100);
die(MBERR_COMMANDLINE);
}
if (strrchr(wrk, '.') != NULL) {
WriteError("Filename extension given for nodelist");
free(wrk);
die(100);
die(MBERR_COMMANDLINE);
}
if (strrchr(nd, '/') == NULL) {
WriteError("No path in nodediff name");
free(wrk);
die(100);
die(MBERR_COMMANDLINE);
}
show_log = FALSE;
@ -212,13 +209,13 @@ int main(int argc, char **argv)
if (access(wrk, R_OK|W_OK)) {
WriteError("$No R/W access in %s", wrk);
free(wrk);
die(100);
die(MBERR_INIT_ERROR);
}
if (chdir(wrk)) {
WriteError("$Can't chdir to %s", wrk);
free(wrk);
die(100);
die(MBERR_INIT_ERROR);
}
show_log = FALSE;
@ -229,7 +226,7 @@ int main(int argc, char **argv)
show_log = TRUE;
free(wrk);
WriteError("$Error opening directory %s", wrk);
die(100);
die(MBERR_INIT_ERROR);
}
Match = FALSE;
@ -253,7 +250,7 @@ int main(int argc, char **argv)
free(wrk);
free(onl);
WriteError("Old nodelist not found");
die(100);
die(MBERR_INIT_ERROR);
}
/*
@ -264,7 +261,7 @@ int main(int argc, char **argv)
free(onl);
free(wrk);
WriteError("Can't get filetype for %s", nd);
die(100);
die(MBERR_CONFIG_ERROR);
}
ond = xstrcpy(strrchr(nd, '/') + 1);
@ -276,7 +273,7 @@ int main(int argc, char **argv)
free(wrk);
free(ond);
WriteError("Can't find unarchiver %s", arc);
die(100);
die(MBERR_CONFIG_ERROR);
}
/*
@ -295,7 +292,7 @@ int main(int argc, char **argv)
free(wrk);
free(ond);
WriteError("No unarc command available for %s", arc);
die(100);
die(MBERR_CONFIG_ERROR);
}
if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
@ -305,7 +302,7 @@ int main(int argc, char **argv)
free(wrk);
free(ond);
WriteError("Unpack error");
die(100);
die(MBERR_EXEC_FAILED);
}
free(cmd);
sync();
@ -333,7 +330,7 @@ int main(int argc, char **argv)
free(onl);
free(wrk);
WriteError("Could not find extracted file");
die(100);
die(MBERR_DIFF_ERROR);
}
} else {
if ((rc = file_cp(nd, ond))) {
@ -342,13 +339,12 @@ int main(int argc, char **argv)
free(onl);
free(wrk);
WriteError("Copy %s failed, %s", nd, strerror(rc));
die(100);
die(MBERR_DIFF_ERROR);
}
Syslog('s', "Copied %s", nd);
}
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) &&
(strlen(p) == strlen(q))) {
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) && (strlen(p) == strlen(q))) {
nn = xstrcpy(onl);
p = strrchr(nn, '.') + 1;
q++;
@ -364,7 +360,7 @@ int main(int argc, char **argv)
free(onl);
free(wrk);
free(nn);
die(100);
die(MBERR_DIFF_ERROR);
}
Syslog('+', "Apply %s with %s to %s", onl, ond, nn);
@ -381,7 +377,7 @@ int main(int argc, char **argv)
free(ond);
free(onl);
free(wrk);
die(rc + 100);
die(MBERR_DIFF_ERROR);
} else {
unlink(onl);
cmd = xstrcpy(archiver.farc);
@ -395,7 +391,7 @@ int main(int argc, char **argv)
free(onl);
free(wrk);
free(nn);
die(100);
die(MBERR_DIFF_ERROR);
} else {
cmd = xstrcpy(archiver.farc);
}
@ -428,7 +424,7 @@ int main(int argc, char **argv)
free(ond);
free(wrk);
free(nn);
die(0);
die(MBERR_OK);
}
return 0;
}
@ -455,7 +451,7 @@ void Help(void)
printf(" -quiet Quiet mode\n");
colour(7, 0);
printf("\n");
die(99);
die(MBERR_COMMANDLINE);
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "virscan.h"
#include "mbfutil.h"
#include "mbflist.h"
@ -64,7 +65,7 @@ void AdoptFile(int Area, char *File, char *Description)
colour(CYAN, BLACK);
if (LoadAreaRec(Area) == FALSE)
die(0);
die(MBERR_INIT_ERROR);
if (area.Available) {
temp = calloc(PATH_MAX, sizeof(char));
@ -73,7 +74,7 @@ void AdoptFile(int Area, char *File, char *Description)
tmpdir = calloc(PATH_MAX, sizeof(char));
if (CheckFDB(Area, area.Path))
die(0);
die(MBERR_INIT_ERROR);
getcwd(pwd, PATH_MAX);
if (!do_quiet) {
@ -92,7 +93,7 @@ void AdoptFile(int Area, char *File, char *Description)
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
if (!do_quiet)
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
die(0);
die(MBERR_INIT_ERROR);
} else {
if (do_novir == FALSE) {
if (!do_quiet) {
@ -109,7 +110,7 @@ void AdoptFile(int Area, char *File, char *Description)
WriteError("Virus found");
if (!do_quiet)
printf("Virus found\n");
die(0);
die(MBERR_VIRUS_FOUND);
}
}
} else {
@ -118,7 +119,7 @@ void AdoptFile(int Area, char *File, char *Description)
MustRearc = TRUE;
UnPacked = UnpackFile(temp);
if (!UnPacked)
die(0);
die(MBERR_INIT_ERROR);
if (do_novir == FALSE) {
if (!do_quiet) {
@ -136,7 +137,7 @@ void AdoptFile(int Area, char *File, char *Description)
WriteError("Virus found");
if (!do_quiet)
printf("Virus found\n");
die(0);
die(MBERR_VIRUS_FOUND);
}
}
@ -221,7 +222,7 @@ void AdoptFile(int Area, char *File, char *Description)
if (!do_quiet)
printf("No FILE_ID.DIZ and no description on the commandline\n");
DeleteVirusWork();
die(0);
die(MBERR_COMMANDLINE);
} else {
/*
* Create description from the commandline.
@ -279,7 +280,7 @@ void AdoptFile(int Area, char *File, char *Description)
}
if (AddFile(fdb, Area, temp2, File) == FALSE) {
die(0);
die(MBERR_GENERAL);
}
Syslog('+', "File %s added to area %d", File, Area);

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfcheck.h"
@ -65,8 +66,7 @@ extern int do_pack; /* Pack filebase */
void Check(void)
{
FILE *pAreas, *pFile;
int i, iAreas, iAreasNew = 0, Fix, inArea;
int iTotal = 0, iErrors = 0;
int i, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
char *sAreas, *fAreas, *newdir, *temp;
DIR *dp;
struct dirent *de;
@ -90,7 +90,7 @@ void Check(void)
if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas);
die(0);
die(MBERR_INIT_ERROR);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@ -187,7 +187,7 @@ void Check(void)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}
@ -275,8 +275,7 @@ void Check(void)
* Record has been found before, so this must be
* a double record.
*/
Syslog('!', "Double file record area %d file %s",
i, file.LName);
Syslog('!', "Double file record area %d file %s", i, file.LName);
iErrors++;
file.Double = TRUE;
do_pack = TRUE;
@ -285,8 +284,7 @@ void Check(void)
}
}
}
if ((!Found) &&
(strncmp(de->d_name, "files.bbs", 9)) &&
if ((!Found) && (strncmp(de->d_name, "files.bbs", 9)) &&
(strncmp(de->d_name, "files.bak", 9)) &&
(strncmp(de->d_name, "00index", 7)) &&
(strncmp(de->d_name, "header", 6)) &&

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfmove.h"
@ -67,28 +68,28 @@ void Delete(int UnDel, int Area, char *File)
*/
if (LoadAreaRec(Area) == FALSE) {
WriteError("Can't load record %d", Area);
die(0);
die(MBERR_INIT_ERROR);
}
if (!area.Available) {
WriteError("Area %d not available", Area);
if (!do_quiet)
printf("Area %d not available\n", Area);
die(0);
die(MBERR_CONFIG_ERROR);
}
if (area.CDrom) {
WriteError("Can't %sdelete from CD-ROM", UnDel?"un":"");
if (!do_quiet)
printf("Can't %sdelete from CD-ROM\n", UnDel?"un":"");
die(0);
die(MBERR_COMMANDLINE);
}
if (CheckFDB(Area, area.Path))
die(0);
die(MBERR_GENERAL);
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
if ((fp = fopen(temp, "r+")) == NULL)
die(0);
die(MBERR_GENERAL);
colour(CYAN, BLACK);

View File

@ -45,6 +45,7 @@
#include "../lib/dbftn.h"
#include "../lib/dbtic.h"
#include "../lib/msg.h"
#include "../lib/mberrors.h"
#include "flock.h"
#include "tosspkt.h"
#include "unpack.h"
@ -147,7 +148,7 @@ void Help(void)
printf(" -uns -unsecure Toss unsecure\n");
printf(" -unp -unprotect Toss unprotected inbound\n");
colour(LIGHTGRAY, BLACK);
ExitClient(0);
ExitClient(MBERR_COMMANDLINE);
}
@ -189,7 +190,7 @@ void die(int onsig)
system("stty sane");
}
if (onsig != 110)
if (onsig != MBERR_NO_PROGLOCK)
CloseDupes();
/*
@ -244,7 +245,7 @@ void die(int onsig)
* and there should be no lock. We prevent removing the lock of another
* mbfido this way.
*/
if (onsig != 110) {
if (onsig != MBERR_NO_PROGLOCK) {
ulockdir(CFG.inbound);
ulockdir(CFG.pinbound);
ulockdir(CFG.out_queue);
@ -433,10 +434,10 @@ int main(int argc, char **argv)
free(cmd);
/*
* Not yet locked, if anything goes wrong, exit with die(110)
* Not yet locked, if anything goes wrong, exit with die(MBERR_NO_PROGLOCK)
*/
if (!diskfree(CFG.freespace))
die(110);
die(MBERR_DISK_FULL);
if (do_mail) {
/*
@ -458,7 +459,7 @@ int main(int argc, char **argv)
i--;
if (! i) {
WriteError("Lock timeout, aborting");
die(110);
die(MBERR_NO_PROGLOCK);
}
sleep(20);
Nopper();
@ -470,10 +471,10 @@ int main(int argc, char **argv)
*/
if (do_unprot) {
if (! lockdir(CFG.inbound))
die(110);
die(MBERR_NO_PROGLOCK);
} else {
if (! lockdir(CFG.pinbound))
die(110);
die(MBERR_NO_PROGLOCK);
}
}
@ -482,7 +483,7 @@ int main(int argc, char **argv)
*/
if (initnl())
die(101);
die(MBERR_INIT_ERROR);
if (!do_mail && !do_uucp)
Rollover();
if (!do_quiet)
@ -500,13 +501,13 @@ int main(int argc, char **argv)
if (do_mail) {
if (!envrecip_count) {
WriteError("No valid receipients specified, aborting");
die(105);
die(MBERR_NO_RECIPIENTS);
}
umask(066);
if ((ofp = tmpfile()) == NULL) {
WriteError("$Can't open tmpfile for RFC message");
die(104);
die(MBERR_INIT_ERROR);
}
temp = calloc(10240, sizeof(char));
while (fgets(temp, 10240, stdin))
@ -520,7 +521,7 @@ int main(int argc, char **argv)
fclose(ofp);
flush_queue();
die(0);
die(MBERR_OK);
}
InitDupes();
@ -540,7 +541,7 @@ int main(int argc, char **argv)
do {
Hatch();
switch (Tic()) {
case -1: die(0);
case -1: die(MBERR_OK);
break;
case 0: Loop = FALSE;
break;
@ -559,7 +560,7 @@ int main(int argc, char **argv)
if (IsSema((char *)"mailin"))
RemoveSema((char *)"mailin");
if (TossMail() == FALSE)
die(0);
die(MBERR_OK);
}
if (do_tic || do_toss) {
/*
@ -586,7 +587,7 @@ int main(int argc, char **argv)
if (do_flush)
flush_queue();
die(0);
die(MBERR_OK);
return 0;
}
@ -613,7 +614,7 @@ int TossMail(void)
if (chdir(inbound) == -1) {
WriteError("$Can't chdir(%s)", inbound);
die(0);
die(MBERR_INIT_ERROR);
}
/*
@ -629,7 +630,7 @@ int TossMail(void)
*/
if ((dp = opendir(inbound)) == NULL) {
WriteError("$Can't opendir(%s)", inbound);
die(0);
die(MBERR_INIT_ERROR);
}
Syslog('+', "Pass: toss ARCmail (%s)", inbound);
@ -662,7 +663,7 @@ int TossMail(void)
break;
}
if (!diskfree(CFG.freespace)) {
rc = 101;
rc = MBERR_DISK_FULL;
break;
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfkill.h"
#include "mbfadopt.h"
#include "mbfindex.h"
@ -90,8 +91,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 == SIGBUS) || (i == SIGKILL) ||
(i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGKILL) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
signal(i, SIG_IGN);
@ -216,16 +216,16 @@ int main(int argc, char **argv)
printf("\n");
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (do_adopt) {
AdoptFile(Area, FileName, Description);
die(0);
die(MBERR_OK);
}
if (do_import) {
ImportFiles(Area);
die(0);
die(MBERR_OK);
}
if (do_kill)
@ -242,22 +242,22 @@ int main(int argc, char **argv)
if (do_move) {
Move(Area, ToArea, FileName);
die(0);
die(MBERR_OK);
}
if (do_del) {
Delete(UnDel, Area, FileName);
die(0);
die(MBERR_OK);
}
if (do_list) {
ListFileAreas(Area);
die(0);
die(MBERR_OK);
}
if (do_tobe)
ToBeRep();
die(0);
die(MBERR_OK);
return 0;
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "virscan.h"
#include "mbfutil.h"
#include "mbfimport.h"
@ -63,7 +64,7 @@ void ImportFiles(int Area)
colour(CYAN, BLACK);
if (LoadAreaRec(Area) == FALSE)
die(0);
die(MBERR_INIT_ERROR);
if (area.Available && !area.CDrom) {
temp = calloc(PATH_MAX, sizeof(char));
@ -75,7 +76,7 @@ void ImportFiles(int Area)
getcwd(pwd, PATH_MAX);
if (CheckFDB(Area, area.Path))
die(0);
die(MBERR_GENERAL);
sprintf(tmpdir, "%s/tmp/arc", getenv("MBSE_ROOT"));
IsDoing("Import files");
@ -92,7 +93,7 @@ void ImportFiles(int Area)
WriteError("Can't find files.bbs anywhere");
if (!do_quiet)
printf("Can't find files.bbs anywhere\n");
die(0);
die(MBERR_INIT_ERROR);
}
}
}
@ -165,7 +166,7 @@ void ImportFiles(int Area)
* Check diskspace
*/
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
Files++;
memset(&fdb, 0, sizeof(fdb));

View File

@ -38,6 +38,7 @@
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/diesel.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfindex.h"
@ -364,13 +365,13 @@ void Index(void)
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open %s", sAreas);
die(0);
die(MBERR_INIT_ERROR);
}
sprintf(sIndex, "%s/etc/request.index", getenv("MBSE_ROOT"));
if ((pIndex = fopen(sIndex, "w")) == NULL) {
WriteError("$Can't create %s", sIndex);
die(0);
die(MBERR_GENERAL);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@ -422,7 +423,7 @@ void Index(void)
if (area.Available) {
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (!do_quiet) {
printf("\r%4ld => %-44s \b\b\b\b", i, area.Name);
@ -452,7 +453,7 @@ void Index(void)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfkill.h"
#include "mbfutil.h"
@ -79,7 +80,7 @@ void Kill(void)
if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas);
die(0);
die(MBERR_INIT_ERROR);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@ -95,7 +96,7 @@ void Kill(void)
if ((area.Available) && (area.DLdays || area.FDdays) && (!area.CDrom)) {
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (!do_quiet) {
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
@ -125,7 +126,7 @@ void Kill(void)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbflist.h"
@ -69,7 +70,7 @@ void ListFileAreas(int Area)
if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas);
printf("Can't open %s\n", sAreas);
die(0);
die(MBERR_INIT_ERROR);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@ -83,7 +84,7 @@ void ListFileAreas(int Area)
if ((pTic = fopen(sTic, "r")) == NULL) {
WriteError("Can't open %s", sTic);
printf("Can't open %s\n", sTic);
die(0);
die(MBERR_GENERAL);
}
fread(&tichdr, sizeof(tichdr), 1, pTic);
@ -108,7 +109,7 @@ void ListFileAreas(int Area)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}
@ -204,7 +205,7 @@ void ListFileAreas(int Area)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfmove.h"
@ -63,7 +64,7 @@ void Move(int From, int To, char *File)
WriteError("Area numbers are the same");
if (!do_quiet)
printf("Can't move to the same area\n");
die(0);
die(MBERR_COMMANDLINE);
}
/*
@ -71,22 +72,22 @@ void Move(int From, int To, char *File)
*/
if (LoadAreaRec(From) == FALSE) {
WriteError("Can't load record %d", From);
die(0);
die(MBERR_INIT_ERROR);
}
if (!area.Available) {
WriteError("Area %d not available", From);
if (!do_quiet)
printf("Area %d not available\n", From);
die(0);
die(MBERR_COMMANDLINE);
}
if (area.CDrom) {
WriteError("Can't move from CD-ROM");
if (!do_quiet)
printf("Can't move from CD-ROM\n");
die(0);
die(MBERR_COMMANDLINE);
}
if (CheckFDB(From, area.Path))
die(0);
die(MBERR_GENERAL);
frompath = xstrcpy(area.Path);
frompath = xstrcat(frompath, (char *)"/");
frompath = xstrcat(frompath, File);
@ -96,22 +97,22 @@ void Move(int From, int To, char *File)
*/
if (LoadAreaRec(To) == FALSE) {
WriteError("Can't load record %d", To);
die(0);
die(MBERR_GENERAL);
}
if (!area.Available) {
WriteError("Area %d not available", To);
if (!do_quiet)
printf("Area %d not available\n", To);
die(0);
die(MBERR_GENERAL);
}
if (area.CDrom) {
WriteError("Can't move to CD-ROM");
if (!do_quiet)
printf("Can't move to CD-ROM\n");
die(0);
die(MBERR_COMMANDLINE);
}
if (CheckFDB(To, area.Path))
die(0);
die(MBERR_GENERAL);
topath = xstrcpy(area.Path);
topath = xstrcat(topath, (char *)"/");
topath = xstrcat(topath, File);
@ -122,9 +123,9 @@ void Move(int From, int To, char *File)
sprintf(temp2, "%s/fdb/fdb%d.temp", getenv("MBSE_ROOT"), From);
if ((fp1 = fopen(temp1, "r")) == NULL)
die(0);
die(MBERR_GENERAL);
if ((fp2 = fopen(temp2, "a+")) == NULL)
die(0);
die(MBERR_GENERAL);
/*
* Search the file if the From area, if found, the

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfpack.h"
@ -71,7 +72,7 @@ void PackFileBase(void)
if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas);
die(0);
die(MBERR_INIT_ERROR);
}
fread(&areahdr, sizeof(areahdr), 1, pAreas);
@ -86,7 +87,7 @@ void PackFileBase(void)
if (area.Available && !area.CDrom) {
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (!do_quiet) {
printf("\r%4d => %-44s", i, area.Name);
@ -101,13 +102,13 @@ void PackFileBase(void)
Syslog('!', "Creating new %s", fAreas);
if ((pFile = fopen(fAreas, "a+")) == NULL) {
WriteError("$Can't create %s", fAreas);
die(0);
die(MBERR_GENERAL);
}
}
if ((fp = fopen(fTmp, "a+")) == NULL) {
WriteError("$Can't create %s", fTmp);
die(0);
die(MBERR_GENERAL);
}
while (fread(&file, sizeof(file), 1, pFile) == 1) {

View File

@ -37,6 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "mbfutil.h"
#include "mbfile.h"
@ -134,7 +135,7 @@ void Help(void)
printf(" -a -announce Suppress announce added files\n");
printf(" -q -quiet Quiet mode\n");
printf(" -v -virus Suppress virus scanning, use with care\n");
die(0);
die(MBERR_COMMANDLINE);
}
@ -250,7 +251,7 @@ int UnpackFile(char *File)
WriteError("$Can't create %s", temp);
if (!do_quiet)
printf("Can't create %s\n", temp);
die(0);
die(MBERR_GENERAL);
}
}
@ -282,7 +283,7 @@ int UnpackFile(char *File)
sprintf(temp, "%s/tmp/arc", getenv("MBSE_ROOT"));
if (chdir(temp) != 0) {
WriteError("$Can't change to %s", temp);
die(0);
die(MBERR_GENERAL);
}
if (execute(cmd, File, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {

View File

@ -38,6 +38,7 @@
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "../lib/dbftn.h"
#include "../lib/mberrors.h"
#define TMPNAME "TMP."
@ -151,7 +152,7 @@ void Help(void)
printf(" -quiet Quiet mode\n");
colour(7, 0);
printf("\n");
die(0);
die(MBERR_COMMANDLINE);
}
@ -208,7 +209,7 @@ void die(int onsig)
int main(int argc,char *argv[])
{
int i, rc;
int i;
char *cmd;
struct passwd *pw;
@ -258,16 +259,18 @@ int main(int argc,char *argv[])
free(cmd);
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (lockindex()) {
if (!do_quiet)
printf("Can't lock mbindex, abort.\n");
die(104);
die(MBERR_NO_PROGLOCK);
}
rc = nodebld();
die(rc);
if (nodebld())
die(MBERR_GENERAL);
else
die(MBERR_OK);
return 0;
}

View File

@ -38,6 +38,7 @@
#include "../lib/clcomm.h"
#include "../lib/msg.h"
#include "../lib/dbcfg.h"
#include "../lib/mberrors.h"
#include "post.h"
#include "mbmsg.h"
@ -177,7 +178,7 @@ int main(int argc, char **argv)
Post(too, tarea, subj, mfile, flavor);
}
die(0);
die(MBERR_OK);
return 0;
}
@ -205,7 +206,7 @@ void Help()
printf(" -q -quiet Quiet mode\n");
printf("\n");
die(0);
die(MBERR_COMMANDLINE);
}
@ -276,7 +277,7 @@ void DoMsgBase()
sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if(( pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open Messages Areas File.");
die(SIGILL);
die(MBERR_INIT_ERROR);
}
fread(&msgshdr, sizeof(msgshdr), 1, pAreas);
@ -286,7 +287,7 @@ void DoMsgBase()
if (msgs.Active) {
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
if (!do_quiet) {
colour(3, 0);
@ -315,7 +316,7 @@ void DoMsgBase()
if (msgs.Active) {
if (!diskfree(CFG.freespace))
die(101);
die(MBERR_DISK_FULL);
Nopper();
if (!do_quiet) {
@ -417,7 +418,7 @@ void DoMsgBase()
free(sAreas);
free(Name);
die(0);
die(MBERR_OK);
}

View File

@ -43,6 +43,7 @@
#include "../lib/dbmsgs.h"
#include "../lib/msg.h"
#include "../lib/msgtext.h"
#include "../lib/mberrors.h"
#include "rfc2ftn.h"
#include "mbfido.h"
#include "../paths.h"
@ -164,14 +165,13 @@ const char *HeaderFindMem(const char *Article, const int ArtLen, const char *Hea
static int StartChild(int, char *, char *[]);
static int StartChild(int fd, char *path, char *argv[])
{
int pan[2];
int i;
int pan[2], i;
pid_t pid;
/* Create a pipe. */
if (pipe(pan) < 0) {
WriteError("%Cant pipe for %s", path);
die(101);
die(MBERR_EXEC_FAILED);
}
/* Get a child. */
@ -192,7 +192,7 @@ static int StartChild(int fd, char *path, char *argv[])
if (fd != STDIN) {
if ((i = dup2(fd, STDIN)) != STDIN) {
WriteError("$Cant dup2 %d to 0 got %d", fd, i);
_exit(1);
_exit(MBERR_EXEC_FAILED);
}
(void)close(fd);
}
@ -201,7 +201,7 @@ static int StartChild(int fd, char *path, char *argv[])
if (pan[PIPE_WRITE] != STDOUT) {
if ((i = dup2(pan[PIPE_WRITE], STDOUT)) != STDOUT) {
WriteError("$Cant dup2 %d to 1 got %d", pan[PIPE_WRITE], i);
_exit(1);
_exit(MBERR_EXEC_FAILED);
}
(void)close(pan[PIPE_WRITE]);
}
@ -209,7 +209,7 @@ static int StartChild(int fd, char *path, char *argv[])
Syslog('n', "execv %s %s", MBSE_SS(path), MBSE_SS(argv[1]));
(void)execv(path, argv);
WriteError("$Cant execv %s", path);
_exit(1);
_exit(MBERR_EXEC_FAILED);
}
(void)close(pan[PIPE_WRITE]);
@ -333,7 +333,7 @@ static int ReadRemainder(register int fd, char first, char second)
/* Turn the descriptor into a stream. */
if ((F = fdopen(fd, "r")) == NULL) {
WriteError("$Can't fdopen %d", fd);
die(101);
die(MBERR_GENERAL);
}
/* Get an initial allocation, leaving space for the \0. */
@ -348,7 +348,7 @@ static int ReadRemainder(register int fd, char first, char second)
while ((i = fread((POINTER)&article[used], (size_t)1, (size_t)left, F)) != 0) {
if (i < 0) {
WriteError("$Cant fread after %d bytes", used);
die(101);
die(MBERR_GENERAL);
}
used += i;
left -= i;
@ -428,7 +428,7 @@ static int ReadLine(char *p, int size, int fd)
if (read(fd, p, 1) != 1) {
*p = '\0';
WriteError("$Cant read first line got %s", save);
die(101);
die(MBERR_GENERAL);
}
if (*p == '\n') {
*p = '\0';

View File

@ -57,7 +57,7 @@ depend:
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
# Dependencies generated by make depend
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h mutil.h
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mberrors.h common.h mutil.h
mbmon.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h mutil.h
common.o: ../config.h ../lib/libs.h ../lib/memwatch.h common.h
common.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mberrors.h common.h
# End of generated dependencies

View File

@ -31,6 +31,7 @@
#include "../config.h"
#include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/mberrors.h"
#include <sys/un.h>
#include "common.h"
@ -47,8 +48,8 @@ struct sockaddr_un clntaddr; /* Client socket address */
struct sockaddr_un servaddr; /* Server socket address */
struct sockaddr_un from; /* From socket address */
int fromlen;
static char spath[108]; /* Server socket path */
static char cpath[108]; /* Client socket path */
static char spath[PATH_MAX]; /* Server socket path */
static char cpath[PATH_MAX]; /* Client socket path */
@ -65,7 +66,7 @@ void InitClient(char *user)
mypid = getpid();
if (socket_connect(user) == -1) {
printf("PANIC: cannot access socket\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
}
@ -461,14 +462,9 @@ void Setraw()
if ((rc = tcgetattr(ttyfd, &tbufs))) {
perror("");
printf("$tcgetattr(0, save) return %d\n", rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
// if (ioctl(ttyfd, TCGETA, &tbuf) == -1) {
// perror("TCGETA Failed");
// exit(1); /* ERROR - could not set get tty ioctl */
// }
tbufsavs = tbufs;
tbufs.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON );
/*
@ -482,14 +478,9 @@ void Setraw()
if ((rc = tcsetattr(ttyfd, TCSADRAIN, &tbufs))) {
perror("");
printf("$tcsetattr(%d, TCSADRAIN, raw) return %d\n", ttyfd, rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
// if (ioctl(ttyfd, TCSETAF, &tbuf) == -1) {
// perror("TCSETAF failed");
// exit(1); /* ERROR - could not set tty ioctl */
// }
rawset = TRUE;
}
@ -506,14 +497,10 @@ void Unsetraw()
* Only unset the mode if it is set to raw mode
*/
if (rawset == TRUE) {
// if (ioctl(ttyfd, TCSETAF, &tbufsav) == -1) {
// perror("TCSETAF Normal Failed");
// exit(1); /* ERROR - could not save original tty ioctl */
// }
if ((rc = tcsetattr(ttyfd, TCSAFLUSH, &tbufsavs))) {
perror("");
printf("$tcsetattr(%d, TCSAFLUSH, save) return %d\n", ttyfd, rc);
exit(1);
exit(MBERR_TTYIO_ERROR);
}
}
rawset = FALSE;

View File

@ -31,6 +31,7 @@
#include "../config.h"
#include "../lib/libs.h"
#include "../lib/memwatch.h"
#include "../lib/mberrors.h"
#include "common.h"
#include "mutil.h"
@ -44,8 +45,8 @@ unsigned char readkey(int y, int x, int fg, int bg)
unsigned char ch = 0;
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 9");
exit(1);
perror("open /dev/tty");
exit(MBERR_TTYIO_ERROR);
}
Setraw();
@ -87,8 +88,8 @@ unsigned char testkey(int y, int x)
fflush(stdout);
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 9");
exit(1);
perror("open /dev/tty");
exit(MBERR_TTYIO_ERROR);
}
Setraw();

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"
@ -94,10 +95,9 @@ void menu()
{
FILE *pMenuFile;
int iFoundKey = FALSE, Key, IsANSI;
char *Input, *Semfile;
char *sMenuPathFileName;
char *Input, *Semfile, *sMenuPathFileName;
Input = calloc(81, sizeof(char));
Input = calloc(PATH_MAX, sizeof(char));
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
/*
@ -133,7 +133,7 @@ void menu()
WriteError("FATAL ERROR: Too many menu errors");
printf("Too many menu errors, notifying Sysop\n\n");
sleep(3);
die(SIGILL);
die(MBERR_CONFIG_ERROR);
}
/*
@ -174,7 +174,7 @@ void menu()
fclose(pMenuFile);
Syslog('+', "Kicking user out, the BBS is closed.");
sleep(3);
Good_Bye(0);
Good_Bye(MBERR_OK);
}
/*
@ -188,7 +188,7 @@ void menu()
printf("System power failure, closing the bbs\n\n");
free(Semfile);
sleep(3);
Good_Bye(0);
Good_Bye(MBERR_OK);
}
free(Semfile);
@ -226,7 +226,8 @@ void menu()
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);
Syslog('b', "Menu[%d] %d=(%s), Opt: '%s'", MenuLevel, menus.MenuType,
menus.TypeDesc, menus.OptionalData);
if (menus.MenuType == 13) {
/*
* Terminate call, cleanup here
@ -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());

View File

@ -80,7 +80,7 @@ m_marea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/u
m_new.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h grlist.h m_new.h m_lang.h m_marea.h m_ngroup.h
m_protocol.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_protocol.h
m_ticarea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h grlist.h m_global.h m_node.h m_fgroup.h m_farea.h m_archive.h m_ticarea.h
mbsetup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_safe.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
mbsetup.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/mberrors.h screen.h mutil.h ledit.h m_global.h m_bbs.h m_farea.h m_fgroup.h m_mail.h m_mgroup.h m_hatch.h m_tic.h m_ticarea.h m_magic.h m_fido.h m_lang.h m_archive.h m_virus.h m_tty.h m_limits.h m_users.h m_node.h m_fdb.h m_new.h m_ol.h m_bbslist.h m_safe.h m_protocol.h m_ff.h m_modem.h m_marea.h m_ngroup.h m_service.h m_domain.h m_task.h m_route.h
ledit.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/msg.h screen.h mutil.h ledit.h
m_farea.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_fgroup.h m_archive.h m_farea.h m_fgroup.h m_ngroup.h
m_fido.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_fido.h
@ -89,10 +89,10 @@ m_menu.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/us
m_ngroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_ngroup.h
m_service.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_service.h
m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_modem.h m_global.h m_tty.h
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
m_global.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/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h

View File

@ -36,6 +36,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "screen.h"
#include "mutil.h"
#include "ledit.h"
@ -69,7 +70,7 @@ void config_check(char *path)
if (some_fd == -1) {
perror("");
fprintf(stderr, "Fatal, %s/etc/config.data not found, is mbtask running?\n", path);
exit(1);
exit(MBERR_CONFIG_ERROR);
}
close(some_fd);
}

View File

@ -36,6 +36,7 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "screen.h"
#include "mutil.h"
#include "ledit.h"
@ -130,7 +131,7 @@ static void die(int onsig)
WriteError("MBSETUP finished on signal %s", SigName[onsig]);
else
Syslog(' ', "MBSETUP finished");
ExitClient(0);
ExitClient(onsig);
}
@ -395,7 +396,7 @@ int main(int argc, char *argv[])
pw = getpwuid(geteuid());
if (strcmp(pw->pw_name, (char *)"mbse")) {
printf("ERROR: only user \"mbse\" may use this program\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
#ifdef MEMWATCH
@ -534,7 +535,7 @@ int main(int argc, char *argv[])
} while (loop == 1);
}
die(0);
die(MBERR_OK);
return 0;
}

View File

@ -34,6 +34,7 @@
#include "../lib/structs.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/mberrors.h"
#include "screen.h"
#include "mutil.h"
@ -46,7 +47,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 9");
exit(1);
exit(MBERR_TTYIO_ERROR);
}
Setraw();
@ -88,7 +89,7 @@ unsigned char testkey(int y, int x)
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 9");
exit(1);
exit(MBERR_TTYIO_ERROR);
}
Setraw();

View File

@ -82,8 +82,8 @@ nodelist.o: ../config.h libs.h ../lib/structs.h taskutil.h nodelist.h
scanout.o: ../config.h libs.h ../lib/structs.h taskutil.h scanout.h
taskcomm.o: ../config.h libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskcomm.h
taskinfo.o: ../config.h libs.h ../lib/structs.h taskinfo.h
taskstat.o: ../config.h libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
mbtask.o: ../config.h libs.h ../lib/structs.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
taskstat.o: ../config.h libs.h ../lib/structs.h ../lib/mberrors.h taskstat.h callstat.h outstat.h taskutil.h
mbtask.o: ../config.h libs.h ../lib/structs.h ../paths.h ../lib/mberrors.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
outstat.o: ../config.h libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
signame.o: ../config.h signame.h
taskdisk.o: ../config.h libs.h ../lib/structs.h taskdisk.h taskutil.h
@ -91,6 +91,6 @@ taskregs.o: ../config.h libs.h ../lib/structs.h taskstat.h taskregs.h taskutil.h
taskutil.o: ../config.h libs.h ../lib/structs.h signame.h scanout.h crc.h taskutil.h
ports.o: ../config.h libs.h ../lib/structs.h taskutil.h nodelist.h ports.h
calllist.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h callstat.h outstat.h mbtask.h calllist.h
ping.o: ../config.h libs.h ../lib/structs.h taskstat.h taskutil.h ping.h
ping.o: ../config.h libs.h ../lib/structs.h ../lib/mberrors.h taskstat.h taskutil.h ping.h
crc.o: ../config.h libs.h crc.h
# End of generated dependencies

View File

@ -32,6 +32,7 @@
#include "libs.h"
#include "../lib/structs.h"
#include "../paths.h"
#include "../lib/mberrors.h"
#include "signame.h"
#include "taskstat.h"
#include "taskutil.h"
@ -393,7 +394,7 @@ void load_maincfg(void)
if ((fp = fopen(cfgfn, "a+")) == NULL) {
perror("");
fprintf(stderr, "Can't create %s\n", cfgfn);
exit(2);
exit(MBERR_INIT_ERROR);
}
fwrite(&CFG, sizeof(CFG), 1, fp);
fclose(fp);
@ -434,7 +435,7 @@ void load_taskcfg(void)
sprintf(TCFG.isp_ping2, "192.168.1.1");
if ((fp = fopen(tcfgfn, "a+")) == NULL) {
tasklog('?', "$Can't create %s", tcfgfn);
die(2);
die(MBERR_INIT_ERROR);
}
fwrite(&TCFG, sizeof(TCFG), 1, fp);
fclose(fp);
@ -493,22 +494,22 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype)
close(0);
if (open("/dev/null", O_RDONLY) != 0) {
tasklog('?', "$Launch: \"%s\": reopen of stdin to /dev/null failed", buf);
_exit(-1);
_exit(MBERR_EXEC_FAILED);
}
close(1);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 1) {
tasklog('?', "$Launch: \"%s\": reopen of stdout to /dev/null failed", buf);
_exit(-1);
_exit(MBERR_EXEC_FAILED);
}
close(2);
if (open("/dev/null", O_WRONLY | O_APPEND | O_CREAT,0600) != 2) {
tasklog('?', "$Launch: \"%s\": reopen of stderr to /dev/null failed", buf);
_exit(-1);
_exit(MBERR_EXEC_FAILED);
}
errno = 0;
rc = execv(vector[0],vector);
tasklog('?', "$Launch: execv \"%s\" failed, returned %d", cmd, rc);
_exit(-1);
_exit(MBERR_EXEC_FAILED);
default:
/* grandchild's daddy's process */
break;
@ -819,7 +820,7 @@ void check_sema(void)
* Since the upsdown semafore is permanent, the system WILL go down
* there is no point for this program to stay. Signal all tasks and stop.
*/
die(SIGTERM);
die(MBERR_UPS_ALARM);
}
/*
@ -879,7 +880,7 @@ void scheduler(void)
*/
if ((sock = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) {
tasklog('?', "$Can't create socket");
die(1);
die(MBERR_INIT_ERROR);
}
memset(&servaddr, 0, sizeof(servaddr));
@ -890,7 +891,7 @@ void scheduler(void)
close(sock);
sock = -1;
tasklog('?', "$Can't bind socket %s", spath);
die(1);
die(MBERR_INIT_ERROR);
}
/*
@ -1273,19 +1274,19 @@ int main(int argc, char **argv)
perror("");
printf("can't setuid to mbse\n");
close(ping_isocket);
exit(1);
exit(MBERR_INIT_ERROR);
}
if (setgid(pw->pw_gid)) {
perror("");
printf("can't setgid to bbs\n");
close(ping_isocket);
exit(1);
exit(MBERR_INIT_ERROR);
}
umask(007);
if (locktask(pw->pw_dir)) {
close(ping_isocket);
exit(1);
exit(MBERR_NO_PROGLOCK);
}
sprintf(cfgfn, "%s/etc/config.data", getenv("MBSE_ROOT"));
@ -1324,14 +1325,14 @@ int main(int argc, char **argv)
*/
if ((pgrp = setpgid(0, 0)) == -1) {
tasklog('?', "$setpgid failed");
die(0);
die(MBERR_INIT_ERROR);
}
frk = fork();
switch (frk) {
case -1:
tasklog('?', "$Unable to fork daemon");
die(0);
die(MBERR_INIT_ERROR);
case 0:
/*
* Starting the deamon child process here.
@ -1352,7 +1353,7 @@ int main(int argc, char **argv)
fclose(fp);
}
tasklog('+', "Starting daemon with pid %d", frk);
exit(0);
exit(MBERR_OK);
}
/*

View File

@ -31,6 +31,7 @@
#include "../config.h"
#include "libs.h"
#include "../lib/structs.h"
#include "../lib/mberrors.h"
#include "taskstat.h"
#include "taskutil.h"
#include "ping.h"
@ -432,7 +433,7 @@ void init_pingsocket(void)
} else {
fprintf(stderr, "socket init failed\n");
}
exit(1);
exit(MBERR_INIT_ERROR);
}
/*
@ -440,7 +441,7 @@ void init_pingsocket(void)
* It would be nice to issue an error message, but to where?
*/
if (ping_isocket == STDIN_FILENO || ping_isocket == STDOUT_FILENO || ping_isocket == STDERR_FILENO) {
exit(255);
exit(MBERR_GENERAL);
}
}

View File

@ -31,6 +31,7 @@
#include "../config.h"
#include "libs.h"
#include "../lib/structs.h"
#include "../lib/mberrors.h"
#include "taskstat.h"
#include "callstat.h"
#include "outstat.h"
@ -119,7 +120,7 @@ void status_init()
cnt = read(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
printf("Error reading status file\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
status.startups++;
status.laststart = time(NULL);
@ -129,7 +130,7 @@ void status_init()
cnt = write(stat_fd, &status, sizeof(status_r));
if (cnt != sizeof(status_r)) {
tasklog('?', "$Error rewrite status file\n");
exit(1);
exit(MBERR_INIT_ERROR);
}
close(stat_fd);
}