Changed all error return codes
This commit is contained in:
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
554
mbfido/mbdiff.c
554
mbfido/mbdiff.c
@@ -38,6 +38,7 @@
|
||||
#include "../lib/common.h"
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/dbcfg.h"
|
||||
#include "../lib/mberrors.h"
|
||||
#include "mbdiff.h"
|
||||
|
||||
|
||||
@@ -115,322 +116,317 @@ 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;
|
||||
struct passwd *pw;
|
||||
char *wrk, *onl, *ond;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
int i, Match, rc;
|
||||
char *cmd, *nl = NULL, *nd = NULL, *nn, *p, *q, *arc, *wrk, *onl, *ond;
|
||||
struct passwd *pw;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
|
||||
#ifdef MEMWATCH
|
||||
mwInit();
|
||||
mwInit();
|
||||
#endif
|
||||
InitConfig();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
InitConfig();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
|
||||
if(argc < 3)
|
||||
if(argc < 3)
|
||||
Help();
|
||||
|
||||
cmd = xstrcpy((char *)"Cmd: mbdiff");
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
|
||||
if (i == 1)
|
||||
if ((nl = argv[i]) == NULL)
|
||||
Help();
|
||||
if (i == 2)
|
||||
if ((nd = argv[i]) == NULL)
|
||||
Help();
|
||||
if (!strncasecmp(argv[i], "-q", 2))
|
||||
do_quiet = TRUE;
|
||||
|
||||
cmd = xstrcpy((char *)"Cmd: mbdiff");
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBDIFF v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
free(cmd);
|
||||
|
||||
if (i == 1)
|
||||
if ((nl = argv[i]) == NULL)
|
||||
Help();
|
||||
if (i == 2)
|
||||
if ((nd = argv[i]) == NULL)
|
||||
Help();
|
||||
if (!strncasecmp(argv[i], "-q", 2))
|
||||
do_quiet = TRUE;
|
||||
if (!do_quiet) {
|
||||
colour(12, 0);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (!diskfree(CFG.freespace))
|
||||
die(MBERR_DISK_FULL);
|
||||
|
||||
/*
|
||||
* Extract work directory from the first commandline parameter
|
||||
* and set that directory as default.
|
||||
*/
|
||||
show_log = TRUE;
|
||||
wrk = xstrcpy(nl);
|
||||
if (strrchr(wrk, '/') == NULL) {
|
||||
WriteError("No path in nodelist name");
|
||||
free(wrk);
|
||||
die(MBERR_COMMANDLINE);
|
||||
}
|
||||
if (strrchr(wrk, '.') != NULL) {
|
||||
WriteError("Filename extension given for nodelist");
|
||||
free(wrk);
|
||||
die(MBERR_COMMANDLINE);
|
||||
}
|
||||
if (strrchr(nd, '/') == NULL) {
|
||||
WriteError("No path in nodediff name");
|
||||
free(wrk);
|
||||
die(MBERR_COMMANDLINE);
|
||||
}
|
||||
show_log = FALSE;
|
||||
|
||||
while (wrk[strlen(wrk) -1] != '/')
|
||||
wrk[strlen(wrk) -1] = '\0';
|
||||
wrk[strlen(wrk) -1] = '\0';
|
||||
|
||||
show_log = TRUE;
|
||||
if (access(wrk, R_OK|W_OK)) {
|
||||
WriteError("$No R/W access in %s", wrk);
|
||||
free(wrk);
|
||||
die(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
if (chdir(wrk)) {
|
||||
WriteError("$Can't chdir to %s", wrk);
|
||||
free(wrk);
|
||||
die(MBERR_INIT_ERROR);
|
||||
}
|
||||
show_log = FALSE;
|
||||
|
||||
onl = xstrcpy(strrchr(nl, '/') + 1);
|
||||
onl = xstrcat(onl, (char *)".???");
|
||||
|
||||
if ((dp = opendir(wrk)) == 0) {
|
||||
show_log = TRUE;
|
||||
free(wrk);
|
||||
WriteError("$Error opening directory %s", wrk);
|
||||
die(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
Match = FALSE;
|
||||
while ((de = readdir(dp))) {
|
||||
if (strlen(de->d_name) == strlen(onl)) {
|
||||
Match = TRUE;
|
||||
for (i = 0; i < strlen(onl); i++) {
|
||||
if ((onl[i] != '?') && (onl[i] != de->d_name[i]))
|
||||
Match = FALSE;
|
||||
}
|
||||
if (Match) {
|
||||
free(onl);
|
||||
onl = xstrcpy(de->d_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
if (!Match) {
|
||||
show_log = TRUE;
|
||||
free(wrk);
|
||||
free(onl);
|
||||
WriteError("Old nodelist not found");
|
||||
die(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbdiff", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
/*
|
||||
* Now try to get the diff file into the workdir.
|
||||
*/
|
||||
if ((arc = unpacker(nd)) == NULL) {
|
||||
show_log = TRUE;
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Can't get filetype for %s", nd);
|
||||
die(MBERR_CONFIG_ERROR);
|
||||
}
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBDIFF v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
free(cmd);
|
||||
ond = xstrcpy(strrchr(nd, '/') + 1);
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(12, 0);
|
||||
printf("\n");
|
||||
if (strncmp(arc, "ASC", 3)) {
|
||||
if (!getarchiver(arc)) {
|
||||
show_log = TRUE;
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("Can't find unarchiver %s", arc);
|
||||
die(MBERR_CONFIG_ERROR);
|
||||
}
|
||||
|
||||
if (!diskfree(CFG.freespace))
|
||||
die(101);
|
||||
|
||||
/*
|
||||
* Extract work directory from the first commandline parameter
|
||||
* and set that directory as default.
|
||||
* We may both use the unarchive command for files and mail,
|
||||
* unarchiving isn't recursive anyway.
|
||||
*/
|
||||
show_log = TRUE;
|
||||
wrk = xstrcpy(nl);
|
||||
if (strrchr(wrk, '/') == NULL) {
|
||||
WriteError("No path in nodelist name");
|
||||
free(wrk);
|
||||
die(100);
|
||||
}
|
||||
if (strrchr(wrk, '.') != NULL) {
|
||||
WriteError("Filename extension given for nodelist");
|
||||
free(wrk);
|
||||
die(100);
|
||||
}
|
||||
if (strrchr(nd, '/') == NULL) {
|
||||
WriteError("No path in nodediff name");
|
||||
free(wrk);
|
||||
die(100);
|
||||
}
|
||||
show_log = FALSE;
|
||||
if (strlen(archiver.funarc))
|
||||
cmd = xstrcpy(archiver.funarc);
|
||||
else
|
||||
cmd = xstrcpy(archiver.munarc);
|
||||
|
||||
while (wrk[strlen(wrk) -1] != '/')
|
||||
wrk[strlen(wrk) -1] = '\0';
|
||||
wrk[strlen(wrk) -1] = '\0';
|
||||
|
||||
show_log = TRUE;
|
||||
if (access(wrk, R_OK|W_OK)) {
|
||||
WriteError("$No R/W access in %s", wrk);
|
||||
free(wrk);
|
||||
die(100);
|
||||
if ((cmd == NULL) || (cmd == "")) {
|
||||
show_log = TRUE;
|
||||
free(cmd);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("No unarc command available for %s", arc);
|
||||
die(MBERR_CONFIG_ERROR);
|
||||
}
|
||||
|
||||
if (chdir(wrk)) {
|
||||
WriteError("$Can't chdir to %s", wrk);
|
||||
free(wrk);
|
||||
die(100);
|
||||
}
|
||||
show_log = FALSE;
|
||||
|
||||
onl = xstrcpy(strrchr(nl, '/') + 1);
|
||||
onl = xstrcat(onl, (char *)".???");
|
||||
|
||||
if ((dp = opendir(wrk)) == 0) {
|
||||
show_log = TRUE;
|
||||
free(wrk);
|
||||
WriteError("$Error opening directory %s", wrk);
|
||||
die(100);
|
||||
if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
||||
show_log = TRUE;
|
||||
free(cmd);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("Unpack error");
|
||||
die(MBERR_EXEC_FAILED);
|
||||
}
|
||||
free(cmd);
|
||||
sync();
|
||||
|
||||
Match = FALSE;
|
||||
while ((de = readdir(dp))) {
|
||||
if (strlen(de->d_name) == strlen(onl)) {
|
||||
Match = TRUE;
|
||||
for (i = 0; i < strlen(onl); i++) {
|
||||
if ((onl[i] != '?') && (onl[i] != de->d_name[i]))
|
||||
Match = FALSE;
|
||||
}
|
||||
if (Match) {
|
||||
free(onl);
|
||||
onl = xstrcpy(de->d_name);
|
||||
break;
|
||||
}
|
||||
if ((dp = opendir(wrk)) != NULL) {
|
||||
while ((de = readdir(dp))) {
|
||||
if (strlen(ond) == strlen(de->d_name)) {
|
||||
Match = TRUE;
|
||||
for (i = 0; i < (strlen(ond) -3); i++)
|
||||
if (toupper(ond[i]) != toupper(de->d_name[i]))
|
||||
Match = FALSE;
|
||||
if (Match) {
|
||||
free(ond);
|
||||
ond = xstrcpy(de->d_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
closedir(dp);
|
||||
if (!Match) {
|
||||
show_log = TRUE;
|
||||
free(wrk);
|
||||
free(onl);
|
||||
WriteError("Old nodelist not found");
|
||||
die(100);
|
||||
show_log = TRUE;
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Could not find extracted file");
|
||||
die(MBERR_DIFF_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now try to get the diff file into the workdir.
|
||||
*/
|
||||
if ((arc = unpacker(nd)) == NULL) {
|
||||
show_log = TRUE;
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Can't get filetype for %s", nd);
|
||||
die(100);
|
||||
} else {
|
||||
if ((rc = file_cp(nd, ond))) {
|
||||
show_log = TRUE;
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
||||
die(MBERR_DIFF_ERROR);
|
||||
}
|
||||
Syslog('s', "Copied %s", nd);
|
||||
}
|
||||
|
||||
ond = xstrcpy(strrchr(nd, '/') + 1);
|
||||
|
||||
if (strncmp(arc, "ASC", 3)) {
|
||||
if (!getarchiver(arc)) {
|
||||
show_log = TRUE;
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("Can't find unarchiver %s", arc);
|
||||
die(100);
|
||||
}
|
||||
|
||||
/*
|
||||
* We may both use the unarchive command for files and mail,
|
||||
* unarchiving isn't recursive anyway.
|
||||
*/
|
||||
if (strlen(archiver.funarc))
|
||||
cmd = xstrcpy(archiver.funarc);
|
||||
else
|
||||
cmd = xstrcpy(archiver.munarc);
|
||||
|
||||
if ((cmd == NULL) || (cmd == "")) {
|
||||
show_log = TRUE;
|
||||
free(cmd);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("No unarc command available for %s", arc);
|
||||
die(100);
|
||||
}
|
||||
|
||||
if (execute(cmd, nd, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null")) {
|
||||
show_log = TRUE;
|
||||
free(cmd);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(ond);
|
||||
WriteError("Unpack error");
|
||||
die(100);
|
||||
}
|
||||
free(cmd);
|
||||
sync();
|
||||
|
||||
Match = FALSE;
|
||||
if ((dp = opendir(wrk)) != NULL) {
|
||||
while ((de = readdir(dp))) {
|
||||
if (strlen(ond) == strlen(de->d_name)) {
|
||||
Match = TRUE;
|
||||
for (i = 0; i < (strlen(ond) -3); i++)
|
||||
if (toupper(ond[i]) != toupper(de->d_name[i]))
|
||||
Match = FALSE;
|
||||
if (Match) {
|
||||
free(ond);
|
||||
ond = xstrcpy(de->d_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
}
|
||||
if (!Match) {
|
||||
show_log = TRUE;
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Could not find extracted file");
|
||||
die(100);
|
||||
}
|
||||
} else {
|
||||
if ((rc = file_cp(nd, ond))) {
|
||||
show_log = TRUE;
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
WriteError("Copy %s failed, %s", nd, strerror(rc));
|
||||
die(100);
|
||||
}
|
||||
Syslog('s', "Copied %s", nd);
|
||||
}
|
||||
|
||||
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) &&
|
||||
(strlen(p) == strlen(q))) {
|
||||
nn = xstrcpy(onl);
|
||||
p = strrchr(nn, '.') + 1;
|
||||
q++;
|
||||
strcpy(p, q);
|
||||
} else
|
||||
nn = xstrcpy((char *)"newnodelist");
|
||||
|
||||
if (strcmp(onl, nn) == 0) {
|
||||
show_log = TRUE;
|
||||
WriteError("Attempt to update nodelist to the same version");
|
||||
unlink(ond);
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(nn);
|
||||
die(100);
|
||||
}
|
||||
|
||||
Syslog('+', "Apply %s with %s to %s", onl, ond, nn);
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("Apply %s with %s to %s\n", onl, ond, nn);
|
||||
}
|
||||
rc = apply(onl, ond, nn);
|
||||
if (((p = strrchr(onl, '.'))) && ((q = strrchr(ond, '.'))) && (strlen(p) == strlen(q))) {
|
||||
nn = xstrcpy(onl);
|
||||
p = strrchr(nn, '.') + 1;
|
||||
q++;
|
||||
strcpy(p, q);
|
||||
} else
|
||||
nn = xstrcpy((char *)"newnodelist");
|
||||
|
||||
if (strcmp(onl, nn) == 0) {
|
||||
show_log = TRUE;
|
||||
WriteError("Attempt to update nodelist to the same version");
|
||||
unlink(ond);
|
||||
if (rc) {
|
||||
unlink(nn);
|
||||
free(nn);
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(nn);
|
||||
die(MBERR_DIFF_ERROR);
|
||||
}
|
||||
|
||||
Syslog('+', "Apply %s with %s to %s", onl, ond, nn);
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("Apply %s with %s to %s\n", onl, ond, nn);
|
||||
}
|
||||
rc = apply(onl, ond, nn);
|
||||
|
||||
unlink(ond);
|
||||
if (rc) {
|
||||
unlink(nn);
|
||||
free(nn);
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
die(MBERR_DIFF_ERROR);
|
||||
} else {
|
||||
unlink(onl);
|
||||
cmd = xstrcpy(archiver.farc);
|
||||
|
||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||
free(cmd);
|
||||
Syslog('+', "No archive command for %s, fallback to ZIP", arc);
|
||||
if (!getarchiver((char *)"ZIP")) {
|
||||
WriteError("No ZIP command available");
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
die(rc + 100);
|
||||
} else {
|
||||
unlink(onl);
|
||||
free(nn);
|
||||
die(MBERR_DIFF_ERROR);
|
||||
} else {
|
||||
cmd = xstrcpy(archiver.farc);
|
||||
|
||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||
free(cmd);
|
||||
Syslog('+', "No archive command for %s, fallback to ZIP", arc);
|
||||
if (!getarchiver((char *)"ZIP")) {
|
||||
WriteError("No ZIP command available");
|
||||
free(ond);
|
||||
free(onl);
|
||||
free(wrk);
|
||||
free(nn);
|
||||
die(100);
|
||||
} else {
|
||||
cmd = xstrcpy(archiver.farc);
|
||||
}
|
||||
} else {
|
||||
free(cmd);
|
||||
cmd = xstrcpy(archiver.farc);
|
||||
}
|
||||
|
||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||
WriteError("No archiver command available");
|
||||
} else {
|
||||
free(onl);
|
||||
onl = xstrcpy(nn);
|
||||
onl[strlen(onl) -3] = tolower(archiver.name[0]);
|
||||
tl(onl);
|
||||
p = xstrcpy(onl);
|
||||
p = xstrcat(p, (char *)" ");
|
||||
p = xstrcat(p, nn);
|
||||
if (execute(cmd, p, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))
|
||||
WriteError("Create %s failed", onl);
|
||||
else {
|
||||
CreateSema((char *)"mailin");
|
||||
}
|
||||
sync();
|
||||
free(p);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
free(onl);
|
||||
free(ond);
|
||||
free(wrk);
|
||||
free(nn);
|
||||
die(0);
|
||||
}
|
||||
} else {
|
||||
free(cmd);
|
||||
cmd = xstrcpy(archiver.farc);
|
||||
}
|
||||
return 0;
|
||||
|
||||
if ((cmd == NULL) || (!strlen(cmd))) {
|
||||
WriteError("No archiver command available");
|
||||
} else {
|
||||
free(onl);
|
||||
onl = xstrcpy(nn);
|
||||
onl[strlen(onl) -3] = tolower(archiver.name[0]);
|
||||
tl(onl);
|
||||
p = xstrcpy(onl);
|
||||
p = xstrcat(p, (char *)" ");
|
||||
p = xstrcat(p, nn);
|
||||
if (execute(cmd, p, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))
|
||||
WriteError("Create %s failed", onl);
|
||||
else {
|
||||
CreateSema((char *)"mailin");
|
||||
}
|
||||
sync();
|
||||
free(p);
|
||||
free(cmd);
|
||||
}
|
||||
|
||||
free(onl);
|
||||
free(ond);
|
||||
free(wrk);
|
||||
free(nn);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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"
|
||||
|
||||
@@ -64,281 +65,278 @@ extern int do_pack; /* Pack filebase */
|
||||
*/
|
||||
void Check(void)
|
||||
{
|
||||
FILE *pAreas, *pFile;
|
||||
int i, iAreas, iAreasNew = 0, Fix, inArea;
|
||||
int iTotal = 0, iErrors = 0;
|
||||
char *sAreas, *fAreas, *newdir, *temp;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
int Found, Update;
|
||||
char fn[PATH_MAX];
|
||||
struct stat stb;
|
||||
struct passwd *pw;
|
||||
struct group *gr;
|
||||
FILE *pAreas, *pFile;
|
||||
int i, iAreas, iAreasNew = 0, Fix, inArea, iTotal = 0, iErrors = 0;
|
||||
char *sAreas, *fAreas, *newdir, *temp;
|
||||
DIR *dp;
|
||||
struct dirent *de;
|
||||
int Found, Update;
|
||||
char fn[PATH_MAX];
|
||||
struct stat stb;
|
||||
struct passwd *pw;
|
||||
struct group *gr;
|
||||
|
||||
sAreas = calloc(PATH_MAX, sizeof(char));
|
||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||
newdir = calloc(PATH_MAX, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sAreas = calloc(PATH_MAX, sizeof(char));
|
||||
fAreas = calloc(PATH_MAX, sizeof(char));
|
||||
newdir = calloc(PATH_MAX, sizeof(char));
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("Checking file database...\n");
|
||||
}
|
||||
if (!do_quiet) {
|
||||
colour(3, 0);
|
||||
printf("Checking file database...\n");
|
||||
}
|
||||
|
||||
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||
sprintf(sAreas, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||
WriteError("Can't open %s", sAreas);
|
||||
die(0);
|
||||
}
|
||||
if ((pAreas = fopen (sAreas, "r")) == NULL) {
|
||||
WriteError("Can't open %s", sAreas);
|
||||
die(MBERR_INIT_ERROR);
|
||||
}
|
||||
|
||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||
fseek(pAreas, 0, SEEK_END);
|
||||
iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize;
|
||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||
fseek(pAreas, 0, SEEK_END);
|
||||
iAreas = (ftell(pAreas) - areahdr.hdrsize) / areahdr.recsize;
|
||||
|
||||
for (i = 1; i <= iAreas; i++) {
|
||||
for (i = 1; i <= iAreas; i++) {
|
||||
|
||||
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
|
||||
fread(&area, areahdr.recsize, 1, pAreas);
|
||||
fseek(pAreas, ((i-1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
|
||||
fread(&area, areahdr.recsize, 1, pAreas);
|
||||
|
||||
if (area.Available) {
|
||||
if (area.Available) {
|
||||
|
||||
IsDoing("Check area %d", i);
|
||||
IsDoing("Check area %d", i);
|
||||
|
||||
if (!do_quiet) {
|
||||
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
||||
fflush(stdout);
|
||||
}
|
||||
if (!do_quiet) {
|
||||
printf("\r%4d => %-44s \b\b\b\b", i, area.Name);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if download directory exists,
|
||||
* if not, create the directory.
|
||||
*/
|
||||
if (access(area.Path, R_OK) == -1) {
|
||||
Syslog('!', "No dir: %s", area.Path);
|
||||
sprintf(newdir, "%s/foobar", area.Path);
|
||||
mkdirs(newdir, 0775);
|
||||
}
|
||||
/*
|
||||
* Check if download directory exists,
|
||||
* if not, create the directory.
|
||||
*/
|
||||
if (access(area.Path, R_OK) == -1) {
|
||||
Syslog('!', "No dir: %s", area.Path);
|
||||
sprintf(newdir, "%s/foobar", area.Path);
|
||||
mkdirs(newdir, 0775);
|
||||
}
|
||||
|
||||
if (stat(area.Path, &stb) == 0) {
|
||||
/*
|
||||
* Very extended directory check
|
||||
*/
|
||||
Fix = FALSE;
|
||||
if ((stb.st_mode & S_IRUSR) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No owner read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IWUSR) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No owner write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IRGRP) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No group read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IWGRP) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No group write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IROTH) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No others read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if (Fix) {
|
||||
iErrors++;
|
||||
if (chmod(area.Path, 0775))
|
||||
WriteError("Could not set mode to 0775");
|
||||
else
|
||||
Syslog('+', "Corrected directory mode to 0775");
|
||||
}
|
||||
Fix = FALSE;
|
||||
pw = getpwuid(stb.st_uid);
|
||||
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
||||
WriteError("Directory %s not owned by user mbse", area.Path);
|
||||
Fix = TRUE;
|
||||
}
|
||||
gr = getgrgid(stb.st_gid);
|
||||
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
||||
WriteError("Directory %s not owned by group bbs", area.Path);
|
||||
Fix = TRUE;
|
||||
}
|
||||
if (Fix) {
|
||||
iErrors++;
|
||||
pw = getpwnam((char *)"mbse");
|
||||
gr = getgrnam((char *)"bbs");
|
||||
if (chown(area.Path, pw->pw_gid, gr->gr_gid))
|
||||
WriteError("Could not set owner to mbse.bbs");
|
||||
else
|
||||
Syslog('+', "Corrected directory owner to mbse.bbs");
|
||||
}
|
||||
} else {
|
||||
WriteError("Can't stat %s", area.Path);
|
||||
}
|
||||
if (stat(area.Path, &stb) == 0) {
|
||||
/*
|
||||
* Very extended directory check
|
||||
*/
|
||||
Fix = FALSE;
|
||||
if ((stb.st_mode & S_IRUSR) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No owner read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IWUSR) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No owner write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IRGRP) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No group read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IWGRP) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No group write access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if ((stb.st_mode & S_IROTH) == 0) {
|
||||
Fix = TRUE;
|
||||
WriteError("No others read access in %s, mode is %04o", area.Path, stb.st_mode & 0x1ff);
|
||||
}
|
||||
if (Fix) {
|
||||
iErrors++;
|
||||
if (chmod(area.Path, 0775))
|
||||
WriteError("Could not set mode to 0775");
|
||||
else
|
||||
Syslog('+', "Corrected directory mode to 0775");
|
||||
}
|
||||
Fix = FALSE;
|
||||
pw = getpwuid(stb.st_uid);
|
||||
if (strcmp(pw->pw_name, (char *)"mbse")) {
|
||||
WriteError("Directory %s not owned by user mbse", area.Path);
|
||||
Fix = TRUE;
|
||||
}
|
||||
gr = getgrgid(stb.st_gid);
|
||||
if (strcmp(gr->gr_name, (char *)"bbs")) {
|
||||
WriteError("Directory %s not owned by group bbs", area.Path);
|
||||
Fix = TRUE;
|
||||
}
|
||||
if (Fix) {
|
||||
iErrors++;
|
||||
pw = getpwnam((char *)"mbse");
|
||||
gr = getgrnam((char *)"bbs");
|
||||
if (chown(area.Path, pw->pw_gid, gr->gr_gid))
|
||||
WriteError("Could not set owner to mbse.bbs");
|
||||
else
|
||||
Syslog('+', "Corrected directory owner to mbse.bbs");
|
||||
}
|
||||
} else {
|
||||
WriteError("Can't stat %s", area.Path);
|
||||
}
|
||||
|
||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||
|
||||
/*
|
||||
* Open the file database, if it doesn't exist,
|
||||
* create an empty one.
|
||||
*/
|
||||
if ((pFile = fopen(fAreas, "r+")) == NULL) {
|
||||
Syslog('!', "Creating new %s", fAreas);
|
||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||
WriteError("$Can't create %s", fAreas);
|
||||
die(0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Open the file database, if it doesn't exist,
|
||||
* create an empty one.
|
||||
*/
|
||||
if ((pFile = fopen(fAreas, "r+")) == NULL) {
|
||||
Syslog('!', "Creating new %s", fAreas);
|
||||
if ((pFile = fopen(fAreas, "a+")) == NULL) {
|
||||
WriteError("$Can't create %s", fAreas);
|
||||
die(MBERR_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now start checking the files in the filedatabase
|
||||
* against the contents of the directory.
|
||||
*/
|
||||
inArea = 0;
|
||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||
/*
|
||||
* Now start checking the files in the filedatabase
|
||||
* against the contents of the directory.
|
||||
*/
|
||||
inArea = 0;
|
||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||
|
||||
iTotal++;
|
||||
inArea++;
|
||||
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
||||
iTotal++;
|
||||
inArea++;
|
||||
sprintf(newdir, "%s/%s", area.Path, file.LName);
|
||||
|
||||
if (file_exist(newdir, R_OK)) {
|
||||
Syslog('+', "File %s area %d not on disk.", newdir, i);
|
||||
if (!file.NoKill) {
|
||||
file.Deleted = TRUE;
|
||||
do_pack = TRUE;
|
||||
}
|
||||
if (file_exist(newdir, R_OK)) {
|
||||
Syslog('+', "File %s area %d not on disk.", newdir, i);
|
||||
if (!file.NoKill) {
|
||||
file.Deleted = TRUE;
|
||||
do_pack = TRUE;
|
||||
}
|
||||
iErrors++;
|
||||
file.Missing = TRUE;
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
} else {
|
||||
/*
|
||||
* File exists, now check the file.
|
||||
*/
|
||||
Marker();
|
||||
Update = FALSE;
|
||||
|
||||
strcpy(temp, file.LName);
|
||||
name_mangle(temp);
|
||||
if (strcmp(file.Name, temp)) {
|
||||
Syslog('!', "Converted %s to %s", file.Name, temp);
|
||||
strncpy(file.Name, temp, 12);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_time(newdir) != file.FileDate) {
|
||||
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
|
||||
file.FileDate = file_time(newdir);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_size(newdir) != file.Size) {
|
||||
Syslog('!', "Size mismatch area %d file %s", i, file.LName);
|
||||
file.Size = file_size(newdir);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_crc(newdir, CFG.slow_util && do_quiet) != file.Crc32) {
|
||||
Syslog('!', "CRC error area %d, file %s", i, file.LName);
|
||||
file.Crc32 = file_crc(newdir, CFG.slow_util && do_quiet);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
Marker();
|
||||
if (Update) {
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inArea == 0)
|
||||
Syslog('+', "Warning: area %d (%s) is empty", i, area.Name);
|
||||
|
||||
/*
|
||||
* Check files in the directory against the database.
|
||||
* This test is skipped for CD-rom.
|
||||
*/
|
||||
if (!area.CDrom) {
|
||||
if ((dp = opendir(area.Path)) != NULL) {
|
||||
while ((de = readdir(dp)) != NULL) {
|
||||
if (de->d_name[0] != '.') {
|
||||
Marker();
|
||||
Found = FALSE;
|
||||
rewind(pFile);
|
||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||
if (strcmp(file.LName, de->d_name) == 0) {
|
||||
if (!Found) {
|
||||
Found = TRUE;
|
||||
} else {
|
||||
/*
|
||||
* Record has been found before, so this must be
|
||||
* a double record.
|
||||
*/
|
||||
Syslog('!', "Double file record area %d file %s", i, file.LName);
|
||||
iErrors++;
|
||||
file.Missing = TRUE;
|
||||
file.Double = TRUE;
|
||||
do_pack = TRUE;
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
} else {
|
||||
/*
|
||||
* File exists, now check the file.
|
||||
*/
|
||||
Marker();
|
||||
Update = FALSE;
|
||||
|
||||
strcpy(temp, file.LName);
|
||||
name_mangle(temp);
|
||||
if (strcmp(file.Name, temp)) {
|
||||
Syslog('!', "Converted %s to %s", file.Name, temp);
|
||||
strncpy(file.Name, temp, 12);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_time(newdir) != file.FileDate) {
|
||||
Syslog('!', "Date mismatch area %d file %s", i, file.LName);
|
||||
file.FileDate = file_time(newdir);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_size(newdir) != file.Size) {
|
||||
Syslog('!', "Size mismatch area %d file %s", i, file.LName);
|
||||
file.Size = file_size(newdir);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
if (file_crc(newdir, CFG.slow_util && do_quiet) != file.Crc32) {
|
||||
Syslog('!', "CRC error area %d, file %s", i, file.LName);
|
||||
file.Crc32 = file_crc(newdir, CFG.slow_util && do_quiet);
|
||||
iErrors++;
|
||||
Update = TRUE;
|
||||
}
|
||||
Marker();
|
||||
if (Update) {
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inArea == 0)
|
||||
Syslog('+', "Warning: area %d (%s) is empty", i, area.Name);
|
||||
|
||||
/*
|
||||
* Check files in the directory against the database.
|
||||
* This test is skipped for CD-rom.
|
||||
*/
|
||||
if (!area.CDrom) {
|
||||
if ((dp = opendir(area.Path)) != NULL) {
|
||||
while ((de = readdir(dp)) != NULL) {
|
||||
if (de->d_name[0] != '.') {
|
||||
Marker();
|
||||
Found = FALSE;
|
||||
rewind(pFile);
|
||||
while (fread(&file, sizeof(file), 1, pFile) == 1) {
|
||||
if (strcmp(file.LName, de->d_name) == 0) {
|
||||
if (!Found) {
|
||||
Found = TRUE;
|
||||
} else {
|
||||
/*
|
||||
* Record has been found before, so this must be
|
||||
* a double record.
|
||||
*/
|
||||
Syslog('!', "Double file record area %d file %s",
|
||||
i, file.LName);
|
||||
iErrors++;
|
||||
file.Double = TRUE;
|
||||
do_pack = TRUE;
|
||||
fseek(pFile, - sizeof(file), SEEK_CUR);
|
||||
fwrite(&file, sizeof(file), 1, pFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
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)) &&
|
||||
(strncmp(de->d_name, "index", 5)) &&
|
||||
(strncmp(de->d_name, "readme", 6))) {
|
||||
sprintf(fn, "%s/%s", area.Path, de->d_name);
|
||||
if (stat(fn, &stb) == 0)
|
||||
if (S_ISREG(stb.st_mode)) {
|
||||
if (unlink(fn) == 0) {
|
||||
Syslog('!', "%s not in fdb, deleted from disk", fn);
|
||||
iErrors++;
|
||||
} else {
|
||||
WriteError("$%s not in fdb, cannot delete", fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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)) &&
|
||||
(strncmp(de->d_name, "index", 5)) &&
|
||||
(strncmp(de->d_name, "readme", 6))) {
|
||||
sprintf(fn, "%s/%s", area.Path, de->d_name);
|
||||
if (stat(fn, &stb) == 0)
|
||||
if (S_ISREG(stb.st_mode)) {
|
||||
if (unlink(fn) == 0) {
|
||||
Syslog('!', "%s not in fdb, deleted from disk", fn);
|
||||
iErrors++;
|
||||
} else {
|
||||
WriteError("$%s not in fdb, cannot delete", fn);
|
||||
}
|
||||
closedir(dp);
|
||||
} else {
|
||||
WriteError("Can't open %s", area.Path);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pFile);
|
||||
chmod(fAreas, 0660);
|
||||
iAreasNew++;
|
||||
|
||||
} else {
|
||||
|
||||
if (strlen(area.Name) == 0) {
|
||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||
if (unlink(fAreas) == 0) {
|
||||
Syslog('+', "Removed obsolete %s", fAreas);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dp);
|
||||
} else {
|
||||
WriteError("Can't open %s", area.Path);
|
||||
}
|
||||
}
|
||||
|
||||
} /* if area.Available */
|
||||
}
|
||||
fclose(pFile);
|
||||
chmod(fAreas, 0660);
|
||||
iAreasNew++;
|
||||
|
||||
fclose(pAreas);
|
||||
if (!do_quiet) {
|
||||
printf("\r \r");
|
||||
fflush(stdout);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (strlen(area.Name) == 0) {
|
||||
sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i);
|
||||
if (unlink(fAreas) == 0) {
|
||||
Syslog('+', "Removed obsolete %s", fAreas);
|
||||
}
|
||||
}
|
||||
|
||||
free(temp);
|
||||
free(newdir);
|
||||
free(sAreas);
|
||||
free(fAreas);
|
||||
} /* if area.Available */
|
||||
}
|
||||
|
||||
Syslog('+', "Check Areas [%5d] Files [%5d] Errors [%5d]", iAreasNew, iTotal, iErrors);
|
||||
fclose(pAreas);
|
||||
if (!do_quiet) {
|
||||
printf("\r \r");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
free(temp);
|
||||
free(newdir);
|
||||
free(sAreas);
|
||||
free(fAreas);
|
||||
|
||||
Syslog('+', "Check Areas [%5d] Files [%5d] Errors [%5d]", iAreasNew, iTotal, iErrors);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
306
mbfido/mbfile.c
306
mbfido/mbfile.c
@@ -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"
|
||||
@@ -74,191 +75,190 @@ time_t t_end; /* End time */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, Area = 0, ToArea = 0, UnDel = FALSE;
|
||||
char *cmd, *FileName = NULL, *Description = NULL;
|
||||
struct passwd *pw;
|
||||
int i, Area = 0, ToArea = 0, UnDel = FALSE;
|
||||
char *cmd, *FileName = NULL, *Description = NULL;
|
||||
struct passwd *pw;
|
||||
|
||||
#ifdef MEMWATCH
|
||||
mwInit();
|
||||
mwInit();
|
||||
#endif
|
||||
InitConfig();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
InitConfig();
|
||||
TermInit(1);
|
||||
t_start = time(NULL);
|
||||
umask(002);
|
||||
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
/*
|
||||
* 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))
|
||||
signal(i, (void (*))die);
|
||||
else
|
||||
signal(i, SIG_IGN);
|
||||
}
|
||||
|
||||
if(argc < 2)
|
||||
Help();
|
||||
if(argc < 2)
|
||||
Help();
|
||||
|
||||
cmd = xstrcpy((char *)"Command line: mbfile");
|
||||
cmd = xstrcpy((char *)"Command line: mbfile");
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
|
||||
if (!strncasecmp(argv[i], "a", 1)) {
|
||||
do_adopt = TRUE;
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
i++;
|
||||
FileName = xstrcpy(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
|
||||
if (!strncasecmp(argv[i], "a", 1)) {
|
||||
do_adopt = TRUE;
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (!strncasecmp(argv[i], "-a", 2)) {
|
||||
do_annon = TRUE;
|
||||
} else {
|
||||
Description = xstrcpy(argv[i]);
|
||||
}
|
||||
}
|
||||
} else if ((!strncasecmp(argv[i], "d", 1)) || (!strncasecmp(argv[i], "u", 1))) {
|
||||
if (!strncasecmp(argv[i], "u", 1))
|
||||
UnDel = TRUE;
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
FileName = xstrcpy(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
do_del = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "in", 2)) {
|
||||
do_index = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "im", 2)) {
|
||||
if (argc > (i + 1)) {
|
||||
do_import = TRUE;
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "l", 1)) {
|
||||
do_list = TRUE;
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "m", 1)) {
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
ToArea = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
FileName = xstrcpy(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (!strncasecmp(argv[i], "-a", 2)) {
|
||||
do_annon = TRUE;
|
||||
} else {
|
||||
Description = xstrcpy(argv[i]);
|
||||
}
|
||||
}
|
||||
} else if ((!strncasecmp(argv[i], "d", 1)) || (!strncasecmp(argv[i], "u", 1))) {
|
||||
if (!strncasecmp(argv[i], "u", 1))
|
||||
UnDel = TRUE;
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
FileName = xstrcpy(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
do_del = TRUE;
|
||||
}
|
||||
do_move = TRUE;
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "in", 2)) {
|
||||
do_index = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "im", 2)) {
|
||||
if (argc > (i + 1)) {
|
||||
do_import = TRUE;
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "l", 1)) {
|
||||
do_list = TRUE;
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "m", 1)) {
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
Area = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
ToArea = atoi(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
if (argc > (i + 1)) {
|
||||
i++;
|
||||
FileName = xstrcpy(argv[i]);
|
||||
cmd = xstrcat(cmd, (char *)" ");
|
||||
cmd = xstrcat(cmd, argv[i]);
|
||||
do_move = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "p", 1)) {
|
||||
do_pack = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "c", 1)) {
|
||||
do_check = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "k", 1)) {
|
||||
do_kill = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "t", 1)) {
|
||||
do_tobe = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-q", 2)) {
|
||||
do_quiet = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-a", 2)) {
|
||||
do_annon = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
||||
do_novir = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (!strncasecmp(argv[i], "p", 1)) {
|
||||
do_pack = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "c", 1)) {
|
||||
do_check = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "k", 1)) {
|
||||
do_kill = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "t", 1)) {
|
||||
do_tobe = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-q", 2)) {
|
||||
do_quiet = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-a", 2)) {
|
||||
do_annon = TRUE;
|
||||
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
||||
do_novir = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt || do_del || do_move || do_tobe))
|
||||
Help();
|
||||
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt || do_del || do_move || do_tobe))
|
||||
Help();
|
||||
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
ProgName();
|
||||
pw = getpwuid(getuid());
|
||||
InitClient(pw->pw_name, (char *)"mbfile", CFG.location, CFG.logfile, CFG.util_loglevel, CFG.error_log, CFG.mgrlog);
|
||||
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBFILE v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
if (do_novir)
|
||||
Syslog('!', "WARNING: running without virus checking");
|
||||
free(cmd);
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBFILE v%s", VERSION);
|
||||
Syslog(' ', cmd);
|
||||
if (do_novir)
|
||||
Syslog('!', "WARNING: running without virus checking");
|
||||
free(cmd);
|
||||
|
||||
if (!do_quiet)
|
||||
printf("\n");
|
||||
if (!do_quiet)
|
||||
printf("\n");
|
||||
|
||||
if (!diskfree(CFG.freespace))
|
||||
die(101);
|
||||
if (!diskfree(CFG.freespace))
|
||||
die(MBERR_DISK_FULL);
|
||||
|
||||
if (do_adopt) {
|
||||
AdoptFile(Area, FileName, Description);
|
||||
die(0);
|
||||
}
|
||||
if (do_adopt) {
|
||||
AdoptFile(Area, FileName, Description);
|
||||
die(MBERR_OK);
|
||||
}
|
||||
|
||||
if (do_import) {
|
||||
ImportFiles(Area);
|
||||
die(0);
|
||||
}
|
||||
if (do_import) {
|
||||
ImportFiles(Area);
|
||||
die(MBERR_OK);
|
||||
}
|
||||
|
||||
if (do_kill)
|
||||
Kill();
|
||||
if (do_kill)
|
||||
Kill();
|
||||
|
||||
if (do_check)
|
||||
Check();
|
||||
if (do_check)
|
||||
Check();
|
||||
|
||||
if (do_pack)
|
||||
PackFileBase();
|
||||
if (do_pack)
|
||||
PackFileBase();
|
||||
|
||||
if (do_index)
|
||||
Index();
|
||||
if (do_index)
|
||||
Index();
|
||||
|
||||
if (do_move) {
|
||||
Move(Area, ToArea, FileName);
|
||||
die(0);
|
||||
}
|
||||
if (do_move) {
|
||||
Move(Area, ToArea, FileName);
|
||||
die(MBERR_OK);
|
||||
}
|
||||
|
||||
if (do_del) {
|
||||
Delete(UnDel, Area, FileName);
|
||||
die(0);
|
||||
}
|
||||
if (do_del) {
|
||||
Delete(UnDel, Area, FileName);
|
||||
die(MBERR_OK);
|
||||
}
|
||||
|
||||
if (do_list) {
|
||||
ListFileAreas(Area);
|
||||
die(0);
|
||||
}
|
||||
if (do_list) {
|
||||
ListFileAreas(Area);
|
||||
die(MBERR_OK);
|
||||
}
|
||||
|
||||
if (do_tobe)
|
||||
ToBeRep();
|
||||
die(0);
|
||||
return 0;
|
||||
if (do_tobe)
|
||||
ToBeRep();
|
||||
die(MBERR_OK);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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));
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
200
mbfido/rnews.c
200
mbfido/rnews.c
@@ -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,57 +165,56 @@ 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;
|
||||
pid_t pid;
|
||||
int pan[2], i;
|
||||
pid_t pid;
|
||||
|
||||
/* Create a pipe. */
|
||||
if (pipe(pan) < 0) {
|
||||
WriteError("%Cant pipe for %s", path);
|
||||
die(101);
|
||||
/* Create a pipe. */
|
||||
if (pipe(pan) < 0) {
|
||||
WriteError("%Cant pipe for %s", path);
|
||||
die(MBERR_EXEC_FAILED);
|
||||
}
|
||||
|
||||
/* Get a child. */
|
||||
for (i = 0; (pid = fork()) < 0; i++) {
|
||||
if (i == MAX_FORKS) {
|
||||
WriteError("$Cant fork %s -- spooling", path);
|
||||
return -1;
|
||||
}
|
||||
Syslog('n', "Cant fork %s -- waiting", path);
|
||||
(void)sleep(60);
|
||||
}
|
||||
|
||||
/* Run the child, with redirection. */
|
||||
if (pid == 0) {
|
||||
(void)close(pan[PIPE_READ]);
|
||||
|
||||
/* Stdin comes from our old input. */
|
||||
if (fd != STDIN) {
|
||||
if ((i = dup2(fd, STDIN)) != STDIN) {
|
||||
WriteError("$Cant dup2 %d to 0 got %d", fd, i);
|
||||
_exit(MBERR_EXEC_FAILED);
|
||||
}
|
||||
(void)close(fd);
|
||||
}
|
||||
|
||||
/* Get a child. */
|
||||
for (i = 0; (pid = fork()) < 0; i++) {
|
||||
if (i == MAX_FORKS) {
|
||||
WriteError("$Cant fork %s -- spooling", path);
|
||||
return -1;
|
||||
}
|
||||
Syslog('n', "Cant fork %s -- waiting", path);
|
||||
(void)sleep(60);
|
||||
/* Stdout goes down the pipe. */
|
||||
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(MBERR_EXEC_FAILED);
|
||||
}
|
||||
(void)close(pan[PIPE_WRITE]);
|
||||
}
|
||||
|
||||
/* Run the child, with redirection. */
|
||||
if (pid == 0) {
|
||||
(void)close(pan[PIPE_READ]);
|
||||
Syslog('n', "execv %s %s", MBSE_SS(path), MBSE_SS(argv[1]));
|
||||
(void)execv(path, argv);
|
||||
WriteError("$Cant execv %s", path);
|
||||
_exit(MBERR_EXEC_FAILED);
|
||||
}
|
||||
|
||||
/* Stdin comes from our old input. */
|
||||
if (fd != STDIN) {
|
||||
if ((i = dup2(fd, STDIN)) != STDIN) {
|
||||
WriteError("$Cant dup2 %d to 0 got %d", fd, i);
|
||||
_exit(1);
|
||||
}
|
||||
(void)close(fd);
|
||||
}
|
||||
|
||||
/* Stdout goes down the pipe. */
|
||||
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);
|
||||
}
|
||||
(void)close(pan[PIPE_WRITE]);
|
||||
}
|
||||
|
||||
Syslog('n', "execv %s %s", MBSE_SS(path), MBSE_SS(argv[1]));
|
||||
(void)execv(path, argv);
|
||||
WriteError("$Cant execv %s", path);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
(void)close(pan[PIPE_WRITE]);
|
||||
(void)close(fd);
|
||||
return pan[PIPE_READ];
|
||||
(void)close(pan[PIPE_WRITE]);
|
||||
(void)close(fd);
|
||||
return pan[PIPE_READ];
|
||||
}
|
||||
|
||||
|
||||
@@ -322,50 +322,50 @@ static int Process(char *article)
|
||||
static int ReadRemainder(register int, char, char);
|
||||
static int ReadRemainder(register int fd, char first, char second)
|
||||
{
|
||||
register FILE *F;
|
||||
register char *article;
|
||||
register int size;
|
||||
register int used;
|
||||
register int left;
|
||||
register int i;
|
||||
int ok;
|
||||
register FILE *F;
|
||||
register char *article;
|
||||
register int size;
|
||||
register int used;
|
||||
register int left;
|
||||
register int i;
|
||||
int ok;
|
||||
|
||||
/* Turn the descriptor into a stream. */
|
||||
if ((F = fdopen(fd, "r")) == NULL) {
|
||||
WriteError("$Can't fdopen %d", fd);
|
||||
die(101);
|
||||
/* Turn the descriptor into a stream. */
|
||||
if ((F = fdopen(fd, "r")) == NULL) {
|
||||
WriteError("$Can't fdopen %d", fd);
|
||||
die(MBERR_GENERAL);
|
||||
}
|
||||
|
||||
/* Get an initial allocation, leaving space for the \0. */
|
||||
size = BUFSIZ + 1;
|
||||
article = NEW(char, size + 2);
|
||||
article[0] = first;
|
||||
article[1] = second;
|
||||
used = second ? 2 : 1;
|
||||
left = size - used;
|
||||
|
||||
/* Read the input. */
|
||||
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(MBERR_GENERAL);
|
||||
}
|
||||
|
||||
/* Get an initial allocation, leaving space for the \0. */
|
||||
size = BUFSIZ + 1;
|
||||
article = NEW(char, size + 2);
|
||||
article[0] = first;
|
||||
article[1] = second;
|
||||
used = second ? 2 : 1;
|
||||
left = size - used;
|
||||
|
||||
/* Read the input. */
|
||||
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);
|
||||
}
|
||||
used += i;
|
||||
left -= i;
|
||||
if (left < SMBUF) {
|
||||
size += BUFSIZ;
|
||||
left += BUFSIZ;
|
||||
RENEW(article, char, size);
|
||||
}
|
||||
used += i;
|
||||
left -= i;
|
||||
if (left < SMBUF) {
|
||||
size += BUFSIZ;
|
||||
left += BUFSIZ;
|
||||
RENEW(article, char, size);
|
||||
}
|
||||
if (article[used - 1] != '\n')
|
||||
article[used++] = '\n';
|
||||
article[used] = '\0';
|
||||
(void)fclose(F);
|
||||
}
|
||||
if (article[used - 1] != '\n')
|
||||
article[used++] = '\n';
|
||||
article[used] = '\0';
|
||||
(void)fclose(F);
|
||||
|
||||
ok = Process(article);
|
||||
DISPOSE(article);
|
||||
return ok;
|
||||
ok = Process(article);
|
||||
DISPOSE(article);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,23 +421,23 @@ static int ReadBytecount(register int fd, int artsize)
|
||||
static int ReadLine(char *, int, int);
|
||||
static int ReadLine(char *p, int size, int fd)
|
||||
{
|
||||
char *save;
|
||||
char *save;
|
||||
|
||||
/* Fill the buffer, a byte at a time. */
|
||||
for (save = p; size > 0; p++, size--) {
|
||||
if (read(fd, p, 1) != 1) {
|
||||
*p = '\0';
|
||||
WriteError("$Cant read first line got %s", save);
|
||||
die(101);
|
||||
}
|
||||
if (*p == '\n') {
|
||||
*p = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
/* Fill the buffer, a byte at a time. */
|
||||
for (save = p; size > 0; p++, size--) {
|
||||
if (read(fd, p, 1) != 1) {
|
||||
*p = '\0';
|
||||
WriteError("$Cant read first line got %s", save);
|
||||
die(MBERR_GENERAL);
|
||||
}
|
||||
*p = '\0';
|
||||
WriteError("bad_line too long %s", save);
|
||||
return FALSE;
|
||||
if (*p == '\n') {
|
||||
*p = '\0';
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
WriteError("bad_line too long %s", save);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user