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 enum
{ {
Ndict= 64, Ndict= 64
}; };
typedef struct Dict Dict; typedef struct Dict Dict;
struct Dict struct Dict

View file

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

View file

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

View file

@ -8,7 +8,7 @@
enum enum
{ {
Maxdest= 24, /* maximum destinations for a request message */ 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); static int netquery(DN*, int, RR*, Request*, int);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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