First stage port to 64 bit

This commit is contained in:
Michiel Broek
2005-10-11 20:49:41 +00:00
parent ac4e2dce0a
commit 1dfaf10c20
222 changed files with 1620 additions and 1563 deletions

View File

@@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Mail Gate
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -35,11 +35,11 @@
#ifndef USE_NEWSGATE
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;

View File

@@ -5,7 +5,7 @@
#ifndef USE_NEWSGATE
unsigned long atoul(char*);
unsigned int atoul(char*);
#endif

View File

@@ -41,11 +41,11 @@
#ifndef USE_NEWSGATE
unsigned long article = 0L; /* Current article */
unsigned int article = 0L; /* Current article */
char currentgroup[81]; /* Current newsgroup */
extern unsigned long sentbytes;
extern unsigned long rcvdbytes;
extern unsigned int sentbytes;
extern unsigned int rcvdbytes;
extern char *ttystat[];
@@ -100,7 +100,7 @@ char *make_msgid(char *msgid)
{
static char buf[100];
snprintf(buf, 100, "<%08lx$%s@%s>", StringCRC32(msgid), currentgroup, CFG.sysdomain);
snprintf(buf, 100, "<%08x$%s@%s>", StringCRC32(msgid), currentgroup, CFG.sysdomain);
return buf;
}
@@ -115,7 +115,7 @@ char *make_msgid(char *msgid)
void command_abhs(char *buf)
{
char *p, *cmd, *opt, *subj, *charset = NULL;
unsigned long art = 0L;
unsigned int art = 0L;
int i, found;
Syslog('+', "%s", buf);
@@ -567,7 +567,7 @@ void command_post(char *cmd)
void command_xover(char *cmd)
{
char *opt, *p, msgid[100], reply[100];
unsigned long i, start, end;
unsigned int i, start, end;
int bytecount, linecount;
IsDoing("Xover");

View File

@@ -35,18 +35,18 @@
#ifndef USE_NEWSGATE
void hash_update_s(unsigned long *id, char *mod)
void hash_update_s(unsigned int *id, char *mod)
{
*id ^= lh_strhash(mod);
}
void hash_update_n(unsigned long *id, unsigned long mod)
void hash_update_n(unsigned int *id, unsigned int mod)
{
char buf[32];
snprintf(buf,32,"%030lu",mod);
snprintf(buf,32,"%030u",mod);
*id ^= lh_strhash(buf);
}

View File

@@ -5,8 +5,8 @@
#ifndef USE_NEWSGATE
void hash_update_s(unsigned long *, char *);
void hash_update_n(unsigned long *, unsigned long);
void hash_update_s(unsigned int *, char *);
void hash_update_n(unsigned int *, unsigned int);
#endif

View File

@@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Mail Gate
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -129,7 +129,7 @@ char *lh_version=(char *)"lhash part of SSLeay 0.6.4 30-Aug-1996";
#define P_CPP char *,char *
static void expand(LHASH *lh);
static void contract(LHASH *lh);
static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash);
static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned int *rhash);
#else
@@ -141,7 +141,7 @@ static LHASH_NODE **getrn();
#endif
LHASH *lh_new(unsigned long (*h)(char *), int (*c)(char *, char *))
LHASH *lh_new(unsigned int (*h)(char *), int (*c)(char *, char *))
{
LHASH *ret;
int i;
@@ -153,7 +153,7 @@ LHASH *lh_new(unsigned long (*h)(char *), int (*c)(char *, char *))
for (i=0; i<MIN_NODES; i++)
ret->b[i]=NULL;
ret->comp=((c == NULL)?(int (*)(char *, char *))strcmp:c);
ret->hash=((h == NULL)?(unsigned long (*)(char *))lh_strhash:h);
ret->hash=((h == NULL)?(unsigned int (*)(char *))lh_strhash:h);
ret->num_nodes=MIN_NODES/2;
ret->num_alloc_nodes=MIN_NODES;
ret->p=0;
@@ -208,7 +208,7 @@ void lh_free(LHASH *lh)
char *lh_insert(LHASH *lh, char *data)
{
unsigned long hash;
unsigned int hash;
LHASH_NODE *nn,**rn;
char *ret;
@@ -242,7 +242,7 @@ char *lh_insert(LHASH *lh, char *data)
char *lh_delete(LHASH *lh, char *data)
{
unsigned long hash;
unsigned int hash;
LHASH_NODE *nn,**rn;
char *ret;
@@ -274,7 +274,7 @@ char *lh_delete(LHASH *lh, char *data)
char *lh_retrieve(LHASH *lh, char *data)
{
unsigned long hash;
unsigned int hash;
LHASH_NODE **rn;
char *ret;
@@ -329,7 +329,7 @@ static void expand(LHASH *lh)
{
LHASH_NODE **n,**n1,**n2,*np;
unsigned int p,i,j;
unsigned long hash,nni;
unsigned int hash,nni;
lh->num_nodes++;
lh->num_expands++;
@@ -417,10 +417,10 @@ static void contract(LHASH *lh)
static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash)
static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned int *rhash)
{
LHASH_NODE **ret,*n1;
unsigned long hash,nn;
unsigned int hash,nn;
int (*cf)(char *, char *);
hash=(*(lh->hash))(data);
@@ -455,11 +455,11 @@ static LHASH_NODE **getrn(LHASH *lh, char *data, unsigned long *rhash)
* no collisions on /usr/dict/words and it distributes on %2^n quite
* well, not as good as MD5, but still good.
*/
unsigned long lh_strhash(char *c)
unsigned int lh_strhash(char *c)
{
unsigned long ret=0;
long n;
unsigned long v;
unsigned int ret=0;
int n;
unsigned int v;
int r;
if ((c == NULL) || (*c == '\0'))

View File

@@ -63,7 +63,7 @@ typedef struct lhash_node_st
char *data;
struct lhash_node_st *next;
#ifndef NO_HASH_COMP
unsigned long hash;
unsigned int hash;
#endif
} LHASH_NODE;
@@ -71,41 +71,41 @@ typedef struct lhash_st
{
LHASH_NODE **b;
int (*comp)(char *, char *);
unsigned long (*hash)(char *);
unsigned int (*hash)(char *);
unsigned int num_nodes;
unsigned int num_alloc_nodes;
unsigned int p;
unsigned int pmax;
unsigned long up_load; /* load times 256 */
unsigned long down_load; /* load times 256 */
unsigned long num_items;
unsigned int up_load; /* load times 256 */
unsigned int down_load; /* load times 256 */
unsigned int num_items;
unsigned long num_expands;
unsigned long num_expand_reallocs;
unsigned long num_contracts;
unsigned long num_contract_reallocs;
unsigned long num_hash_calls;
unsigned long num_comp_calls;
unsigned long num_insert;
unsigned long num_replace;
unsigned long num_delete;
unsigned long num_no_delete;
unsigned long num_retreve;
unsigned long num_retreve_miss;
unsigned long num_hash_comps;
unsigned int num_expands;
unsigned int num_expand_reallocs;
unsigned int num_contracts;
unsigned int num_contract_reallocs;
unsigned int num_hash_calls;
unsigned int num_comp_calls;
unsigned int num_insert;
unsigned int num_replace;
unsigned int num_delete;
unsigned int num_no_delete;
unsigned int num_retreve;
unsigned int num_retreve_miss;
unsigned int num_hash_comps;
} LHASH;
#define LH_LOAD_MULT 256
#ifndef NOPROTO
LHASH *lh_new(unsigned long (*h)(char *), int (*c)(char *, char *));
LHASH *lh_new(unsigned int (*h)(char *), int (*c)(char *, char *));
void lh_free(LHASH *lh);
char *lh_insert(LHASH *lh, char *data);
char *lh_delete(LHASH *lh, char *data);
char *lh_retrieve(LHASH *lh, char *data);
void lh_doall(LHASH *lh, void (*func)(char *, char *));
void lh_doall_arg(LHASH *lh, void (*func)(char *, char *),char *arg);
unsigned long lh_strhash(char *c);
unsigned int lh_strhash(char *c);
#ifndef WIN16
void lh_stats(LHASH *lh, FILE *out);
@@ -130,7 +130,7 @@ char *lh_delete();
char *lh_retrieve();
void lh_doall();
void lh_doall_arg();
unsigned long lh_strhash();
unsigned int lh_strhash();
#ifndef WIN16
void lh_stats();

View File

@@ -44,8 +44,8 @@ time_t t_end;
char *envptr = NULL;
struct sockaddr_in peeraddr;
pid_t mypid;
unsigned long rcvdbytes = 0L;
unsigned long sentbytes = 0L;
unsigned int rcvdbytes = 0L;
unsigned int sentbytes = 0L;
int do_mailout = FALSE;
extern char *ttystat[];

View File

@@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Mail Gate
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -63,10 +63,10 @@ faddr *bestaka;
int ftnmsgid(char *msgid, char **s, unsigned long *n, char *areaname)
int ftnmsgid(char *msgid, char **s, unsigned int *n, char *areaname)
{
char *buf, *l, *r, *p;
unsigned long nid = 0L;
unsigned int nid = 0L;
faddr *tmp;
static int ftnorigin = 0;
@@ -117,7 +117,7 @@ int ftnmsgid(char *msgid, char **s, unsigned long *n, char *areaname)
*r++ = '\0';
*s = xstrcpy(l+6);
if (r)
sscanf(r,"%lx",&nid);
sscanf(r,"%x",&nid);
ftnorigin = 1;
/* <NOMSGID_mimeanything_abcd1234@ftn.domain> */
} else if (strncmp(l,"NOMSGID_",8) == 0) {
@@ -141,7 +141,7 @@ int ftnmsgid(char *msgid, char **s, unsigned long *n, char *areaname)
r=strchr(l+4,'_');
*r++='\0';
*s=xstrcpy(l+4);
sscanf(r,"%lx",&nid);
sscanf(r,"%x",&nid);
ftnorigin=1;
/* <wgcid$3$g712$h610$i22$kfidonet$j6596dbf5@brazerko.com> */
} else if (strncmp(l,"wgcid$",6) == 0) {
@@ -173,7 +173,7 @@ int ftnmsgid(char *msgid, char **s, unsigned long *n, char *areaname)
if ((r=strstr(l,"$j"))) {
*r='\0';
*s=xstrcat(*s,l);
sscanf(r+2,"%lx",&nid);
sscanf(r+2,"%x",&nid);
}
} else {
*r='\0';

View File

@@ -5,7 +5,7 @@
#ifndef USE_NEWSGATE
int ftnmsgid(char *,char **,unsigned long *,char *);
int ftnmsgid(char *,char **,unsigned int *,char *);
ftnmsg *mkftnhdr(rfcmsg *, int, faddr *);
#endif

View File

@@ -123,7 +123,7 @@ int kludgewrite(char *s, FILE *fp)
int findorigmsg(char *msgid, char *o)
{
unsigned long i, start, end;
unsigned int i, start, end;
char *gen2;
if (msgid == NULL) {
@@ -177,7 +177,7 @@ int rfc2ftn(FILE *fp)
FILE *ofp, *qfp;
fa_list *sbl = NULL, *ptl = NULL, *tmpl;
faddr *ta, *fta;
unsigned long svmsgid, svreply;
unsigned int svmsgid, svreply;
int sot_kludge = FALSE, eot_kludge = FALSE, tinyorigin = FALSE;
int needsplit, hdrsize, datasize, splitpart, forbidsplit, rfcheaders;
time_t Now;
@@ -399,14 +399,14 @@ int rfc2ftn(FILE *fp)
fprintf(ofp, "AREA:%s\n", msgs.Tag);
if ((fmsg->msgid_a == NULL) && (fmsg->msgid_n == 0)) {
Syslog('n', "No Messageid from poster, creating new MSGID");
fprintf(ofp, "\001MSGID: %s %08lx\n", aka2str(msgs.Aka), sequencer());
fprintf(ofp, "\001MSGID: %s %08x\n", aka2str(msgs.Aka), sequencer());
} else {
fprintf(ofp, "\001MSGID: %s %08lx\n", MBSE_SS(fmsg->msgid_a),fmsg->msgid_n);
fprintf(ofp, "\001MSGID: %s %08x\n", MBSE_SS(fmsg->msgid_a),fmsg->msgid_n);
}
if (fmsg->reply_s)
fprintf(ofp, "\1REPLY: %s\n", fmsg->reply_s);
else if (fmsg->reply_a)
fprintf(ofp, "\1REPLY: %s %08lx\n", fmsg->reply_a, fmsg->reply_n);
fprintf(ofp, "\1REPLY: %s %08x\n", fmsg->reply_a, fmsg->reply_n);
Now = time(NULL) - (gmt_offset((time_t)0) * 60);
fprintf(ofp, "\001TZUTC: %s\n", gmtoffset(Now));
fprintf(ofp, "\001CHRS: %s\n", getftnchrs(msgs.Charset));
@@ -746,7 +746,7 @@ int rfc2ftn(FILE *fp)
*/
snprintf(temp, PATH_MAX, "%s/tmp/echomail.jam", getenv("MBSE_ROOT"));
if ((qfp = fopen(temp, "a")) != NULL) {
fprintf(qfp, "%s %lu\n", msgs.Base, Msg.Id);
fprintf(qfp, "%s %u\n", msgs.Base, Msg.Id);
fclose(qfp);
}