First stage port to 64 bit
This commit is contained in:
@@ -46,8 +46,8 @@
|
||||
|
||||
extern int carrier, online;
|
||||
extern time_t c_start, c_end;
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int sentbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
extern int Loaded;
|
||||
|
||||
int answer(char *stype)
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -33,11 +33,11 @@
|
||||
#include "atoul.h"
|
||||
|
||||
|
||||
unsigned long atoul(char *str)
|
||||
unsigned int atoul(char *str)
|
||||
{
|
||||
unsigned long x;
|
||||
unsigned int x;
|
||||
|
||||
if (sscanf(str,"%lu",&x) == 1)
|
||||
if (sscanf(str,"%u",&x) == 1)
|
||||
return x;
|
||||
else return 0xffffffff;
|
||||
}
|
||||
|
@@ -1,8 +1,9 @@
|
||||
#ifndef _ATOUL_H
|
||||
#define _ATOUL_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
unsigned long atoul(char *);
|
||||
unsigned int atoul(char *);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -80,8 +80,8 @@ extern int crashme;
|
||||
int gotblock = 0;
|
||||
|
||||
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int sentbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
|
||||
typedef enum {RxWaitF, RxAccF, RxReceD, RxWriteD, RxEOB, RxDone} RxType;
|
||||
typedef enum {TxGNF, TxTryR, TxReadS, TxWLA, TxDone} TxType;
|
||||
@@ -154,8 +154,8 @@ struct binkprec {
|
||||
unsigned short header; /* Frame header */
|
||||
int rc; /* General return code */
|
||||
|
||||
long rsize; /* Receiver filesize */
|
||||
long roffs; /* Receiver offset */
|
||||
int rsize; /* Receiver filesize */
|
||||
int roffs; /* Receiver offset */
|
||||
char *rname; /* Receiver filename */
|
||||
time_t rtime; /* Receiver filetime */
|
||||
FILE *rxfp; /* Receiver file */
|
||||
@@ -174,13 +174,13 @@ struct binkprec {
|
||||
int stxpos; /* Transmitter start position */
|
||||
int txcompressed; /* Transmitter compressed bytes */
|
||||
int tmode; /* Transmitter compression mode */
|
||||
long tfsize; /* Transmitter filesize */
|
||||
int tfsize; /* Transmitter filesize */
|
||||
|
||||
int local_EOB; /* Local EOB sent */
|
||||
int remote_EOB; /* Got EOB from remote */
|
||||
int messages; /* Messages sent + rcvd */
|
||||
unsigned long nethold; /* Netmail on hold */
|
||||
unsigned long mailhold; /* Packed mail on hold */
|
||||
unsigned int nethold; /* Netmail on hold */
|
||||
unsigned int mailhold; /* Packed mail on hold */
|
||||
|
||||
int batchnr;
|
||||
int msgs_on_queue; /* Messages on the queue */
|
||||
@@ -229,7 +229,7 @@ int binkp_expired(void); /* Timer expired? */
|
||||
int binkp_banner(int); /* Send system banner */
|
||||
int binkp_send_comp_opts(void); /* Send compression options */
|
||||
void binkp_set_comp_state(void); /* Set compression state */
|
||||
int binkp_recv_command(char *, unsigned long *, int *); /* Receive command frame */
|
||||
int binkp_recv_command(char *, unsigned int *, int *); /* Receive command frame */
|
||||
void parse_m_nul(char *); /* Parse M_NUL message */
|
||||
int binkp_poll_frame(void); /* Poll for a frame */
|
||||
void binkp_add_message(char *frame); /* Add cmd frame to queue */
|
||||
@@ -390,7 +390,7 @@ SM_EDECL
|
||||
faddr *primary;
|
||||
char *p, *q, *pwd;
|
||||
int i, rc = 0, cmd, dupe, SendPass = FALSE, akas = 0;
|
||||
unsigned long bufl;
|
||||
unsigned int bufl;
|
||||
fa_list **tmp, *tmpa;
|
||||
faddr *fa, ra;
|
||||
callstat *cst;
|
||||
@@ -664,7 +664,7 @@ SM_NAMES
|
||||
SM_EDECL
|
||||
char *p, *q, *pw;
|
||||
int i, rc, cmd, dupe, we_have_pwd = FALSE, akas = 0;
|
||||
unsigned long bufl;
|
||||
unsigned int bufl;
|
||||
fa_list **tmp, *tmpa;
|
||||
faddr *fa;
|
||||
callstat *cst;
|
||||
@@ -1041,7 +1041,7 @@ int file_transfer(void)
|
||||
TrType binkp_receiver(void)
|
||||
{
|
||||
struct statfs sfs;
|
||||
long written;
|
||||
int written;
|
||||
off_t rxbytes;
|
||||
int bcmd, rc = 0;
|
||||
int rc1 = 0, nget = bp.blklen, zavail, nput;
|
||||
@@ -1181,8 +1181,8 @@ TrType binkp_receiver(void)
|
||||
|
||||
if (statfs(tempinbound, &sfs) == 0) {
|
||||
if ((bp.rsize / (sfs.f_bsize + 1)) >= sfs.f_bfree) {
|
||||
Syslog('!', "Binkp: only %lu blocks free (need %lu) in %s for this file", sfs.f_bfree,
|
||||
(unsigned long)(bp.rsize / (sfs.f_bsize + 1)), tempinbound);
|
||||
Syslog('!', "Binkp: only %u blocks free (need %u) in %s for this file", sfs.f_bfree,
|
||||
(unsigned int)(bp.rsize / (sfs.f_bsize + 1)), tempinbound);
|
||||
bclosefile(FALSE);
|
||||
bp.rxfp = NULL; /* Force SKIP command */
|
||||
}
|
||||
@@ -1521,10 +1521,10 @@ TrType binkp_transmitter(void)
|
||||
bp.txcompressed = 0;
|
||||
bp.tfsize = tmp->size;
|
||||
Syslog('+', "Binkp: send \"%s\" as \"%s\"", MBSE_SS(tmp->local), MBSE_SS(tmp->remote));
|
||||
Syslog('+', "Binkp: size %lu bytes, dated %s, comp %s",
|
||||
(unsigned long)tmp->size, date(tmp->date), cpstate[bp.tmode]);
|
||||
rc = binkp_send_command(MM_FILE, "%s %lu %ld %ld%s", MBSE_SS(tmp->remote),
|
||||
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset, extra);
|
||||
Syslog('+', "Binkp: size %u bytes, dated %s, comp %s",
|
||||
(unsigned int)tmp->size, date(tmp->date), cpstate[bp.tmode]);
|
||||
rc = binkp_send_command(MM_FILE, "%s %u %d %d%s", MBSE_SS(tmp->remote),
|
||||
(unsigned int)tmp->size, (int)tmp->date, (unsigned int)tmp->offset, extra);
|
||||
if (rc) {
|
||||
bp.TxState = TxDone;
|
||||
return Failure;
|
||||
@@ -1772,7 +1772,7 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
int rc, id;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
int rcz, last;
|
||||
unsigned long zlen;
|
||||
uLongf zlen;
|
||||
char *zbuf;
|
||||
|
||||
if ((len >= BINKP_PLZ_BLOCK) && (bp.PLZwe == Active)) {
|
||||
@@ -2077,7 +2077,7 @@ void binkp_set_comp_state(void)
|
||||
/*
|
||||
* Receive command frame
|
||||
*/
|
||||
int binkp_recv_command(char *buf, unsigned long *len, int *cmd)
|
||||
int binkp_recv_command(char *buf, unsigned int *len, int *cmd)
|
||||
{
|
||||
int b0, b1;
|
||||
|
||||
@@ -2244,7 +2244,7 @@ int binkp_poll_frame(void)
|
||||
{
|
||||
int c, rc = 0, bcmd;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
unsigned long zlen;
|
||||
uLongf zlen;
|
||||
char *zbuf;
|
||||
#endif
|
||||
|
||||
@@ -2380,7 +2380,7 @@ int binkp_process_messages(void)
|
||||
int Found, rmode;
|
||||
char *lname, *ropts;
|
||||
time_t ltime;
|
||||
long lsize, loffs;
|
||||
int lsize, loffs;
|
||||
|
||||
Syslog('b', "Binkp: Process The Messages Queue Start");
|
||||
|
||||
|
@@ -55,7 +55,7 @@ FILE *bopenfile(char *fname, time_t remtime, off_t remsize, off_t *resofs)
|
||||
|
||||
strcpy(ctt,date(remtime));
|
||||
|
||||
Syslog('b', "Binkp: bopenfile(\"%s\",%s,%lu)", MBSE_SS(fname), MBSE_SS(ctt), (unsigned long)remsize);
|
||||
Syslog('b', "Binkp: bopenfile(\"%s\",%s,%u)", MBSE_SS(fname), MBSE_SS(ctt), (unsigned int)remsize);
|
||||
|
||||
if ((fname == NULL) || (fname[0] == '\0')) {
|
||||
Syslog('+', "Binkp: bopenfile fname=NULL");
|
||||
@@ -100,8 +100,8 @@ FILE *bopenfile(char *fname, time_t remtime, off_t remsize, off_t *resofs)
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
snprintf(temp, PATH_MAX, "%s.state", infpath);
|
||||
if ((fp = fopen(temp, "w"))) {
|
||||
fprintf(fp, "%lu\n", (unsigned long)remtime);
|
||||
fprintf(fp, "%lu\n", (unsigned long)remsize);
|
||||
fprintf(fp, "%u\n", (unsigned int)remtime);
|
||||
fprintf(fp, "%u\n", (unsigned int)remsize);
|
||||
fclose(fp);
|
||||
}
|
||||
free(temp);
|
||||
@@ -116,7 +116,7 @@ FILE *bopenfile(char *fname, time_t remtime, off_t remsize, off_t *resofs)
|
||||
freqname = xstrcat(freqname, fname);
|
||||
}
|
||||
|
||||
Syslog('b', "Binkp: opened file \"%s\", restart at %lu", infpath, (unsigned long)*resofs);
|
||||
Syslog('b', "Binkp: opened file \"%s\", restart at %u", infpath, (unsigned int)*resofs);
|
||||
return infp;
|
||||
}
|
||||
|
||||
|
@@ -3,9 +3,9 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
extern long configtime;
|
||||
extern long maxfsize;
|
||||
extern long maxmsize;
|
||||
extern int configtime;
|
||||
extern int maxfsize;
|
||||
extern int maxmsize;
|
||||
|
||||
|
||||
extern char *name;
|
||||
|
@@ -45,8 +45,8 @@ extern time_t c_end;
|
||||
extern int online;
|
||||
extern int master;
|
||||
int carrier;
|
||||
extern long sentbytes;
|
||||
extern long rcvdbytes;
|
||||
extern int sentbytes;
|
||||
extern int rcvdbytes;
|
||||
extern int Loaded;
|
||||
|
||||
|
||||
|
@@ -220,7 +220,7 @@ char *mkemsidat(int caller)
|
||||
p=xstrcat(p,phone?emsiencode(phone):(char *)"-Unpublished-");
|
||||
p=xstrcat(p,(char *)"][");
|
||||
if ((CFG.IP_Speed) && (emsi_local_protos & PROT_TCP))
|
||||
snprintf(cbuf,16,"%ld",CFG.IP_Speed);
|
||||
snprintf(cbuf,16,"%d",CFG.IP_Speed);
|
||||
else
|
||||
strcpy(cbuf,"9600");
|
||||
p=xstrcat(p,cbuf);
|
||||
@@ -228,7 +228,7 @@ char *mkemsidat(int caller)
|
||||
p=xstrcat(p,flags?emsiencode(flags):(char *)"");
|
||||
p=xstrcat(p,(char *)"]}{TRX#}{[");
|
||||
tt = time(NULL);
|
||||
snprintf(cbuf,16,"%08lX", (unsigned long)mtime2sl(tt));
|
||||
snprintf(cbuf,16,"%08X", (unsigned int)mtime2sl(tt));
|
||||
p=xstrcat(p,cbuf);
|
||||
p=xstrcat(p,(char *)"]}{TZUTC}{[");
|
||||
p=xstrcat(p,gmtoffset(tt));
|
||||
@@ -489,21 +489,21 @@ int scanemsidat(char *buf)
|
||||
} else
|
||||
Syslog('+', "remote TRX#: %s",p);
|
||||
} else if (strcasecmp(p, "TRAF") == 0) {
|
||||
unsigned long tt, tt1;
|
||||
unsigned int tt, tt1;
|
||||
|
||||
p = sel_brace(NULL);
|
||||
if (sscanf(p, "%08lx %08lx", &tt, &tt1) == 2) {
|
||||
if (sscanf(p, "%08x %08x", &tt, &tt1) == 2) {
|
||||
Syslog('+', "netmail : %u byte(s)", tt);
|
||||
Syslog('+', "echomail: %u byte(s)", tt1);
|
||||
} else {
|
||||
Syslog('+', "TRAF : %s", p);
|
||||
}
|
||||
} else if (strcasecmp(p, "MOH#") == 0) {
|
||||
unsigned long tt;
|
||||
unsigned int tt;
|
||||
|
||||
p = sel_brace(NULL);
|
||||
p = sel_bracket(p);
|
||||
if (sscanf(p, "%08lx", &tt) == 1)
|
||||
if (sscanf(p, "%08x", &tt) == 1)
|
||||
Syslog('+', "on hold : %u byte(s)", tt);
|
||||
else
|
||||
Syslog('+', "MOH# : %s", p);
|
||||
|
@@ -53,7 +53,7 @@ static char *tmpkname(void)
|
||||
{
|
||||
static char buf[16];
|
||||
|
||||
snprintf(buf,16,"%08lx.pkt", sequencer());
|
||||
snprintf(buf,16,"%08x.pkt", sequencer());
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -490,9 +490,9 @@ file_list *create_filelist(fa_list *al, char *fl, int create)
|
||||
}
|
||||
|
||||
for (tmpf = st; tmpf; tmpf = tmpf->next)
|
||||
Syslog('o',"flist: \"%s\" -> \"%s\" dsp:%d flofp:%lu floff:%lu",
|
||||
Syslog('o',"flist: \"%s\" -> \"%s\" dsp:%d flofp:%u floff:%u",
|
||||
MBSE_SS(tmpf->local), MBSE_SS(tmpf->remote), tmpf->disposition,
|
||||
(unsigned long)tmpf->flofp, (unsigned long)tmpf->floff);
|
||||
(unsigned int)tmpf->flofp, (unsigned int)tmpf->floff);
|
||||
|
||||
return st;
|
||||
}
|
||||
@@ -612,7 +612,7 @@ void execute_disposition(file_list *fl)
|
||||
*/
|
||||
if (fseek(fl->flofp, fl->floff, 0) == 0) {
|
||||
if (fwrite(&tpl,1,1,fl->flofp) != 1) {
|
||||
WriteError("$Error writing '~' to .flo at %lu", (unsigned long)fl->floff);
|
||||
WriteError("$Error writing '~' to .flo at %u", (unsigned int)fl->floff);
|
||||
} else {
|
||||
Syslog('o', "Marked file \"%s\" as sent", MBSE_SS(nm));
|
||||
}
|
||||
@@ -625,7 +625,7 @@ void execute_disposition(file_list *fl)
|
||||
#endif
|
||||
#endif
|
||||
} else
|
||||
WriteError("$error seeking in .flo to %lu", (unsigned long)fl->floff);
|
||||
WriteError("$error seeking in .flo to %u", (unsigned int)fl->floff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ void execute_disposition(file_list *fl)
|
||||
|
||||
|
||||
|
||||
char *transfertime(struct timeval start, struct timeval end, long bytes, int sent)
|
||||
char *transfertime(struct timeval start, struct timeval end, int bytes, int sent)
|
||||
{
|
||||
static char resp[81];
|
||||
double long startms, endms, elapsed;
|
||||
@@ -670,21 +670,21 @@ char *transfertime(struct timeval start, struct timeval end, long bytes, int sen
|
||||
if (!elapsed)
|
||||
elapsed = 1L;
|
||||
if (bytes > 1000000)
|
||||
snprintf(resp, 81, "%ld bytes %s in %0.3Lf seconds (%0.3Lf Kb/s)",
|
||||
snprintf(resp, 81, "%d bytes %s in %0.3Lf seconds (%0.3Lf Kb/s)",
|
||||
bytes, sent?"sent":"received", elapsed / 1000.000, ((bytes / elapsed) * 1000) / 1024);
|
||||
else
|
||||
snprintf(resp, 81, "%ld bytes %s in %0.3Lf seconds (%0.3Lf Kb/s)",
|
||||
snprintf(resp, 81, "%d bytes %s in %0.3Lf seconds (%0.3Lf Kb/s)",
|
||||
bytes, sent?"sent":"received", elapsed / 1000.000, ((bytes * 1000) / elapsed) / 1024);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *compress_stat(long original, long saved)
|
||||
char *compress_stat(int original, int saved)
|
||||
{
|
||||
static char resp[81];
|
||||
|
||||
snprintf(resp, 81, "compressed %ld bytes, compression %0.1f%%", saved, ((saved * 100.0) / original));
|
||||
snprintf(resp, 81, "compressed %d bytes, compression %0.1f%%", saved, ((saved * 100.0) / original));
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
@@ -9,8 +9,8 @@ file_list *create_filelist(fa_list *, char *, int);
|
||||
file_list *create_freqlist(fa_list *);
|
||||
void tidy_filelist(file_list *, int);
|
||||
void execute_disposition(file_list *);
|
||||
char *transfertime(struct timeval, struct timeval, long, int);
|
||||
char *compress_stat(long, long);
|
||||
char *transfertime(struct timeval, struct timeval, int, int);
|
||||
char *compress_stat(int, int);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -368,7 +368,7 @@ SM_START(recv_packet)
|
||||
|
||||
SM_STATE(recv_packet)
|
||||
|
||||
snprintf(recvpktname,16, "%08lx.pkt",(unsigned long)sequencer());
|
||||
snprintf(recvpktname,16, "%08x.pkt", sequencer());
|
||||
if ((rc = xmrecv(recvpktname)) == 1) {
|
||||
SM_SUCCESS;
|
||||
} else if (rc == 0) {
|
||||
|
@@ -68,19 +68,19 @@ static int put_binbyte(char *outbuf, char c);
|
||||
static int put_hexbyte(char *outbuf, char c);
|
||||
static enum HyPktTypes hyrxpkt(char *rxbuf, int *rxlen, int tot);
|
||||
static void hytxpkt(enum HyPktTypes pkttype, char *txbuf, int txlen);
|
||||
static int put_flags(char *buf, unsigned long Flags);
|
||||
static unsigned long get_flags(char *buf);
|
||||
static int put_flags(char *buf, unsigned int Flags);
|
||||
static unsigned int get_flags(char *buf);
|
||||
static int resync(off_t off);
|
||||
static int hydra_batch(int role, file_list *to_send);
|
||||
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int sentbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
|
||||
|
||||
|
||||
static struct h_flags_struct {
|
||||
char *str;
|
||||
unsigned long val;
|
||||
unsigned int val;
|
||||
} h_flags[] =
|
||||
{
|
||||
{ (char *)"XON", HOPT_XONXOFF },
|
||||
@@ -103,28 +103,28 @@ static struct h_flags_struct {
|
||||
static int txoptions, rxoptions;
|
||||
|
||||
|
||||
static char *put_long(char *buffer, long val)
|
||||
static char *put_long(char *buffer, int val)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
buffer[0] = (unsigned long) val & 0xff;
|
||||
buffer[1] = ((unsigned long) val >> 8) & 0xff;
|
||||
buffer[2] = ((unsigned long) val >> 16) & 0xff;
|
||||
buffer[3] = ((unsigned long) val >> 24) & 0xff;
|
||||
buffer[0] = (unsigned int) val & 0xff;
|
||||
buffer[1] = ((unsigned int) val >> 8) & 0xff;
|
||||
buffer[2] = ((unsigned int) val >> 16) & 0xff;
|
||||
buffer[3] = ((unsigned int) val >> 24) & 0xff;
|
||||
#else
|
||||
*(unsigned long *) buffer = (unsigned long) val;
|
||||
*(unsigned int *) buffer = (unsigned int) val;
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static long get_long(char *buffer)
|
||||
static int get_long(char *buffer)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
return ((unsigned long) ((unsigned char) buffer[0])) | ((unsigned long) ((unsigned char) buffer[1]) << 8) |
|
||||
((unsigned long) ((unsigned char) buffer[2]) << 16) | ((unsigned long) ((unsigned char) buffer[3]) << 24);
|
||||
return ((unsigned int) ((unsigned char) buffer[0])) | ((unsigned int) ((unsigned char) buffer[1]) << 8) |
|
||||
((unsigned int) ((unsigned char) buffer[2]) << 16) | ((unsigned int) ((unsigned char) buffer[3]) << 24);
|
||||
#else
|
||||
return *(long *) buffer;
|
||||
return *(int *) buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void hytxpkt(enum HyPktTypes pkttype, char *txbuf, int txlen)
|
||||
* check if we can use 32-bit CRC's
|
||||
*/
|
||||
if ((format != HCHR_HEXPKT) && (txoptions & HOPT_CRC32)) {
|
||||
unsigned long crc;
|
||||
unsigned int crc;
|
||||
|
||||
/*
|
||||
* Calc CRC-32 of data + pkttype
|
||||
@@ -471,7 +471,7 @@ void hytxpkt(enum HyPktTypes pkttype, char *txbuf, int txlen)
|
||||
|
||||
|
||||
|
||||
int put_flags(char *buf, unsigned long Flags)
|
||||
int put_flags(char *buf, unsigned int Flags)
|
||||
{
|
||||
int i, count = 0;
|
||||
|
||||
@@ -494,9 +494,9 @@ int put_flags(char *buf, unsigned long Flags)
|
||||
|
||||
|
||||
|
||||
unsigned long get_flags(char *buf)
|
||||
unsigned int get_flags(char *buf)
|
||||
{
|
||||
unsigned long Flags = 0L;
|
||||
unsigned int Flags = 0L;
|
||||
char *p;
|
||||
int i;
|
||||
|
||||
@@ -530,11 +530,11 @@ int hydra_batch(int role, file_list *to_send)
|
||||
FILE *rxfp = NULL; /* file currently being received */
|
||||
char *inbuf, *outbuf;
|
||||
int rxlen, txlen; /* length of receive/transmit buffer */
|
||||
long txwindow, rxwindow; /* window sizes */
|
||||
long txpos;
|
||||
int txwindow, rxwindow; /* window sizes */
|
||||
int txpos;
|
||||
off_t rxpos; /* file positions */
|
||||
long stxpos, srxpos;
|
||||
long longnum;
|
||||
int stxpos, srxpos;
|
||||
int longnum;
|
||||
int hdxlink = FALSE;
|
||||
int txretries, rxretries;
|
||||
int txlastack, txsyncid;
|
||||
@@ -556,7 +556,7 @@ int hydra_batch(int role, file_list *to_send)
|
||||
int txcompressed, rxctries;
|
||||
#ifdef HAVE_ZLIB_H
|
||||
static char txzbuf[H_ZIPBUFLEN], rxzbuf[H_ZIPBUFLEN];
|
||||
unsigned long rxzlen, txzlen; /* length of receive/transmit compressed buffer */
|
||||
unsigned int rxzlen, txzlen; /* length of receive/transmit compressed buffer */
|
||||
int rcz, cmpblksize;
|
||||
#endif
|
||||
|
||||
@@ -645,9 +645,9 @@ int hydra_batch(int role, file_list *to_send)
|
||||
if ((pkttype == HPKT_RPOS) && (rxlen == 12)
|
||||
&& ((txstate == HTX_DATA) || (txstate == HTX_DATAACK)
|
||||
|| (txstate == HTX_XWAIT) || (txstate == HTX_EOFACK))) {
|
||||
long rpos_pos = get_long(rxbuf);
|
||||
long rpos_blksize = get_long(rxbuf + 4);
|
||||
long rpos_id = get_long(rxbuf + 8);
|
||||
int rpos_pos = get_long(rxbuf);
|
||||
int rpos_blksize = get_long(rxbuf + 4);
|
||||
int rpos_id = get_long(rxbuf + 8);
|
||||
|
||||
#ifdef HAVE_ZLIB_H
|
||||
/*
|
||||
@@ -875,7 +875,7 @@ int hydra_batch(int role, file_list *to_send)
|
||||
}
|
||||
|
||||
Syslog('+', "Hydra: send \"%s\" as \"%s\"", MBSE_SS(to_send->local), MBSE_SS(to_send->remote));
|
||||
Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned long)txstat.st_size, date(txstat.st_mtime));
|
||||
Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned int)txstat.st_size, date(txstat.st_mtime));
|
||||
gettimeofday(&txstarttime, &tz);
|
||||
}
|
||||
|
||||
@@ -901,9 +901,9 @@ int hydra_batch(int role, file_list *to_send)
|
||||
break;
|
||||
} else {
|
||||
if (to_send) {
|
||||
txlen = snprintf(txbuf, H_ZIPBUFLEN, "%08lx%08lx%08lx%08lx%08lx",
|
||||
(long)mtime2sl(txstat.st_mtime+(txstat.st_mtime%2)),
|
||||
(long)(txstat.st_size), 0UL, 0UL, 0UL);
|
||||
txlen = snprintf(txbuf, H_ZIPBUFLEN, "%08x%08x%08x%08x%08x",
|
||||
(int)mtime2sl(txstat.st_mtime+(txstat.st_mtime%2)),
|
||||
(int)(txstat.st_size), 0U, 0U, 0U);
|
||||
|
||||
/*
|
||||
* convert file name to DOS-format
|
||||
@@ -1038,9 +1038,12 @@ int hydra_batch(int role, file_list *to_send)
|
||||
Syslog('h', "Hydra: set BRAIN timer %d", H_BRAINDEAD); // 03-11-2003 MB.
|
||||
SETTIMER(TIMERNO_BRAIN, H_BRAINDEAD); // 03-11-2003 MB.
|
||||
#ifdef HAVE_ZLIB_H
|
||||
uLongf destLen;
|
||||
if (compstate == HCMP_GZ) {
|
||||
txzlen = H_ZIPBUFLEN - 4;
|
||||
rcz = compress2(txzbuf + 4, &txzlen, txbuf + 4, txlen, 9);
|
||||
destLen = (uLongf)txzlen;
|
||||
rcz = compress2(txzbuf + 4, &destLen, txbuf + 4, txlen, 9);
|
||||
txzlen = (int)destLen;
|
||||
if (rcz == Z_OK) {
|
||||
Syslog('h', "Hydra: compressed OK, srclen=%d, destlen=%d, will send compressed=%s", txlen, txzlen,
|
||||
(txzlen < txlen) ?"yes":"no");
|
||||
@@ -1357,7 +1360,7 @@ int hydra_batch(int role, file_list *to_send)
|
||||
* get desired window sizes
|
||||
*/
|
||||
txwindow = rxwindow = 0;
|
||||
sscanf(inbuf, "%08lx%08lx", &rxwindow, &txwindow);
|
||||
sscanf(inbuf, "%08x%08x", &rxwindow, &txwindow);
|
||||
|
||||
if (rxwindow < 0)
|
||||
rxwindow = 0;
|
||||
@@ -1403,10 +1406,11 @@ int hydra_batch(int role, file_list *to_send)
|
||||
else if ((rxlen > 41) && (rxbuf[rxlen - 1] == 0)) {
|
||||
time_t timestamp;
|
||||
time_t orgstamp;
|
||||
long filesize;
|
||||
int filesize, tt;
|
||||
char dosname[8 + 1 + 3 + 1], *Name;
|
||||
|
||||
sscanf(rxbuf, "%08lx%08lx%*08x%*08x%*08x", ×tamp, &filesize);
|
||||
sscanf(rxbuf, "%08x%08x%*08x%*08x%*08x", &tt, &filesize);
|
||||
timestamp = (time_t)tt;
|
||||
|
||||
/* convert timestamp to UNIX time */
|
||||
orgstamp = timestamp;
|
||||
@@ -1496,9 +1500,12 @@ int hydra_batch(int role, file_list *to_send)
|
||||
/*
|
||||
* If data packet is a zlib compressed packet, uncompress it first.
|
||||
*/
|
||||
uLongf destLen;
|
||||
if (pkttype == HPKT_ZIPDATA) {
|
||||
rxzlen = H_ZIPBUFLEN;
|
||||
rcz = uncompress(rxzbuf, &rxzlen, rxbuf + 4, rxlen - 4);
|
||||
destLen = (uLongf)rxzlen;
|
||||
rcz = uncompress(rxzbuf, &destLen, rxbuf + 4, rxlen - 4);
|
||||
rxzlen = (int)destLen;
|
||||
if (rcz == Z_OK) {
|
||||
/*
|
||||
* Uncompress data and put the data into the normal receive buffer.
|
||||
@@ -1684,7 +1691,7 @@ int hydra_batch(int role, file_list *to_send)
|
||||
*/
|
||||
if ((compstate != HCMP_NONE) && (rxctries > 2)) {
|
||||
Syslog('+', "Hydra: too much compress errors, instructing remote to stop compression");
|
||||
put_long(txbuf + 8, (long)-1L);
|
||||
put_long(txbuf + 8, (int)-1L);
|
||||
} else {
|
||||
put_long(txbuf + 8, rxsyncid);
|
||||
}
|
||||
|
@@ -196,7 +196,7 @@ int inbound_close(int success)
|
||||
/*
|
||||
* Get the free space size in the temp inbound directory.
|
||||
*/
|
||||
long inbound_space(void)
|
||||
int inbound_space(void)
|
||||
{
|
||||
struct statfs sfs;
|
||||
|
||||
|
@@ -34,6 +34,6 @@
|
||||
|
||||
int inbound_open(faddr *, int, int); /* Open temp inbound */
|
||||
int inbound_close(int); /* Close temp inbound */
|
||||
long inbound_space(void); /* Get free inbound space */
|
||||
int inbound_space(void); /* Get free inbound space */
|
||||
|
||||
#endif
|
||||
|
@@ -86,7 +86,7 @@ int IsZMH()
|
||||
}
|
||||
|
||||
|
||||
unsigned long rnd (void)
|
||||
unsigned int rnd (void)
|
||||
{
|
||||
static int i;
|
||||
|
||||
|
@@ -6,6 +6,6 @@
|
||||
void setmyname(char *);
|
||||
char *date(time_t);
|
||||
int IsZMH(void);
|
||||
unsigned long rnd(void);
|
||||
unsigned int rnd(void);
|
||||
|
||||
#endif
|
||||
|
@@ -56,8 +56,8 @@ time_t t_end;
|
||||
time_t c_start;
|
||||
time_t c_end;
|
||||
int online = 0;
|
||||
unsigned long sentbytes = 0;
|
||||
unsigned long rcvdbytes = 0;
|
||||
unsigned int sentbytes = 0;
|
||||
unsigned int rcvdbytes = 0;
|
||||
int tcp_mode = TCPMODE_NONE;
|
||||
int Loaded = FALSE;
|
||||
int telnet = FALSE;
|
||||
|
@@ -38,7 +38,7 @@ typedef unsigned char *POINTER;
|
||||
/* UINT2 defines a two byte word */
|
||||
typedef unsigned short int UINT2;
|
||||
/* UINT4 defines a four byte word */
|
||||
typedef unsigned long int UINT4;
|
||||
typedef unsigned int UINT4;
|
||||
|
||||
/* end of GLOBAL.H ---------------------------------------------------------- */
|
||||
|
||||
|
@@ -61,10 +61,10 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r
|
||||
|
||||
strcpy(ctt,date(remtime));
|
||||
|
||||
Syslog('s', "openfile(\"%s\",%s,%lu,...)", MBSE_SS(fname), MBSE_SS(ctt), (unsigned long)remsize);
|
||||
Syslog('s', "openfile(\"%s\",%s,%lu,...)", MBSE_SS(fname), MBSE_SS(ctt), (unsigned int)remsize);
|
||||
|
||||
if ((fname == NULL) || (fname[0] == '\0')) {
|
||||
snprintf(tmpfname,16,"%08lx.pkt",(unsigned long)sequencer());
|
||||
snprintf(tmpfname,16,"%08x.pkt",sequencer());
|
||||
fname=tmpfname;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r
|
||||
rc = 1;
|
||||
p = strrchr(infpath,'/');
|
||||
*p = '\0';
|
||||
snprintf(ctt,32,"%08lx.doe",(unsigned long)sequencer());
|
||||
snprintf(ctt,32,"%08x.doe",sequencer());
|
||||
free(infpath);
|
||||
infpath = xstrcpy(p);
|
||||
infpath = xstrcat(infpath, ctt);
|
||||
@@ -158,7 +158,7 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r
|
||||
case 0: /* Success */
|
||||
opentype = (char *)"a+";
|
||||
*resofs = st.st_size;
|
||||
Syslog('+', "Resyncing at offset %lu of \"%s\"", (unsigned long)st.st_size, infpath);
|
||||
Syslog('+', "Resyncing at offset %lu of \"%s\"", (unsigned int)st.st_size, infpath);
|
||||
break;
|
||||
case -1: /* Binkp did send a GET, return here and do not open file */
|
||||
free(infpath);
|
||||
@@ -184,7 +184,7 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r
|
||||
freqname = xstrcpy(infpath);
|
||||
}
|
||||
|
||||
Syslog('s', "opened file \"%s\" for \"%s\", restart at %lu", infpath,opentype,(unsigned long)*resofs);
|
||||
Syslog('s', "opened file \"%s\" for \"%s\", restart at %lu", infpath,opentype,(unsigned int)*resofs);
|
||||
return infp;
|
||||
}
|
||||
|
||||
|
@@ -52,8 +52,8 @@ extern time_t c_end;
|
||||
extern int online;
|
||||
extern int master;
|
||||
extern int carrier;
|
||||
extern long sentbytes;
|
||||
extern long rcvdbytes;
|
||||
extern int sentbytes;
|
||||
extern int rcvdbytes;
|
||||
extern int Loaded;
|
||||
static int tcp_is_open = FALSE;
|
||||
|
||||
|
@@ -301,8 +301,8 @@ int outstat()
|
||||
cst = getstatus(&(tmp->addr));
|
||||
age = time(NULL);
|
||||
age -= tmp->time;
|
||||
snprintf(temp, PATH_MAX -1, "%s %3d %9lu %s %s",
|
||||
flstr, cst->tryno, (long)tmp->size, str_time(age), ascfnode(&(tmp->addr), 0x1f));
|
||||
snprintf(temp, PATH_MAX -1, "%s %3d %9u %s %s",
|
||||
flstr, cst->tryno, (int)tmp->size, str_time(age), ascfnode(&(tmp->addr), 0x1f));
|
||||
|
||||
if (!do_quiet)
|
||||
printf("%s\n", temp);
|
||||
|
@@ -55,8 +55,8 @@ extern char *freqname;
|
||||
static void attach_report(file_list**);
|
||||
static void add_report(char *, ...);
|
||||
static char *report_text = NULL;
|
||||
static unsigned long report_total = 0L;
|
||||
static unsigned long report_count = 0L;
|
||||
static unsigned int report_total = 0L;
|
||||
static unsigned int report_count = 0L;
|
||||
static int no_more = FALSE;
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ file_list *respfreq(char *nm, char *pw, char *dt)
|
||||
time_t upd = 0L;
|
||||
int newer = 1, Send;
|
||||
FILE *fa, *fi;
|
||||
long Area;
|
||||
int Area;
|
||||
struct FILEIndex idx;
|
||||
struct _fdbarea *fdb_area = NULL;
|
||||
|
||||
@@ -432,13 +432,13 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
|
||||
int i, escaped;
|
||||
file_list *fl = NULL;
|
||||
FILE *fp, *ft;
|
||||
long zeroes = 0L;
|
||||
int zeroes = 0L;
|
||||
ftnmsg fmsg;
|
||||
char *svname;
|
||||
|
||||
Syslog('+', "Magic execute: %s", strrchr(xstrcpy(cmd), '/')+1);
|
||||
add_report((char *)"RQ: Magic \"%s\"",cmd);
|
||||
snprintf(tmpfn, PATH_MAX -1, "%s/tmp/%08lX", getenv((char *)"MBSE_ROOT"), (unsigned long)sequencer());
|
||||
snprintf(tmpfn, PATH_MAX -1, "%s/tmp/%08X", getenv((char *)"MBSE_ROOT"), (unsigned int)sequencer());
|
||||
Syslog('+', "tmpfn \"%s\"", tmpfn);
|
||||
if ((p = strrchr(cmd,'/')))
|
||||
p++;
|
||||
@@ -483,7 +483,7 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
|
||||
unlink(tmpfn);
|
||||
} else {
|
||||
if (stat(tmpfn, &st) == 0) {
|
||||
snprintf(tmptx, PATH_MAX -1, "%s/tmp/%08lX", getenv((char *)"MBSE_ROOT"), (unsigned long)sequencer());
|
||||
snprintf(tmptx, PATH_MAX -1, "%s/tmp/%08X", getenv((char *)"MBSE_ROOT"), (unsigned int)sequencer());
|
||||
Syslog('+', "tmptx \"%s\"", tmptx);
|
||||
|
||||
if ((fp = fopen(tmptx, "w"))) {
|
||||
@@ -523,7 +523,7 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
|
||||
}
|
||||
fwrite(&zeroes, 1, 3, fp);
|
||||
fclose(fp);
|
||||
snprintf(remname, 32, "%08lX.PKT", (unsigned long)sequencer());
|
||||
snprintf(remname, 32, "%08X.PKT", (unsigned int)sequencer());
|
||||
|
||||
add_list(&fl, tmptx, remname, KFS, 0L, NULL, 0);
|
||||
fmsg.from->name = svname;
|
||||
@@ -549,7 +549,7 @@ static void attach_report(file_list **fl)
|
||||
FILE *fp;
|
||||
char *tmpfn;
|
||||
char remname[14];
|
||||
long zeroes = 0L, recno, records;
|
||||
int zeroes = 0L, recno, records;
|
||||
ftnmsg fmsg;
|
||||
char *svname;
|
||||
|
||||
@@ -595,7 +595,7 @@ static void attach_report(file_list **fl)
|
||||
|
||||
add_report((char *)"\r%s\r", TearLine());
|
||||
|
||||
snprintf(tmpfn, PATH_MAX -1, "%s/tmp/%08lX.rpl", getenv((char *)"MBSE_ROOT"), (unsigned long)sequencer());
|
||||
snprintf(tmpfn, PATH_MAX -1, "%s/tmp/%08X.rpl", getenv((char *)"MBSE_ROOT"), (unsigned int)sequencer());
|
||||
if ((fp = fopen(tmpfn,"w"))) {
|
||||
fmsg.flags = M_PVT|M_KILLSENT;
|
||||
fmsg.from = bestaka_s(remote->addr);
|
||||
@@ -622,7 +622,7 @@ static void attach_report(file_list **fl)
|
||||
fwrite(report_text, 1, strlen(report_text), fp);
|
||||
fwrite(&zeroes, 1, 3, fp);
|
||||
fclose(fp);
|
||||
snprintf(remname, 14, "%08lX.PKT", (unsigned long)sequencer());
|
||||
snprintf(remname, 14, "%08X.PKT", (unsigned int)sequencer());
|
||||
add_list(fl, tmpfn, remname, KFS, 0L, NULL, 0);
|
||||
fmsg.from->name = svname;
|
||||
} else {
|
||||
|
@@ -58,7 +58,7 @@ static FILE *in;
|
||||
static char txbuf[TCP_BLKSIZE];
|
||||
static char rxbuf[TCP_BLKSIZE];
|
||||
static int rx_type;
|
||||
static long sbytes;
|
||||
static int sbytes;
|
||||
struct timeval starttime, endtime;
|
||||
struct timezone tz;
|
||||
static off_t rxbytes;
|
||||
@@ -72,8 +72,8 @@ static int tcp_sblk(char *,int,int);
|
||||
static int tcp_rblk(char *,int *);
|
||||
static int getsync(void);
|
||||
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int sentbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
extern char *ttystat[];
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ int tcpsndfiles(file_list *lst)
|
||||
int tcprcvfiles(void)
|
||||
{
|
||||
int rc, bufl;
|
||||
long filesize, filetime;
|
||||
int filesize, filetime;
|
||||
char *filename = NULL, *p;
|
||||
|
||||
Syslog('+', "TCP: start receive files");
|
||||
@@ -183,7 +183,7 @@ static int sendtfile(char *ln, char *rn)
|
||||
struct stat st;
|
||||
struct flock fl;
|
||||
int bufl, sverr;
|
||||
long offset;
|
||||
int offset;
|
||||
|
||||
fl.l_type = F_RDLCK;
|
||||
fl.l_whence = 0;
|
||||
@@ -215,14 +215,14 @@ static int sendtfile(char *ln, char *rn)
|
||||
|
||||
if (st.st_size > 0) {
|
||||
Syslog('+', "TCP: send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn));
|
||||
Syslog('+', "TCP: size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime));
|
||||
Syslog('+', "TCP: size %lu bytes, dated %s", (unsigned int)st.st_size, date(st.st_mtime));
|
||||
gettimeofday(&starttime, &tz);
|
||||
} else {
|
||||
Syslog('+', "TCP: file \"%s\" has 0 size, skiped",ln);
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(txbuf,TCP_BLKSIZE, "S %s %lu %lu",rn,(unsigned long)st.st_size,(unsigned long)st.st_mtime+(st.st_mtime%2));
|
||||
snprintf(txbuf,TCP_BLKSIZE, "S %s %u %u",rn,(unsigned int)st.st_size,(unsigned int)st.st_mtime+(unsigned int)(st.st_mtime%2));
|
||||
bufl = strlen(txbuf);
|
||||
rc = tcp_sblk(txbuf, bufl, TCP_CMD);
|
||||
rc = tcp_rblk(rxbuf, &bufl);
|
||||
@@ -261,7 +261,7 @@ static int sendtfile(char *ln, char *rn)
|
||||
gettimeofday(&endtime, &tz);
|
||||
Syslog('a', "st_size %d, offset %d",st.st_size,offset);
|
||||
Syslog('+', "TCP: OK %s", transfertime(starttime, endtime, st.st_size-offset, TRUE));
|
||||
sentbytes += (unsigned long)st.st_size - offset;
|
||||
sentbytes += (unsigned int)st.st_size - offset;
|
||||
return 0;
|
||||
} else if(strncmp(rxbuf,"FERROR",6) == 0){
|
||||
WriteError("TCP: remote file error",ln);
|
||||
@@ -274,7 +274,7 @@ static int sendtfile(char *ln, char *rn)
|
||||
|
||||
static int resync(off_t off)
|
||||
{
|
||||
snprintf(txbuf, TCP_BLKSIZE, "ROK %ld",(long)off);
|
||||
snprintf(txbuf, TCP_BLKSIZE, "ROK %d",(int)off);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2004
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -57,9 +57,9 @@ static int last;
|
||||
struct timeval starttime, endtime;
|
||||
struct timezone tz;
|
||||
static off_t startofs;
|
||||
static long recv_blk;
|
||||
static int recv_blk;
|
||||
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ int closeit(int success)
|
||||
Syslog('+', "Xmodem: OK %s", transfertime(starttime, endtime, endofs-startofs, FALSE));
|
||||
else
|
||||
Syslog('+', "Xmodem: dropped after %ld bytes", endofs-startofs);
|
||||
rcvdbytes += (unsigned long)(endofs-startofs);
|
||||
rcvdbytes += (unsigned int)(endofs-startofs);
|
||||
fp = NULL;
|
||||
return closefile();
|
||||
}
|
||||
@@ -136,9 +136,9 @@ SM_EDECL
|
||||
} xmblk;
|
||||
unsigned short localcrc,remotecrc;
|
||||
unsigned char localcs,remotecs;
|
||||
long ackd_blk=-1L;
|
||||
long next_blk=1L;
|
||||
long last_blk=0L;
|
||||
int ackd_blk=-1L;
|
||||
int next_blk=1L;
|
||||
int last_blk=0L;
|
||||
off_t resofs;
|
||||
char tmpfname[16];
|
||||
off_t wsize;
|
||||
@@ -550,12 +550,12 @@ int resync(off_t resofs)
|
||||
int count=0;
|
||||
int gotack,gotnak;
|
||||
int c;
|
||||
long sblk;
|
||||
int sblk;
|
||||
|
||||
Syslog('x', "trying to resync at offset %ld",resofs);
|
||||
Syslog('x', "trying to resync at offset %d", (int)resofs);
|
||||
|
||||
sblk=resofs/XMBLKSIZ+1;
|
||||
snprintf(resynbuf,16,"%ld",sblk);
|
||||
snprintf(resynbuf,16,"%d",sblk);
|
||||
lcrc=crc16xmodem(resynbuf,strlen(resynbuf));
|
||||
gotack=0;
|
||||
gotnak=0;
|
||||
|
@@ -48,7 +48,7 @@ static char *ln,*rn;
|
||||
static int flg;
|
||||
static int xm_send(void);
|
||||
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned int sentbytes;
|
||||
|
||||
|
||||
int xmsend(char *local, char *Remote, int fl)
|
||||
@@ -109,11 +109,11 @@ SM_EDECL
|
||||
int count=0;
|
||||
int cancount=0;
|
||||
int window;
|
||||
long last_blk;
|
||||
long send_blk;
|
||||
long next_blk;
|
||||
long ackd_blk;
|
||||
long tmp;
|
||||
int last_blk;
|
||||
int send_blk;
|
||||
int next_blk;
|
||||
int ackd_blk;
|
||||
int tmp;
|
||||
char resynbuf[16];
|
||||
|
||||
fl.l_type=F_RDLCK;
|
||||
|
@@ -83,8 +83,8 @@ int Rxhlen; /* Length of header received */
|
||||
int Rxcount; /* Count of data bytes received */
|
||||
char Rxhdr[ZMAXHLEN]; /* Received header */
|
||||
char Txhdr[ZMAXHLEN]; /* Transmitted header */
|
||||
long Rxpos; /* Received file position */
|
||||
long Txpos; /* Transmitted file position */
|
||||
int Rxpos; /* Received file position */
|
||||
int Txpos; /* Transmitted file position */
|
||||
int Txfcs32; /* TRUE means send binary frames with 32 bit FCS */
|
||||
int Crc32t; /* Controls 32 bit CRC being sent */
|
||||
/* 1 == CRC32, 2 == CRC32 + RLE */
|
||||
@@ -230,7 +230,7 @@ void zsbhdr(int len, int type, register char *shdr)
|
||||
void zsbh32(int len, register char *shdr, int type, int flavour)
|
||||
{
|
||||
register int n;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
|
||||
BUFFER_BYTE(flavour);
|
||||
if (Usevhdrs)
|
||||
@@ -338,7 +338,7 @@ void zsdata(register char *buf, int length, int frameend)
|
||||
void zsda32(register char *buf, int length, int frameend)
|
||||
{
|
||||
register int c;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
|
||||
crc = 0xFFFFFFFFL;
|
||||
for (;--length >= 0; ++buf) {
|
||||
@@ -429,7 +429,7 @@ crcfoo:
|
||||
int zrdat32(register char *buf, int length)
|
||||
{
|
||||
register int c;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
register char *end;
|
||||
register int d;
|
||||
|
||||
@@ -704,7 +704,7 @@ int zrbhdr(register char *shdr)
|
||||
int zrbhd32(register char *shdr)
|
||||
{
|
||||
register int c, n;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
|
||||
if ((c = zdlread()) & ~0377)
|
||||
return c;
|
||||
@@ -967,7 +967,7 @@ int noxrd7(void)
|
||||
/*
|
||||
* Store long integer pos in Txhdr
|
||||
*/
|
||||
void stohdr(long pos)
|
||||
void stohdr(int pos)
|
||||
{
|
||||
Txhdr[ZP0] = pos;
|
||||
Txhdr[ZP1] = pos>>8;
|
||||
@@ -980,9 +980,9 @@ void stohdr(long pos)
|
||||
/*
|
||||
* Recover a long integer from a header
|
||||
*/
|
||||
long rclhdr(register char *shdr)
|
||||
int rclhdr(register char *shdr)
|
||||
{
|
||||
register long l;
|
||||
register int l;
|
||||
|
||||
l = (shdr[ZP3] & 0377);
|
||||
l = (l << 8) | (shdr[ZP2] & 0377);
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#ifndef ZMODEM_H
|
||||
#define ZMODEM_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
@@ -141,14 +143,14 @@
|
||||
/* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
|
||||
#define ZCACK1 1 /* Acknowledge, then do command */
|
||||
|
||||
long rclhdr(register char *);
|
||||
int rclhdr(register char *);
|
||||
|
||||
/* Globals used by ZMODEM functions */
|
||||
extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame */
|
||||
extern int Rxtype; /* Type of header received */
|
||||
extern int Rxcount; /* Count of data bytes received */
|
||||
extern int long Rxpos; /* Received file position */
|
||||
extern int long Txpos; /* Transmitted file position */
|
||||
extern int Rxpos; /* Received file position */
|
||||
extern int Txpos; /* Transmitted file position */
|
||||
extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */
|
||||
extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */
|
||||
extern int Crc32r; /* Display flag indicating 32 bit CRC being received */
|
||||
@@ -170,7 +172,7 @@ extern int Effbaud;
|
||||
extern int Zmodem;
|
||||
extern int Zctlesc;
|
||||
extern int Filesleft;
|
||||
extern long Totalleft;
|
||||
extern int Totalleft;
|
||||
|
||||
extern char *frametypes[];
|
||||
#define FTOFFSET 16
|
||||
@@ -180,7 +182,7 @@ extern void zshhdr(int,int,char*);
|
||||
extern int zgethdr(char*);
|
||||
extern void zsdata(char*,int,int);
|
||||
extern int zrdata(char*,int);
|
||||
extern void stohdr(long);
|
||||
extern void stohdr(int);
|
||||
|
||||
extern void zsendline(int);
|
||||
extern void zsdar32(char*,int,int);
|
||||
@@ -188,7 +190,7 @@ extern int zrdatr32(char*,int);
|
||||
extern int zdlread(void);
|
||||
|
||||
extern unsigned short crc16xmodemtab[];
|
||||
extern unsigned long crc32tab[];
|
||||
extern unsigned int crc32tab[];
|
||||
#define updcrc16(cp,crc) (crc16xmodemtab[(((int)crc >> 8) & 0xff)] ^ (crc << 8) ^ cp)
|
||||
#define updcrc32(cp,crc) (crc32tab[((int)crc ^ cp) & 0xff] ^ ((crc >> 8) & 0x00ffffff))
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Fidonet mailer
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2003
|
||||
* Copyright (C) 1997-2005
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@@ -48,13 +48,13 @@ static int Usevhdrs;
|
||||
static off_t rxbytes;
|
||||
static int Eofseen; /* indicates cpm eof (^Z) has been received */
|
||||
static int errors;
|
||||
static long sbytes;
|
||||
static int sbytes;
|
||||
struct timeval starttime, endtime;
|
||||
struct timezone tz;
|
||||
|
||||
#define DEFBYTL 2000000000L /* default rx file size */
|
||||
static long Bytesleft; /* number of bytes of incoming file left */
|
||||
static long Modtime; /* Unix style mod time for incoming file */
|
||||
static int Bytesleft; /* number of bytes of incoming file left */
|
||||
static int Modtime; /* Unix style mod time for incoming file */
|
||||
static int Filemode; /* Unix style mode for incoming file */
|
||||
|
||||
static int Thisbinary; /* current file is to be received in bin mode */
|
||||
@@ -77,13 +77,13 @@ int closeit(int);
|
||||
static int putsec(char*,int);
|
||||
static int procheader(char*);
|
||||
static int ackbibi(void);
|
||||
static long getfree(void);
|
||||
static int getfree(void);
|
||||
|
||||
|
||||
void get_frame_buffer(void);
|
||||
void free_frame_buffer(void);
|
||||
|
||||
extern unsigned long rcvdbytes;
|
||||
extern unsigned int rcvdbytes;
|
||||
|
||||
|
||||
|
||||
@@ -503,9 +503,9 @@ int procheader(char *Name)
|
||||
Modtime = 0L;
|
||||
|
||||
p = Name + 1 + strlen(Name);
|
||||
sscanf(p, "%ld%lo%o%o%d%d%d%d", &Bytesleft, &Modtime, &Filemode, &dummy, &dummy, &dummy, &dummy, &dummy);
|
||||
sscanf(p, "%d%o%o%o%d%d%d%d", &Bytesleft, &Modtime, &Filemode, &dummy, &dummy, &dummy, &dummy, &dummy);
|
||||
strcpy(ctt,date(Modtime));
|
||||
Syslog('+', "Zmodem: \"%s\" %ld bytes, %s mode %o", Name, Bytesleft, ctt, Filemode);
|
||||
Syslog('+', "Zmodem: \"%s\" %d bytes, %s mode %o", Name, Bytesleft, ctt, Filemode);
|
||||
|
||||
fout = openfile(Name,Modtime,Bytesleft,&rxbytes,resync);
|
||||
gettimeofday(&starttime, &tz);
|
||||
@@ -556,7 +556,7 @@ int putsec(char *buf, int n)
|
||||
|
||||
|
||||
|
||||
long getfree(void)
|
||||
int getfree(void)
|
||||
{
|
||||
struct statfs sfs;
|
||||
|
||||
|
@@ -52,7 +52,7 @@
|
||||
void zsdar32(char *buf, int length, int frameend)
|
||||
{
|
||||
register int c, l, n;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
|
||||
crc = 0xFFFFFFFFL; l = *buf++ & 0377;
|
||||
if (length == 1) {
|
||||
@@ -112,7 +112,7 @@ void zsdar32(char *buf, int length, int frameend)
|
||||
int zrdatr32(register char *buf, int length)
|
||||
{
|
||||
register int c;
|
||||
register unsigned long crc;
|
||||
register unsigned int crc;
|
||||
register char *end;
|
||||
register int d;
|
||||
|
||||
|
@@ -64,7 +64,7 @@ static int blklen = 128; /* Length of transmitted records */
|
||||
static int blkopt; /* Override value for zmodem blklen */
|
||||
static int errors;
|
||||
static int Lastsync;
|
||||
static long bytcnt;
|
||||
static int bytcnt;
|
||||
static int Lrxpos=0;
|
||||
static int Lztrans=0;
|
||||
static int Lzmanag=0;
|
||||
@@ -72,11 +72,11 @@ static int Lskipnocor=0;
|
||||
static int Lzconv=0;
|
||||
static int Beenhereb4;
|
||||
static char Myattn[]={0};
|
||||
static long skipsize;
|
||||
static int skipsize;
|
||||
struct timeval starttime, endtime;
|
||||
struct timezone tz;
|
||||
|
||||
extern unsigned long sentbytes;
|
||||
extern unsigned int sentbytes;
|
||||
extern int Rxhlen;
|
||||
extern void get_frame_buffer(void);
|
||||
extern void free_frame_buffer(void);
|
||||
@@ -210,11 +210,11 @@ static int sendzfile(char *ln, char *rn)
|
||||
}
|
||||
|
||||
Syslog('+', "Zmodem: send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn));
|
||||
Syslog('+', "Zmodem: size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime));
|
||||
Syslog('+', "Zmodem: size %lu bytes, dated %s", (unsigned int)st.st_size, date(st.st_mtime));
|
||||
gettimeofday(&starttime, &tz);
|
||||
|
||||
snprintf(txbuf,MAXBLOCK, "%s %lu %lo %o 0 0 0", rn,
|
||||
(unsigned long)st.st_size, (long)st.st_mtime+((long)st.st_mtime%2), st.st_mode);
|
||||
snprintf(txbuf,MAXBLOCK, "%s %u %o %o 0 0 0", rn,
|
||||
(unsigned int)st.st_size, (int)st.st_mtime+((int)st.st_mtime%2), st.st_mode);
|
||||
bufl = strlen(txbuf);
|
||||
*(strchr(txbuf,' ')) = '\0'; /*hope no blanks in filename*/
|
||||
|
||||
@@ -225,8 +225,8 @@ static int sendzfile(char *ln, char *rn)
|
||||
return 0;
|
||||
} else if ((rc == OK) && (st.st_size - skipsize)) {
|
||||
gettimeofday(&endtime, &tz);
|
||||
Syslog('+', "Zmodem: OK %s", transfertime(starttime, endtime, (unsigned long)st.st_size - skipsize, TRUE));
|
||||
sentbytes += (unsigned long)st.st_size - skipsize;
|
||||
Syslog('+', "Zmodem: OK %s", transfertime(starttime, endtime, (unsigned int)st.st_size - skipsize, TRUE));
|
||||
sentbytes += (unsigned int)st.st_size - skipsize;
|
||||
return 0;
|
||||
} else
|
||||
return 2;
|
||||
@@ -358,8 +358,8 @@ int zfilbuf(void)
|
||||
int zsendfile(char *buf, int blen)
|
||||
{
|
||||
int c;
|
||||
register unsigned long crc = -1;
|
||||
long lastcrcrq = -1;
|
||||
register unsigned int crc = -1;
|
||||
int lastcrcrq = -1;
|
||||
|
||||
Syslog('z', "zsendfile %s (%d)", buf, blen);
|
||||
for (errors=0; ++errors<11;) {
|
||||
|
Reference in New Issue
Block a user