From 03d1138e88d396515fdcdef5a077d87c5ecb50e3 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 12 Mar 2003 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2003-03-12 --- pc/devether.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pc/devether.c b/pc/devether.c index 5220eb1c5eb9e9e937ddbaca444e99a3058635d1..631bdb8d847a8e6109c3df69ed7b36704f54236b 100644 --- a/pc/devether.c +++ b/pc/devether.c @@ -241,17 +241,25 @@ etherwrite(Chan* chan, void* buf, long n, vlong) { Ether *ether; Block *bp; - int nn; + int nn, onoff; + Cmdbuf *cb; ether = etherxx[chan->dev]; if(NETTYPE(chan->qid.path) != Ndataqid) { nn = netifwrite(ether, chan, buf, n); if(nn >= 0) return nn; - if(n == sizeof("nonblocking")-1 && strncmp((char*)buf, "nonblocking", n) == 0){ - qnoblock(ether->oq, 1); + cb = parsecmd(buf, n); + if(strcmp(cb->f[0], "nonblocking") == 0){ + if(cb->nf <= 1) + onoff = 1; + else + onoff = atoi(cb->f[1]); + qnoblock(ether->oq, onoff); + free(cb); return n; } + free(cb); if(ether->ctl!=nil) return ether->ctl(ether,buf,n);