tc90 fixes - plan9port - [fork] Plan 9 from user space
git clone git://src.adamsgaard.dk/plan9port
Log
Files
Refs
README
LICENSE
---
commit 226d80b8213821af0cbf092d1507c52b504fd368
parent 3d038c325b6c5ac906092c81d282afa5bfefabc6
Author: rsc 
Date:   Sat,  1 Apr 2006 15:35:09 +0000

c90 fixes

Diffstat:
  M src/cmd/ndb/convDNS2M.c             |       2 +-
  M src/cmd/ndb/dblookup.c              |      25 +++++++++++++++++--------
  M src/cmd/ndb/dn.c                    |     130 ++++++++++++++++++++-----------
  M src/cmd/ndb/dnresolve.c             |       2 +-
  M src/cmd/ndb/dns.c                   |       8 ++++----
  M src/cmd/ndb/dns.h                   |       5 ++---
  M src/cmd/ndb/dnsdebug.c              |       2 +-
  M src/cmd/ndb/dnstcp.c                |       2 +-
  M src/cmd/ndb/dntcpserver.c           |       2 +-
  M src/cmd/ndb/ndbmkdb.c               |       2 +-
  M src/cmd/ndb/ndbmkhosts.c            |       4 +++-

11 files changed, 118 insertions(+), 66 deletions(-)
---
diff --git a/src/cmd/ndb/convDNS2M.c b/src/cmd/ndb/convDNS2M.c
t@@ -10,7 +10,7 @@
  */
 enum
 {
-        Ndict=        64,
+        Ndict=        64
 };
 typedef struct Dict        Dict;
 struct Dict
diff --git a/src/cmd/ndb/dblookup.c b/src/cmd/ndb/dblookup.c
t@@ -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
diff --git a/src/cmd/ndb/dn.c b/src/cmd/ndb/dn.c
t@@ -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;
t@@ -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);
t@@ -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:
t@@ -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;
t@@ -1372,7 +1414,7 @@ sencodefmt(Fmt *f)
         } else
                 buf = obuf;
 
-        // convert
+        /* convert */
         out = buf;
         switch(f->r){
         case '<':
diff --git a/src/cmd/ndb/dnresolve.c b/src/cmd/ndb/dnresolve.c
t@@ -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);
diff --git a/src/cmd/ndb/dns.c b/src/cmd/ndb/dns.c
t@@ -19,7 +19,7 @@ enum
         Maxfdata=                8192,
 
         Qdir=                        0,
-        Qdns=                        1,
+        Qdns=                        1
 };
 
 typedef struct Mfile        Mfile;
t@@ -43,9 +43,9 @@ struct Mfile
         ushort                nrr;                /* number of rr's */
 };
 
-//
-//  active local requests
-//
+/*
+ * active local requests
+ */
 struct Job
 {
         Job        *next;
diff --git a/src/cmd/ndb/dns.h b/src/cmd/ndb/dns.h
t@@ -90,7 +90,7 @@ enum
 #define        DNmagic        0xa110a110
 
         /* parallelism */
-        Maxactive=        32,
+        Maxactive=        32
 };
 
 typedef struct DN        DN;
t@@ -283,7 +283,7 @@ enum
         Recurse,
         Dontrecurse,
         NOneg,
-        OKneg,
+        OKneg
 };
 
 enum
t@@ -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);
diff --git a/src/cmd/ndb/dnsdebug.c b/src/cmd/ndb/dnsdebug.c
t@@ -13,7 +13,7 @@ enum
         Ncache=                        8,
         Maxpath=                128,
         Maxreply=                512,
-        Maxrrr=                        16,
+        Maxrrr=                        16
 };
 
 static char *servername;
diff --git a/src/cmd/ndb/dnstcp.c b/src/cmd/ndb/dnstcp.c
t@@ -8,7 +8,7 @@
 
 enum
 {
-        Maxpath=                128,
+        Maxpath=                128
 };
 
 char        *logfile = "dns";
diff --git a/src/cmd/ndb/dntcpserver.c b/src/cmd/ndb/dntcpserver.c
t@@ -262,7 +262,7 @@ tcpproc(void *v)
 }
 
 enum {
-        Maxactivetcp = 4,
+        Maxactivetcp = 4
 };
 
 static int
diff --git a/src/cmd/ndb/ndbmkdb.c b/src/cmd/ndb/ndbmkdb.c
t@@ -12,7 +12,7 @@ enum
         Sys,
         Dk,
         Ip,
-        Domain,
+        Domain
 };
 
 int
diff --git a/src/cmd/ndb/ndbmkhosts.c b/src/cmd/ndb/ndbmkhosts.c
t@@ -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){
t@@ -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);