c90 fixes

This commit is contained in:
rsc 2006-04-01 15:35:09 +00:00
parent 3d038c325b
commit 226d80b821
11 changed files with 118 additions and 66 deletions

View file

@ -10,7 +10,7 @@
*/
enum
{
Ndict= 64,
Ndict= 64
};
typedef struct Dict Dict;
struct Dict

View file

@ -23,14 +23,23 @@ static void createptrs(void);
static int implemented[Tall] =
{
[Ta] 1,
[Tns] 1,
[Tsoa] 1,
[Tmx] 1,
[Tptr] 1,
[Tcname] 1,
[Tnull] 1,
[Ttxt] 1,
0,
/* Ta */ 1,
/* Tns */ 1,
0,
0,
/* Tcname */ 1,
/* Tsoa */ 1,
0,
0,
0,
/* Tnull */ 1,
0,
/* Tptr */ 1,
0,
0,
/* Tmx */ 1,
/* Ttxt */ 1
};
static void

View file

@ -25,52 +25,94 @@ static struct
} dnvars;
/* names of RR types */
char *rrtname[] =
char *rrtname[Tall+2] =
{
[Ta] "ip",
[Tns] "ns",
[Tmd] "md",
[Tmf] "mf",
[Tcname] "cname",
[Tsoa] "soa",
[Tmb] "mb",
[Tmg] "mg",
[Tmr] "mr",
[Tnull] "null",
[Twks] "wks",
[Tptr] "ptr",
[Thinfo] "hinfo",
[Tminfo] "minfo",
[Tmx] "mx",
[Ttxt] "txt",
[Trp] "rp",
[Tkey] "key",
[Tcert] "cert",
[Tsig] "sig",
[Taaaa] "ipv6",
[Tixfr] "ixfr",
[Taxfr] "axfr",
[Tall] "all",
0,
nil,
"ip",
"ns",
"md",
"mf",
"cname",
"soa",
"mb",
"mg",
"mr",
"null",
"wks",
"ptr",
"hinfo",
"minfo",
"mx",
"txt",
"rp",
nil,
nil,
nil,
nil,
nil,
nil,
"sig",
"key",
nil,
nil,
"aaaa",
nil,
nil,
nil,
nil,
nil,
nil,
nil,
nil,
"cert",
nil,
nil,
/* 40 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 48 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 56 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 64 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 72 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 80 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 88 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 96 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 104 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 112 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 120 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 128 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 136 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 144 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 152 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 160 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 168 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 176 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 184 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 192 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 200 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 208 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 216 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 224 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 232 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 240 */ nil, nil, nil, nil, nil, nil, nil, nil,
/* 248 */ nil, nil, nil,
"ixfr",
"axfr",
"mailb",
nil,
"all",
nil
};
/* names of response codes */
char *rname[Rmask+1] =
{
[Rok] "ok",
[Rformat] "format error",
[Rserver] "server failure",
[Rname] "bad name",
[Runimplimented] "unimplemented",
[Rrefused] "we don't like you",
};
/* names of op codes */
char *opname[] =
{
[Oquery] "query",
[Oinverse] "inverse",
[Ostatus] "status",
"ok",
"format error",
"server failure",
"bad name",
"unimplemented",
"we don't like you",
};
Lock dnlock;
@ -845,7 +887,7 @@ rrtype(char *atype)
if(rrtname[i] && strcmp(rrtname[i], atype) == 0)
return i;
// make any a synonym for all
/* make any a synonym for all */
if(strcmp(atype, "any") == 0)
return Tall;
return atoi(atype);
@ -1012,7 +1054,7 @@ rrfmt(Fmt *f)
fmtprint(&fstr, "\t%s", rp->ip->name);
break;
case Tptr:
// fmtprint(&fstr, "\t%s(%lud)", rp->ptr->name, rp->ptr->ordinal);
/* fmtprint(&fstr, "\t%s(%lud)", rp->ptr->name, rp->ptr->ordinal); */
fmtprint(&fstr, "\t%s", rp->ptr->name);
break;
case Tsoa:
@ -1325,7 +1367,7 @@ sencodefmt(Fmt *f)
int ilen;
int rv;
uchar *b;
char obuf[64]; // rsc optimization
char obuf[64]; /* rsc optimization */
if(!(f->flags&FmtPrec) || f->prec < 1)
goto error;
@ -1372,7 +1414,7 @@ sencodefmt(Fmt *f)
} else
buf = obuf;
// convert
/* convert */
out = buf;
switch(f->r){
case '<':

View file

@ -8,7 +8,7 @@
enum
{
Maxdest= 24, /* maximum destinations for a request message */
Maxtrans= 3, /* maximum transmissions to a server */
Maxtrans= 3 /* maximum transmissions to a server */
};
static int netquery(DN*, int, RR*, Request*, int);

View file

@ -19,7 +19,7 @@ enum
Maxfdata= 8192,
Qdir= 0,
Qdns= 1,
Qdns= 1
};
typedef struct Mfile Mfile;
@ -43,9 +43,9 @@ struct Mfile
ushort nrr; /* number of rr's */
};
//
// active local requests
//
/*
* active local requests
*/
struct Job
{
Job *next;

View file

@ -90,7 +90,7 @@ enum
#define DNmagic 0xa110a110
/* parallelism */
Maxactive= 32,
Maxactive= 32
};
typedef struct DN DN;
@ -283,7 +283,7 @@ enum
Recurse,
Dontrecurse,
NOneg,
OKneg,
OKneg
};
enum
@ -294,7 +294,6 @@ enum
/* dn.c */
extern char *rrtname[];
extern char *rname[];
extern char *opname[];
extern void db2cache(int);
extern void dninit(void);
extern DN* dnlookup(char*, int, int);

View file

@ -13,7 +13,7 @@ enum
Ncache= 8,
Maxpath= 128,
Maxreply= 512,
Maxrrr= 16,
Maxrrr= 16
};
static char *servername;

View file

@ -8,7 +8,7 @@
enum
{
Maxpath= 128,
Maxpath= 128
};
char *logfile = "dns";

View file

@ -262,7 +262,7 @@ tcpproc(void *v)
}
enum {
Maxactivetcp = 4,
Maxactivetcp = 4
};
static int

View file

@ -12,7 +12,7 @@ enum
Sys,
Dk,
Ip,
Domain,
Domain
};
int

View file

@ -186,7 +186,8 @@ main(int argc, char *argv[])
parse(unsharp("#9/ndb/local"));
parse(unsharp("#9/ndb/friends"));
}
/*
// sprint(fn, "/lib/ndb/hosts.%-.21s", domname);
// fd = create(fn, OWRITE, 0664);
// if(fd < 0){
@ -197,6 +198,7 @@ main(int argc, char *argv[])
// printentry(fd, &x[i]);
// close(fd);
//
*/
sprint(fn, "/lib/ndb/db.%-.24s", domname);
fd = create(fn, OWRITE, 0664);