code cleanup

This commit is contained in:
Michiel Broek 2004-01-28 21:10:56 +00:00
parent 861e90e2b2
commit c62614ef84
26 changed files with 154 additions and 252 deletions

5
TODO
View File

@ -118,11 +118,10 @@ mbfido:
in the toberep database and will be multiple times announced.
mbcico:
U: Fix binkp file resume when mbcico silently dies. Check with the new
driver.
L: Implement binkp option ND.
N: Implement PLZ turn off m_get command.
mbfile:
L: Add a check to see if the magic filenames are (still) valid.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Dupe checking.
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -115,18 +115,14 @@ int CheckDupe(unsigned long crc, int idx, int max)
dupes[idx].crcs[dupes[idx].count] = test;
dupes[idx].count++;
}
Syslog('N', "Loaded %d dupe records in %s", dupes[idx].count++, files[idx]);
fclose(fil);
free(dfile);
dupes[idx].loaded = TRUE;
dupes[idx].max = max;
}
// Syslog('N', "dupetest %08x %s %d", crc, files[idx], max);
for (i = 0; i < dupes[idx].count; i++) {
if (dupes[idx].crcs[i] == crc) {
// Syslog('N', "dupe at %d", i);
return TRUE;
}
}
@ -134,7 +130,6 @@ int CheckDupe(unsigned long crc, int idx, int max)
* Not a dupe, append new crc value
*/
dupes[idx].crcs[dupes[idx].count] = crc;
// Syslog('N', "Added new dupe at %d", dupes[idx].count);
dupes[idx].count++;
dupes[idx].changed = TRUE;
@ -155,7 +150,6 @@ void CloseDdb(int idx)
FILE *fil;
dfile = calloc(PATH_MAX, sizeof(char));
// Syslog('N', "Checking %s.dupe", files[idx]);
if (dupes[idx].loaded) {
if (dupes[idx].changed) {
if (dupes[idx].count > dupes[idx].max)
@ -164,7 +158,6 @@ void CloseDdb(int idx)
start = 0;
sprintf(dfile, "%s/etc/%s.dupe", getenv("MBSE_ROOT"), files[idx]);
if ((fil = fopen(dfile, "w"))) {
Syslog('N', "Writing dupes %d to %d", start, dupes[idx].count);
for (j = start; j < dupes[idx].count; j++)
fwrite(&dupes[idx].crcs[j], sizeof(unsigned long), 1, fil);
fclose(fil);

View File

@ -1,10 +1,10 @@
/*****************************************************************************
*
* $id$
* $Id$
* Purpose ...............: Userrecord Access
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10

View File

@ -4,7 +4,7 @@
* Purpose ...............: Mangle a unix name to DOS 8.3 filename
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -120,7 +120,7 @@ char *safe_strcpy(char *dest,const char *src, size_t maxlength)
size_t len;
if (!dest) {
Syslog('f', "ERROR: NULL dest in safe_strcpy");
Syslog('+', "ERROR: NULL dest in safe_strcpy");
return NULL;
}
@ -263,7 +263,7 @@ int is_8_3( char *fname)
init_chartest();
for (i = 0; i < strlen(fname); i++) {
if (isillegal(fname[i])) {
Syslog('f', "Illegal character in filename");
Syslog('+', "Illegal character in filename");
return FALSE;
}
}
@ -378,7 +378,6 @@ void mangle_name_83(char *s)
for (i = 0; i < strlen(q); i++)
*p++ = q[i];
*p++ = '\0';
// Syslog('f', "name with new extension => \"%s\"", s);
}
/*
@ -398,7 +397,6 @@ void mangle_name_83(char *s)
} else {
crc16 = crc16xmodem(s, strlen(s));
}
// Syslog('f', "crc16xmodem(%s) %d", s, crc16);
tu(s);
@ -463,7 +461,6 @@ void name_mangle(char *OutName)
*/
if (!is_8_3(OutName)) {
mangle_name_83(OutName);
// Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName);
} else {
/*
* No mangling needed, convert to uppercase
@ -471,7 +468,6 @@ void name_mangle(char *OutName)
tu(OutName);
}
// Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName);
free(p);
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS functions for TURBODIESEL
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -182,7 +182,6 @@ char *ParseMacro( const char *line, int *dieselrc)
while (isspace(res[strlen(res) - 1])) {
res[strlen(res) - 1] = EOS;
}
// sprintf(&res[strlen(res)],"\r\n");
if ((res[0] == '@') && (res[1] =='!' ))
res[0]='\0';
return res;

View File

@ -4,7 +4,7 @@
* Purpose ...............: BinkleyTerm outbound naming
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -138,7 +138,6 @@ char *pktname(faddr *addr, char flavor)
q = p + strlen(p);
sprintf(q, "%c%s", flavor, ptyp);
Syslog('O', "packet name is \"%s\"", p);
return p;
}
@ -153,7 +152,6 @@ char *floname(faddr *addr, char flavor)
flavor = 'f';
q = p + strlen(p);
sprintf(q, "%c%s", flavor, ftyp);
Syslog('O', "flo file name is \"%s\"", p);
return p;
}
@ -166,7 +164,6 @@ char *reqname(faddr *addr)
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", rtyp);
Syslog('O', "req file name is \"%s\"", p);
return p;
}
@ -179,7 +176,6 @@ char *splname(faddr *addr)
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", styp);
Syslog('O', "spl file name is \"%s\"", p);
return p;
}
@ -192,7 +188,6 @@ char *bsyname(faddr *addr)
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", btyp);
Syslog('O', "bsy file name is \"%s\"", p);
return p;
}
@ -205,7 +200,6 @@ char *stsname(faddr *addr)
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", qtyp);
Syslog('O', "sts file name is \"%s\"", p);
return p;
}
@ -218,7 +212,6 @@ char *polname(faddr *addr)
p = prepbuf(addr);
q = p + strlen(p);
sprintf(q, "%s", ltyp);
Syslog('O', "pol file name is \"%s\"", p);
return p;
}
@ -286,7 +279,6 @@ char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
}
tidy_faddr(bestaka);
Syslog('O', "Arc file name is \"%s\"", buf);
return buf;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: RFC msg
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -79,7 +79,6 @@ rfcmsg *parsrfc(FILE *fp)
} else
cur->val = xstrcat(cur->val,buffer);
} else {
// Syslog('M', "this is a header line");
if (cur) {
firstline=FALSE;
(cur->next) = (rfcmsg *)malloc(sizeof(rfcmsg));
@ -101,7 +100,6 @@ rfcmsg *parsrfc(FILE *fp)
/* at least one non blank char */
(strspn(p+2, " \t\n") < strlen(p+2)) && (strspn(buffer,KWDCHARS) == (p-buffer))) {
*p='\0';
// Syslog('M', "This is a regular header");
cur->key = xstrcpy(buffer);
cur->val = xstrcpy(p+1);
} else if ((p=strchr(buffer,':')) && (!strncasecmp(buffer, (char *)"X-MS-", 5))) {
@ -124,7 +122,6 @@ rfcmsg *parsrfc(FILE *fp)
cur->key = xstrcpy(buffer);
cur->val = xstrcpy((char *)" ");
} else {
Syslog('M', "Non-header line: \"%s\"",buffer);
cur->key = xstrcpy((char *)"X-Body-Start");
cur->val = xstrcpy(buffer);
break;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Security flags access test
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -40,9 +40,6 @@
*/
int Access(securityrec us, securityrec ref)
{
Syslog('B', "User %5d %08lx %08lx", us.level, us.flags, ~us.flags);
Syslog('B', "Ref. %5d %08lx %08lx", ref.level, ref.flags, ref.notflags);
if (us.level < ref.level)
return FALSE;
@ -63,9 +60,6 @@ int Access(securityrec us, securityrec ref)
*/
int Le_Access(securityrec us, securityrec ref)
{
Syslog('B', "User %5d %08lx %08lx", us.level, us.flags, ~us.flags);
Syslog('B', "Ref. %5d %08lx %08lx", le_int(ref.level), ref.flags, ref.notflags);
if (us.level < le_int(ref.level))
return FALSE;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -155,7 +155,6 @@ int hangup()
void aftercall()
{
Syslog('d', "Reading link stat (aftercall)");
FLUSHIN();
FLUSHOUT();
chat(modem.info, CFG.timeoutreset, TRUE, NULL);

View File

@ -132,8 +132,7 @@ int sendfiles(file_list *tosend)
while (((c = GETCHAR(15)) >= 0) && (c != NAK) && (c != 'C') &&
(count++ < 9))
Syslog('s', "got '%s' waiting for C/NAK",
printablec(c));
Syslog('s', "got '%s' waiting for C/NAK", printablec(c));
if (c == NAK)
session_flags &= ~FTSC_XMODEM_CRC;

View File

@ -306,7 +306,6 @@ SM_START(init)
SM_STATE(init)
Syslog('i', "RXEMSI: init");
gpt_resettimers();
gpt_settimer(0, 60);
gpt_settimer(1, 20);
@ -314,7 +313,6 @@ SM_STATE(init)
SM_STATE(waitpkt)
Syslog('i', "RXEMSI: waitpkt");
standby = 0;
gpt_settimer(1, 20);
SM_PROCEED(waitchar);
@ -410,8 +408,6 @@ SM_STATE(getdat)
SM_STATE(checkpkt)
Syslog('i', "RXEMSI: checkpkt");
if (strncasecmp(databuf,"EMSI_DAT",8) == 0) {
SM_PROCEED(checkdat);
}
@ -483,13 +479,12 @@ SM_STATE(sendnak)
SM_STATE(sendack)
Syslog('i', "RXEMSI: send **EMSI_ACKA490 (2 times)");
PUTSTR((char *)"**EMSI_ACKA490\r\021");
PUTSTR((char *)"**EMSI_ACKA490\r\021");
SM_SUCCESS;
SM_END
Syslog('i', "RXEMSI: end");
free(databuf);
SM_RETURN
@ -526,7 +521,6 @@ SM_EDECL
Syslog('i', "TXEMSI: 60 seconds timer set");
SM_START(senddata)
Syslog('i', "TXEMSI: start");
SM_STATE(senddata)
@ -618,13 +612,11 @@ SM_STATE(checkpkt)
SM_STATE(sendack)
Syslog('i', "TXEMSI: send **EMSI_ACKA490 (2 times)");
PUTSTR((char *)"**EMSI_ACKA490\r\021");
PUTSTR((char *)"**EMSI_ACKA490\r\021");
SM_PROCEED(waitpkt);
SM_END
Syslog('i', "TXEMSI: end");
SM_RETURN

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -240,7 +240,6 @@ char *mkemsidat(int caller)
sprintf(cbuf,"%04X",(unsigned int)strlen(p+12));
memcpy(p+8,cbuf,4);
Syslog('I',"Prepared: \"%s\"",p);
emsiencode(NULL); /* Free memory */
return p;
}
@ -340,8 +339,6 @@ int scanemsidat(char *buf)
char *p, *q, *mailer_prod, *mailer_name, *mailer_version, *mailer_serial;
int dupe;
Syslog('I',"got data packet: \"%s\"",buf);
p = sel_brace(buf);
if (strcasecmp(p,"EMSI") != 0) {
Syslog('?', "This can never occur. Got \"%s\" instead of \"EMSI\"",p);

View File

@ -477,8 +477,6 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
}
free(temp);
Syslog('o', "B4 FTS-0001 checkpoint");
/*
* For FTS-0001 we need to create at least one packet.
*/

View File

@ -318,7 +318,6 @@ int main(int argc, char *argv[])
(strncasecmp(p,"EMSI_",5) == 0)) {
master = 0;
answermode = argv[optind];
Syslog('S', "Inbound \"%s\" mode", MBSE_SS(answermode));
} else {
if ((addr = parsefaddr(argv[optind]))) {
immediatecall = TRUE;

View File

@ -1,11 +1,10 @@
/*****************************************************************************
*
* File ..................: mbcico/recvbark.c
* $Id$
* Purpose ...............: Fidonet mailer
* Last modification date : 01-Jan-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -88,8 +87,6 @@ SM_START(sendenq)
SM_STATE(sendenq)
Syslog('s', "recvbark SENDINQ");
count = 0;
PUTCHAR(ENQ);
if (STATUS) {
@ -100,8 +97,6 @@ SM_STATE(sendenq)
SM_STATE(waitack)
Syslog('s', "recvbark WAITACK");
if (count++ > 10) {
Syslog('+', "Wait for Bark Request: timeout");
PUTCHAR(ETB);
@ -134,7 +129,6 @@ SM_STATE(waitack)
SM_STATE(waitchar)
Syslog('s', "recvbark WAITCHAR");
c=GETCHAR(15);
if (c == TIMEOUT) {
Syslog('s', "Recvbark got timeout waiting for char");
@ -157,7 +151,6 @@ SM_STATE(waitchar)
SM_STATE(scanreq)
Syslog('s', "recvbark SCANREQ");
lcrc = crc16xmodem(buf, strlen(buf));
c1 = GETCHAR(15);
if (c1 == TIMEOUT) {
@ -181,7 +174,6 @@ SM_STATE(scanreq)
SM_STATE(sendack)
Syslog('s', "recvbark SENDACK");
count = 0;
PUTCHAR(ACK);
tosend = respond_bark(buf);
@ -218,7 +210,6 @@ SM_STATE(waitnak)
SM_STATE(sendfiles)
Syslog('s', "recvbark SENDFILES");
rc = xmsndfiles(tosend);
tidy_filelist(tosend, 0);
if (rc == 0) {

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer - respond to filerequests
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -66,8 +66,7 @@ static int no_more = FALSE;
file_list *respond_wazoo(void)
{
char buf[256];
char *nm, *pw, *dt, *p;
char buf[256], *nm, *pw, *dt, *p;
file_list *fl=NULL, **tmpl;
FILE *fp;
@ -94,15 +93,14 @@ file_list *respond_wazoo(void)
p = strtok(NULL," \n\r");
if (p && (*p == '!'))
pw = p+1;
else
if (p && ((*p == '+') || (*p == '-')))
else if (p && ((*p == '+') || (*p == '-')))
dt = p;
p = strtok(NULL," \n\r");
if (p && (*p == '!'))
pw = p+1;
else
if (p && ((*p == '+') || (*p == '-')))
else if (p && ((*p == '+') || (*p == '-')))
dt = p;
*tmpl = respfreq(nm, pw, dt);
while (*tmpl) tmpl=&((*tmpl)->next);
if (no_more)
@ -114,7 +112,7 @@ file_list *respond_wazoo(void)
free(freqname);
freqname = NULL;
for (tmpl = &fl; *tmpl; tmpl = &((*tmpl)->next)) {
Syslog('F', "resplist: %s",MBSE_SS((*tmpl)->local));
Syslog('f', "resplist: %s",MBSE_SS((*tmpl)->local));
}
attach_report(&fl);
return fl;
@ -148,6 +146,7 @@ file_list *respond_bark(char *buf)
*p = '\0';
}
}
fl = respfreq(nm, pw, dt);
attach_report(&fl);
return fl;
@ -612,7 +611,6 @@ static void attach_report(file_list **fl)
records = (ftell(fp) - olhdr.hdrsize) / olhdr.recsize;
srand(getpid());
recno = 1+(int) (1.0 * records * rand() / (RAND_MAX + 1.0));
Syslog('f', "Selected quote %d out of %d records", recno, records);
if (fseek(fp, olhdr.hdrsize + (recno * olhdr.recsize), SEEK_SET) == 0) {
if (fread(&ol, olhdr.recsize, 1, fp) == 1) {
add_report((char *)"\r... %s", ol.Oneline);

View File

@ -63,7 +63,7 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo
Syslog('o' ,"scan_dir \"%s\" (%s)",MBSE_SS(dname),ispoint?"point":"node");
if ((dp = opendir(dname)) == NULL) {
Syslog('-', "Creating directory %s", dname);
Syslog('+', "Creating directory %s", dname);
/*
* Create a fake filename, mkdirs() likes that.
*/

View File

@ -1,11 +1,10 @@
/*****************************************************************************
*
* File ..................: mbcico/sendbark.c
* $Id$
* Purpose ...............: Fidonet mailer
* Last modification date : 29-Oct-2000
*
*****************************************************************************
* Copyright (C) 1997-2000
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -123,12 +122,10 @@ SM_NAMES
(char *)"getfile"
SM_EDECL
int c;
char buf[256];
unsigned short crc;
int count = 0;
int c, count = 0;
Syslog('s', "send_bark INIT");
sprintf(buf,"%s %s %s",nm,dt,pw);
crc = crc16xmodem(buf, strlen(buf));
Syslog('s', "sending bark packet \"%s\", crc = 0x%04x", buf, crc);
@ -137,7 +134,6 @@ SM_START(Send)
SM_STATE(Send)
Syslog('s', "send_bark SEND");
if (count++ > 5) {
Syslog('+', "Bark request failed");
SM_ERROR;
@ -156,7 +152,6 @@ SM_STATE(Send)
SM_STATE(waitack)
Syslog('s', "send_bark WAITACK");
c = GETCHAR(10);
if (c == TIMEOUT) {
Syslog('s', "sendbark got timeout waiting for ACK");
@ -172,7 +167,6 @@ SM_STATE(waitack)
SM_STATE(getfile)
Syslog('s', "send_bark GETFILE");
switch (xmrecv(NULL)) {
case 0: SM_PROCEED(getfile);
break;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -229,7 +229,6 @@ SM_START(skipjunk)
SM_STATE(skipjunk)
Syslog('s', "tx_define_type SKIPJUNK");
while ((c = GETCHAR(1)) >= 0) /*nothing*/ ;
if (c == TIMEOUT) {
gpt_resettimers();
@ -241,7 +240,6 @@ SM_STATE(skipjunk)
SM_STATE(wake)
Syslog('s', "tx_define_type WAKE");
if (gpt_expired(0)) {
Syslog('+', "Remote did not respond");
SM_ERROR;
@ -256,7 +254,6 @@ SM_STATE(wake)
SM_ERROR;
} else {
gpt_settimer(0, 60);
Syslog('S', "Got %c wakeup", c);
SM_PROCEED(nextchar);
}
@ -364,17 +361,13 @@ SM_STATE(checkintro)
SM_STATE(sendinq)
Syslog('s', "tx_define_type SENDINQ");
PUTCHAR(DC1);
if ((localoptions & NOEMSI) == 0) {
Syslog('S', "send **EMSI_INQC816 (2 times)");
PUTSTR((char *)"\r**EMSI_INQC816\r**EMSI_INQC816");
}
if ((localoptions & NOWAZOO) == 0) {
Syslog('S', "send YOOHOO char");
PUTCHAR(YOOHOO);
}
Syslog('S', "send TSYNC char");
PUTCHAR(TSYNC);
if ((localoptions & NOEMSI) == 0)
PUTSTR((char *)"\r\021");

View File

@ -172,8 +172,6 @@ static int tty_read(char *buf, int size, int tot)
fd_set readfds, writefds, exceptfds;
struct timeval seltimer;
// Syslog('t', "tty_read(buf, %d, %d)", size, tot);
if (size == 0)
return 0;
tty_status = 0;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2002
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -104,10 +104,8 @@ int txwazoo(void)
char *nonhold_mail;
Syslog('+', "Start WaZOO session");
// if (localoptions & NOHOLD)
nonhold_mail = (char *)ALL_MAIL;
// else
// nonhold_mail = (char *)NONHOLD_MAIL;
if (emsi_remote_lcodes & LCODE_HAT) {
Syslog('+', "Remote asked to \"hold all traffic\", no send");
tosend = NULL;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -149,7 +149,6 @@ SM_EDECL
off_t remsize=0;
int goteot = FALSE;
Syslog('x', "xmrecv INIT");
gettimeofday(&starttime, &tz);
recv_blk=-1L;
@ -181,7 +180,6 @@ SM_STATE(sendnak0)
SM_STATE(waitblk0)
Syslog('x', "xmrecv WAITBLK0");
header = GETCHAR(5);
if (header == TIMEOUT) {
Syslog('x', "timeout waiting for xmodem block 0 header, count=%d", count);
@ -248,7 +246,6 @@ SM_STATE(waitblk0)
SM_STATE(sendnak)
Syslog('x', "xmrecv SENDNAK");
if (ackd_blk < 0) {
SM_PROCEED(sendnak0);
}
@ -306,7 +303,6 @@ SM_STATE(sendack)
SM_STATE(waitblk)
Syslog('x', "xmrecv WAITBLK");
header = GETCHAR(15);
if (header == TIMEOUT) {
Syslog('x', "timeout waiting for xmodem block header, count=%d", count);
@ -344,7 +340,6 @@ SM_STATE(waitblk)
SM_STATE(recvblk)
Syslog('x', "xmrecv RECVBLK");
Nopper();
GET((char*)&xmblk,(crcmode && (header != SYN))? sizeof(xmblk): sizeof(xmblk)-1,15);
if (STATUS == STAT_TIMEOUT) {
@ -442,8 +437,7 @@ SM_STATE(recvblk)
SM_STATE(checktelink)
Syslog('x', "xmrecv CHECKTELINK");
Syslog('X', "checktelink got \"%s\"",printable(xmblk.data,45));
Syslog('x', "checktelink got \"%s\"",printable(xmblk.data,45));
if (tmpfname[0] == '\0') {
strncpy(tmpfname,xmblk.data+8,16);
/*
@ -457,7 +451,7 @@ SM_STATE(checktelink)
}
} else {
Syslog('+', "Remote uses %s",printable(xmblk.data+25,-14));
Syslog('X', "Remote file name \"%s\" discarded", printable(xmblk.data+8,-16));
Syslog('x', "Remote file name \"%s\" discarded", printable(xmblk.data+8,-16));
}
remsize = ((off_t)xmblk.data[0]) + ((off_t)xmblk.data[1]<<8) + ((off_t)xmblk.data[2]<<16) + ((off_t)xmblk.data[3]<<24);
last_blk = (remsize-1)/XMBLKSIZ+1;
@ -518,7 +512,6 @@ SM_STATE(checktelink)
SM_STATE(recvm7)
Syslog('x', "xmrecv RECVM7");
switch (m7recv(tmpfname)) {
case 0: ackd_blk=0;
SM_PROCEED(sendnak);
@ -531,7 +524,6 @@ SM_STATE(recvm7)
SM_STATE(goteof)
Syslog('x', "xmrecv GOTEOF");
Slo = FALSE;
closeit(1);
if (ackd_blk == -1L)

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -124,7 +124,6 @@ SM_EDECL
fl.l_start=0L;
fl.l_len=0L;
Syslog('x', "xmsend INIT");
gettimeofday(&starttime, &tz);
/* if we got 'C' than hopefully remote is sealink capable... */
@ -185,7 +184,6 @@ SM_START(startstate)
SM_STATE(sendm7)
Syslog('x', "xmsend SENDM7");
if (m7send(rn)) {
SM_PROCEED(sendblk0);
} else {
@ -194,7 +192,6 @@ SM_STATE(sendm7)
SM_STATE(sendblk0)
Syslog('X', "xmsend SENDBLK0");
Syslog('x', "xmsendblk0 send:%ld, next:%ld, ackd:%ld, last:%ld", send_blk,next_blk,ackd_blk,last_blk);
memset(xmblk.data,0,sizeof(xmblk.data));
@ -217,22 +214,20 @@ SM_STATE(sendblk0)
xmblk.data[41]=((session_flags & FTSC_XMODEM_RES) != 0);
xmblk.data[42]=((session_flags & FTSC_XMODEM_XOF) != 0);
Syslog('X', "sealink block: \"%s\"",printable(xmblk.data,44));
Syslog('x', "sealink block: \"%s\"",printable(xmblk.data,44));
next_blk=send_blk+1;
SM_PROCEED(sendblk);
SM_STATE(sendblk)
Syslog('X', "xmsend SENDBLK %d", send_blk);
Syslog('x', "xmsendblk send:%ld, next:%ld, ackd:%ld, last:%ld", send_blk,next_blk,ackd_blk,last_blk);
if (send_blk == 0) {
SM_PROCEED(writeblk);
}
Syslog('x', "xmsendblk send:%ld, next:%ld, ackd:%ld, last:%ld", send_blk,next_blk,ackd_blk,last_blk);
if (send_blk > last_blk) {
Syslog('X', "send_blk > last_blk");
Syslog('x', "send_blk > last_blk");
if (send_blk == (last_blk+1)) {
SM_PROCEED(sendeot);
} else if (ackd_blk < last_blk) {
@ -264,7 +259,6 @@ SM_STATE(sendblk)
SM_STATE(writeblk)
Syslog('X', "xmsend WRITEBLK");
Nopper();
xmblk.n1=send_blk&0xff;
xmblk.n2=~xmblk.n1;
@ -290,7 +284,6 @@ SM_STATE(writeblk)
SM_STATE(waitack)
Syslog('x', "xmsend WAITACK");
if ((count > 4) && (ackd_blk < 0)) {
Syslog('+', "Cannot send sealink block, try xmodem");
window=1;
@ -309,7 +302,6 @@ SM_STATE(waitack)
}
a = GETCHAR(20);
Syslog('X', "xmsend got 0x%02x", a);
if (a == TIMEOUT) {
if (count++ > 9) {
Syslog('+', "too many tries to send block");
@ -356,7 +348,6 @@ SM_STATE(waitack)
case 1:
a1=GETCHAR(1);
a2=GETCHAR(1);
Syslog('X', "got block ACK %d", a1);
if ((a1 < 0) || (a2 < 0) || (a1 != ((~a2)&0xff))) {
Syslog('x', "bad ACK: 0x%02x/0x%02x, ignore", a1,a2);
SM_PROCEED(sendblk);
@ -417,7 +408,6 @@ SM_STATE(waitack)
SM_STATE(resync)
Syslog('x', "xmsend RESYNC");
if (count++ > 9) {
Syslog('+', "too may tries to resync");
SM_ERROR;
@ -464,7 +454,6 @@ SM_STATE(resync)
SM_STATE(sendeot)
Syslog('x', "xmsend SENDEOT");
PUTCHAR(EOT);
if (STATUS) {
SM_ERROR;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2003
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10

View File

@ -1,4 +1,6 @@
/*
* $Id$
*
* Z M . C
* Copyright 1994 Omen Technology Inc All Rights Reserved
* ZMODEM protocol primitives
@ -712,20 +714,16 @@ int zrbhd32(register char *shdr)
Rxtype = c;
crc = 0xFFFFFFFFL; crc = updcrc32(c, crc);
Syslog('Z', "zrbhd32 c=%X crc=%lX", c, crc);
for (n=Rxhlen; --n >= 0; ++shdr) {
if ((c = zdlread()) & ~0377)
return c;
crc = updcrc32(c, crc);
*shdr = c;
Syslog('Z', "zrbhd32 c=%X crc=%lX", c, crc);
}
for (n=4; --n >= 0;) {
if ((c = zdlread()) & ~0377)
return c;
crc = updcrc32(c, crc);
Syslog('Z', "zrbhd32 c=%X crc=%lX", c, crc);
}
if (crc != 0xDEBB20E3) {
Syslog('+', "Zmodem zrbhd32: Bad CRC");
@ -791,7 +789,6 @@ void zputhex(register int c)
{
static char digits[] = "0123456789abcdef";
Syslog('Z', "zputhex: %02X", c);
BUFFER_BYTE(digits[(c&0xF0)>>4]);
BUFFER_BYTE(digits[(c)&0xF]);
}
@ -847,7 +844,6 @@ int zgethex(void)
register int c;
c = zgeth1();
Syslog('Z', "zgethex: %02X", c);
return c;
}

View File

@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2001
* Copyright (C) 1997-2004
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -399,7 +399,6 @@ again:
lastcrcrq = Rxpos;
crc = 0xFFFFFFFFL;
fseek(in, 0L, 0);
Syslog('Z', "bytcnt=%ld crc=%08lX", bytcnt, crc);
while (((c = getc(in)) != EOF) && --lastcrcrq)
crc = updcrc32(c, crc);
crc = ~crc;