Code cleanup and heavy debug removal

This commit is contained in:
Michiel Broek 2007-08-26 12:21:15 +00:00
parent 9e63a9f9e9
commit c78578675c
13 changed files with 12 additions and 92 deletions

View File

@ -92,7 +92,6 @@ typedef enum {NoState, Sending, IsSent, Got, Skipped, Get} FileState;
typedef enum {InitTransfer, Switch, Receive, Transmit, DeinitTransfer} FtType;
typedef enum {CompNone, CompGZ, CompBZ2, CompPLZ} CompType;
// static char *txstate[] = { (char *)"TxGNF", (char *)"TxTryR", (char *)"TxReadS", (char *)"TxWLA", (char *)"TxDone" };
static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD",
(char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" };
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
@ -1455,8 +1454,6 @@ TrType binkp_transmitter(void)
file_list *tsl;
static binkp_list *tmp;
// Syslog('b', "Binkd: transmitter %s", txstate[bp.TxState]);
if (bp.TxState == TxGNF) {
/*
* If we do not have a filelist yet, create one.
@ -1619,7 +1616,6 @@ TrType binkp_transmitter(void)
fseek(bp.txfp, bp.txpos, SEEK_SET);
nget = fread(z_obuf, 1, nget, bp.txfp);
rc2 = do_compress(bp.tmode, bp.txbuf + nput, &ocnt, z_obuf, &nget, fleft ? 0 : 1, z_odata);
// Syslog('b', "Binkp: do_compress ocnt=%d nget=%d fleft=%d rc=%d", ocnt, nget, fleft, rc2);
if (rc2 == -1) {
Syslog('+', "Binkp: compression error rc=%d", rc2);
return Failure;
@ -2052,7 +2048,7 @@ int binkp_send_comp_opts(int originate)
nr = TRUE;
}
} else {
if ((bp.NRwe == Can)/* || (bp.NRthey == Can)*/ && (bp.NRthey == Want)) {
if ((bp.NRwe == Can) && (bp.NRthey == Want)) {
Syslog('b', "Binkp: binkp_send_comp_opts(FALSE) NRwe=Can NRthey=Want");
bp.NRwe = Want;
nr = TRUE;
@ -2267,7 +2263,6 @@ void parse_m_nul(char *msg)
}
#endif
} else if (strcmp(q, (char *)"NR") == 0) {
// Syslog('b', "Binkp: remote wants NR mode, NOT SUPPORTED HERE YET");
Syslog('b', "Binkp: remote requests NR mode");
if (bp.NRthey == Can) {
bp.NRthey = Want;
@ -2324,15 +2319,12 @@ int binkp_poll_frame(void)
rc = -1;
break;
} else {
// Syslog('b', "c=%02x %c rxlen=%d", c, isprint(c) ? c : '.', bp.rxlen);
switch (bp.rxlen) {
case 0: bp.header = c << 8;
rc = 0;
// Syslog('b', "Binkp: 1st %02x", c);
break;
case 1: bp.header += c;
rc = 0;
// Syslog('b', "Binkp: 2nd %02x", c);
break;
default:bp.rxbuf[bp.rxlen-2] = c;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -71,18 +71,16 @@ 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))
break;
}
Syslog('d', "Next call allowed over %d seconds", j);
}
if (sts != -1)
cst->trystat = sts;
cst->trytime = (int)time(NULL) + j;
cst->trytime = (int)time(NULL) + j; /* Next call allowed at */
fwrite(cst, sizeof(callstat), 1, fp);
fclose(fp);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -85,10 +85,7 @@ int txdietifna(void)
Syslog('+', "Start DietIFNA session");
session_flags |= SESSION_IFNA;
session_flags &= ~SESSION_BARK;
// if (localoptions & NOHOLD)
nonhold_mail = (char *)ALL_MAIL;
// else
// nonhold_mail = (char *)NONHOLD_MAIL;
nonhold_mail = (char *)ALL_MAIL;
tosend = create_filelist(remote, nonhold_mail, 2);
if ((rc = sendfiles(tosend)) == 0)

View File

@ -172,7 +172,6 @@ int rx_emsi(char *data)
emsi_local_lcodes = LCODE_HAT;
}
} else {
Syslog('i', "No EMSI password check");
Syslog('?', "Unexpected remote password \"%s\"", MBSE_SS(emsi_local_password));
}
@ -270,8 +269,6 @@ int tx_emsi(char *data)
return txtcp();
else if (emsi_local_protos & PROT_HYD)
return hydra(1);
// else if (emsi_local_protos & PROT_JAN)
// return janus();
else
return txwazoo();
}

View File

@ -1,7 +1,6 @@
/*****************************************************************************
*
* $Id$
* File ..................: mbcico/openport.c
* Purpose ...............: Fidonet mailer
*
*****************************************************************************

View File

@ -394,8 +394,6 @@ SM_STATE(recvblk)
SM_PROCEED(waitblk);
}
Syslog('X', "received block %d \"%s\"", recv_blk,printable((char *)xmblk.data,128));
if (fp == NULL) {
if ((fp = openfile(tmpfname,remtime,remsize,&resofs,resync)) == NULL) {
SM_ERROR;

View File

@ -70,7 +70,6 @@ void fill_rlist(fa_list **fap, char *str)
if ((str == NULL) || (*str == '\0'))
return;
Syslog('N' ,"fill_rlist %s",str);
buf = xstrcpy(str);
for (p = buf, q = strchr(p,'!'); *p; p = q, q = strchr(p,'!')) {
if (q)
@ -90,7 +89,6 @@ void fill_rlist(fa_list **fap, char *str)
}
free(buf);
for (tmp=*fap;tmp;tmp=tmp->next)
Syslog('N', "fill_rlist returns: %s",ascfnode(tmp->addr,0x06));
return;
}
@ -329,7 +327,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
return 4;
}
Syslog('M', "Message input start =============");
rewind(pkt);
while ((fgets(buf, sizeof(buf)-2, pkt)) != NULL) {
/*
@ -337,12 +334,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
*/
if (strlen(buf) > (sizeof(buf) /2))
Syslog('+', "FTN: Possible bufferoverflow: line read %d bytes", strlen(buf));
if (strlen(buf) > 200) {
Syslog('M', "FTN: Next line should be %d characters", strlen(buf));
Syslogp('M', printable(buf, 200));
} else {
Syslogp('M', printable(buf, 0));
}
if ((buf[0] == '\1') || !strncmp(buf,"AREA:",5) || !strncmp(buf,"SEEN-BY",7)) { /* This is a kluge line */
waskludge = TRUE;
badkludge = FALSE;
@ -428,7 +419,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
(*tmsg)->key = xstrcpy((char *)"Origin");
(*tmsg)->val = xstrcpy(buf+11);
tmsg = &((*tmsg)->next);
Syslog('M', "origin \"%s\" at offset %d", buf,(int)orig_off);
p = buf+10;
while (*p == ' ')
p++;
@ -470,7 +460,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
fputs(buf,fp);
}
}
Syslog('M', "Message input end ===============");
if (bNeedToGetAddressFromMsgid && (p = hdr((char *)"MSGID", kmsg))) {
Syslog('m', "Need To Get Address From Msgid start...");
@ -552,7 +541,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
* The msgs record is already loaded.
*/
newsgroup = xstrcpy(msgs.Newsgroup);
Syslog('M', "newsgroup %s", printable(newsgroup, 0));
newsmode = TRUE;
} else
newsmode = FALSE;

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Mail Gate
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -293,7 +293,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
tmsg->to->point = msgs.Aka.point;
tmsg->to->domain = xstrcpy(msgs.Aka.domain);
}
Syslog('N', "TO: %s",ascfnode(tmsg->to,0xff));
} else {
if (recipient) {
/*
@ -386,9 +385,7 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
if ((!freename) || ((freename) && (*freename == '\0')) || (strcmp(freename,".")==0))
freename=rfcfrom;
if (newsmode)
Syslog('M', "FROM: %s <%s>", freename, rfcfrom);
else
if (! newsmode)
Syslog('+', "from: %s <%s>",freename,rfcfrom);
needreplyaddr = 1;
@ -415,7 +412,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
replyaddr=NULL;
}
if (needreplyaddr && (tmsg->from == NULL)) {
Syslog('M', "fill replyaddr with \"%s\"",rfcfrom);
replyaddr=xstrcpy(rfcfrom);
}
@ -497,7 +493,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
} else {
tmsg->subj = xstrcpy((char *)" ");
}
Syslog('M', "SUBJ: \"%s\"", tmsg->subj);
if ((p = hdr((char *)"X-FTN-FLAGS",msg)))
tmsg->flags |= flagset(p);
@ -570,9 +565,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
else
tmsg->reply_a=NULL;
Syslog('M', "DATE: %s, MSGID: %s %lx, REPLY: %s %lx",
ftndate(tmsg->date), MBSE_SS(tmsg->msgid_a),tmsg->msgid_n, MBSE_SS(tmsg->reply_a),tmsg->reply_n);
p = hdr((char *)"Organization",msg);
if (p == NULL)
p = hdr((char *)"Organisation",msg);
@ -590,7 +582,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
tmsg->origin = xstrcpy(CFG.origin);
}
Syslog('M', "ORIGIN: %s", MBSE_SS(tmsg->origin));
return tmsg;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Mail and file queue operations
*
*****************************************************************************
* Copyright (C) 1997-2006
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -208,7 +208,6 @@ void flush_dir(char *ndir)
} else {
snprintf(arcfile, PATH_MAX, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat));
}
Syslog('P', "Arcmail file %s", arcfile);
/*
* If there is a mailpkt.qqq file, close it and rename it.
@ -231,7 +230,6 @@ void flush_dir(char *ndir)
putc('\0', fp);
fsync(fileno(fp));
fclose(fp);
Syslog('P', "Renamed %s to %s", fname, pktfile);
}
}
free(fname);
@ -462,8 +460,6 @@ void flush_dir(char *ndir)
} else {
snprintf(arcfile, PATH_MAX, "%s", pktname(&noden, flavor));
}
Syslog('P', "Outfile: %s", arcfile);
Syslog('P', "Pktfile: %s", pktfile);
/*
* Now we must see if there is already mail in the outbound.
@ -569,9 +565,6 @@ void flush_dir(char *ndir)
}
chmod(arcfile, 0660);
}
Syslog('P', "%c %d %s", flavor, mode, pktfile);
}
free(buf);

View File

@ -584,8 +584,6 @@ void ExportEcho(sysconnect L, unsigned int MsgNum, fa_list **sbl)
if ((!L.sendto) || L.pause || L.cutoff)
return;
Syslog('M', "Export to %s", aka2str(L.aka));
if (!SearchNode(L.aka)) {
WriteError("Can't send to %s, noderecord not found", aka2str(L.aka));
return;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Scan for new News
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -104,8 +104,6 @@ void fill_artlist(List **fdp, char *id, int nr, int dupe)
{
List **tmp;
Syslog('M', "Fill %s %ld %s", id, nr, dupe ? "Dupe":"New msg");
for (tmp = fdp; *tmp; tmp = &((*tmp)->next));
*tmp = (List *)malloc(sizeof(List));
(*tmp)->next = NULL;
@ -521,16 +519,6 @@ int get_xoverview(void)
}
}
}
// if ((tmp = xoverview) != NULL) {
// Syslog('M', "--Xoverview.fmt list");
// while (tmp != NULL) {
// if (tmp->header != NULL) {
// Syslog('M', "item = %s -- full = %s", tmp->header, tmp->full ? "True":"False");
// }
// tmp = tmp->next;
// }
// }
} else {
return 1;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Mail Gate
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -288,7 +288,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
tmsg->to->point = msgs.Aka.point;
tmsg->to->domain = xstrcpy(msgs.Aka.domain);
}
Syslog('N', "TO: %s",ascfnode(tmsg->to,0xff));
} else {
if (recipient) {
/*
@ -381,25 +380,14 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
if ((!freename) || ((freename) && (*freename == '\0')) || (strcmp(freename,".")==0))
freename=rfcfrom;
if (newsmode)
Syslog('M', "FROM: %s <%s>", freename, rfcfrom);
else
if (! newsmode)
Syslog('+', "from: %s <%s>",freename,rfcfrom);
needreplyaddr = 1;
if ((tmsg->from=parsefaddr(rfcfrom)) == NULL) {
if (freename && rfcfrom)
Syslog('-', "at removed registrate()");
// if (!strchr(freename,'@') && !strchr(freename,'%') &&
// strncasecmp(freename,rfcfrom,MAXNAME) &&
// strncasecmp(freename,"uucp",4) &&
// strncasecmp(freename,"usenet",6) &&
// strncasecmp(freename,"news",4) &&
// strncasecmp(freename,"super",5) &&
// strncasecmp(freename,"admin",5) &&
// strncasecmp(freename,"postmaster",10) &&
// strncasecmp(freename,"sys",3))
// needreplyaddr=registrate(freename,rfcfrom);
// FIXME: registrate() removed
} else {
tmsg->ftnorigin = 1;
tmsg->from->name = xstrcpy(freename);
@ -411,7 +399,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
replyaddr=NULL;
}
if (needreplyaddr && (tmsg->from == NULL)) {
Syslog('M', "fill replyaddr with \"%s\"",rfcfrom);
replyaddr=xstrcpy(rfcfrom);
}
@ -493,7 +480,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
} else {
tmsg->subj = xstrcpy((char *)" ");
}
Syslog('M', "SUBJ: \"%s\"", tmsg->subj);
if ((p = hdr((char *)"X-FTN-FLAGS",msg)))
tmsg->flags |= flagset(p);
@ -566,9 +552,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
else
tmsg->reply_a=NULL;
Syslog('M', "DATE: %s, MSGID: %s %lx, REPLY: %s %lx",
ftndate(tmsg->date), MBSE_SS(tmsg->msgid_a),tmsg->msgid_n, MBSE_SS(tmsg->reply_a),tmsg->reply_n);
p = hdr((char *)"Organization",msg);
if (p == NULL)
p = hdr((char *)"Organisation",msg);
@ -586,7 +569,6 @@ ftnmsg *mkftnhdr(rfcmsg *msg, int newsmode, faddr *recipient)
tmsg->origin = xstrcpy(CFG.origin);
}
Syslog('M', "ORIGIN: %s", MBSE_SS(tmsg->origin));
return tmsg;
}

View File

@ -2551,7 +2551,6 @@ unsigned int QWK_PackArea(unsigned int ulLast, int Area)
memset(&Qwk, ' ', sizeof(Qwk));
snprintf(Temp, 81, "%-*u", (int)sizeof(Qwk.Msgnum), (int)Number);
Syslog('M', "Message %s", Temp);
memcpy(Qwk.Msgnum, Temp, sizeof(Qwk.Msgnum));
tp = localtime(&Msg.Written);
snprintf(Temp, 81, "%02d-%02d-%02d", tp->tm_mon+1, tp->tm_mday, tp->tm_year % 100);