Browse Source

Plan 9 from Bell Labs 2011-04-16

David du Colombier 13 years ago
parent
commit
ca3b17b750

+ 18 - 0
sys/man/1/awk

@@ -251,6 +251,12 @@ substring of
 that begins at position
 .IR m 
 counted from 1.
+If
+.I n
+is omitted, it is taken to be the length of
+.I s
+from
+.IR m .
 .TP
 .BI index( s , " t" )
 the position in
@@ -303,6 +309,18 @@ If
 is not given,
 .B $0
 is used.
+A
+.L &
+character in
+.I t
+will be replaced by the sub-string of
+.I s
+matched by
+.IR r ;
+it may be escaped with
+.L \e
+to substitute a literal
+.LR & .
 .TP
 .B gsub
 same as

+ 9 - 5
sys/man/1/sed

@@ -130,7 +130,7 @@ is created before processing begins.
 There can be at most 120 distinct
 .I wfile
 arguments.
-.TP \w'\fL!\ \fIfunction\fLXXX'u
+.TP \w'\fL!\ \fIfunction\fL'u
 .B a\e
 .br
 .ns
@@ -229,7 +229,11 @@ Substitute the
 .I replacement
 string for instances of the
 .I regular-expression
-in the pattern space.
+in the pattern space,
+as per
+.I regsub
+in
+.IR regexp (2).
 Any character may be used instead of
 .LR / .
 For a fuller description see
@@ -247,6 +251,8 @@ first one.
 .TP
 .B p
 Print the pattern space if a replacement was made.
+.TF "w\fI wfile "
+.PD
 .TP
 .BI w " wfile"
 Write.
@@ -270,9 +276,7 @@ If
 .I label
 is empty, branch to the end of the script.
 .TP
-.B w
-.I wfile
-.br
+.BI w " wfile"
 Write.
 Append the pattern space to
 .IR wfile .

+ 5 - 4
sys/src/9/pc/ether82563.c

@@ -1106,11 +1106,12 @@ i82563rproc(void* arg)
 					bp->flag |= Bpktck;
 				}
 				etheriq(edev, bp, 1);
-			} else if (rd->status & Reop && rd->errors)
-				print("%s: input packet error %#ux\n",
-					tname[ctlr->type], rd->errors);
-			else
+			} else {
+				if (rd->status & Reop && rd->errors)
+					print("%s: input packet error %#ux\n",
+						tname[ctlr->type], rd->errors);
 				freeb(bp);
+			}
 			ctlr->rb[rdh] = nil;
 
 			rd->status = 0;

+ 4 - 4
sys/src/cmd/ip/ipconfig/ipv6.c

@@ -647,14 +647,14 @@ recvrahost(uchar buf[], int pktlen)
 					ra->src, conf.dev, prfo->pref);
 			}
 			break;
+		default:
+			ralog("ignoring optype %d in Routeradv from %I",
+				optype, ra->src);
+			/* fall through */
 		case V6nd_srcaddrs:
 			/* netsbd sends this, so quietly ignore it for now */
 			m += 8 * buf[m+1];
 			break;
-		default:
-			m += 8 * buf[m+1];
-			ralog("ignoring optype %d in Routeradv", optype);
-			break;
 		}
 	}
 }

+ 3 - 1
sys/src/cmd/ndb/dblookup.c

@@ -1188,13 +1188,15 @@ insideaddr(char *dom)
 
 	if (!cfg.inside || !cfg.straddle || !cfg.serve)
 		return 1;
+	if (dom[0] == '\0' || strcmp(dom, ".") == 0)	/* dns root? */
+		return 1;			/* hack for initialisation */
 
 	lock(&dblock);
 	if (indoms == nil)
 		loaddomsrvs();
 	if (indoms == nil) {
 		unlock(&dblock);
-		return 1;	/* no "inside" sys, try inside nameservers */
+		return 1;  /* no "inside-dom" sys, try inside nameservers */
 	}
 
 	rv = 0;

+ 2 - 0
sys/src/cmd/ndb/dn.c

@@ -1127,6 +1127,8 @@ rrremneg(RR **l)
 	RR **nl, *rp;
 	RR *first;
 
+	if (canlock(&dnlock))
+		abort();	/* rrremneg called with dnlock not held */
 	first = nil;
 	nl = &first;
 	while(*l != nil){

+ 10 - 10
sys/src/cmd/ndb/dnresolve.c

@@ -69,8 +69,8 @@ struct Query {
 
 	/* dest must not be on the stack due to forking in slave() */
 	Dest	*dest;		/* array of destinations */
-	Dest	*curdest;	/* pointer to one of them */
-	int	ndest;
+	Dest	*curdest;	/* pointer to next to fill */
+	int	ndest;		/* transmit to this many on this round */
 
 	int	udpfd;
 
@@ -287,12 +287,6 @@ destck(Dest *p)
 	assert(p->magic == Destmagic);
 }
 
-static void
-destdestroy(Dest *p)
-{
-	USED(p);
-}
-
 /*
  * if the response to a query hasn't arrived within 100 ms.,
  * it's unlikely to arrive at all.  after 1 s., it's really unlikely.
@@ -592,6 +586,8 @@ initdnsmsg(DNSmsg *mp, RR *rp, int flags, ushort reqno)
 	mp->flags = flags;
 	mp->id = reqno;
 	mp->qd = rp;
+	if(rp != nil)
+		mp->qdcount = 1;
 }
 
 DNSmsg *
@@ -814,7 +810,7 @@ ipisbm(uchar *ip)
 }
 
 /*
- *  Get next server address
+ *  Get next server address(es) into qp->dest[nd] and beyond
  */
 static int
 serveraddrs(Query *qp, int nd, int depth)
@@ -1107,6 +1103,9 @@ xmitquery(Query *qp, int medium, int depth, uchar *obuf, int inns, int len)
 			if((1<<p->nx) > qp->ndest)
 				continue;
 
+			if(memcmp(p->a, IPnoaddr, sizeof IPnoaddr) == 0)
+				continue;		/* mistake */
+
 			procsetname("udp %sside query to %I/%s %s %s",
 				(inns? "in": "out"), p->a, p->s->name,
 				qp->dp->name, rrname(qp->type, buf, sizeof buf));
@@ -1322,7 +1321,8 @@ tcpquery(Query *qp, DNSmsg *mp, int depth, uchar *ibuf, uchar *obuf, int len,
 }
 
 /*
- *  query name servers.  If the name server returns a pointer to another
+ *  query name servers.  fill in obuf with on-the-wire representation of a
+ *  DNSmsg derived from qp.  if the name server returns a pointer to another
  *  name server, recurse.
  */
 static int

+ 2 - 2
sys/src/cmd/ndb/dns.c

@@ -218,10 +218,10 @@ main(int argc, char *argv[])
 
 	srand(now*getpid());
 	db2cache(1);
-//	dnageallnever();		/* someday try this again */
+//	dnageallnever();
 
 	if (cfg.straddle && !seerootns())
-		dnslog("straddle server misconfigured; can't see root name servers");
+		dnslog("straddle server misconfigured; can't resolve root name servers");
 	/*
 	 * fork without sharing heap.
 	 * parent waits around for child to die, then forks & restarts.