aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9p.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-07-04 12:38:40 -0400
committerRuss Cox <rsc@swtch.com>2008-07-04 12:38:40 -0400
commita380a0033d4d5abda7d74d4ae437c806b57412bf (patch)
tree0d1b9a13c34b328a578a12946106b4745cadb14e /src/cmd/9p.c
parentcab935a0ba34797d8b75fe1cfb7624a33d25e671 (diff)
downloadplan9port-a380a0033d4d5abda7d74d4ae437c806b57412bf.tar.gz
plan9port-a380a0033d4d5abda7d74d4ae437c806b57412bf.tar.bz2
plan9port-a380a0033d4d5abda7d74d4ae437c806b57412bf.zip
9p: can go back to using write
Diffstat (limited to 'src/cmd/9p.c')
-rw-r--r--src/cmd/9p.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/cmd/9p.c b/src/cmd/9p.c
index 135d9c50..105fd3a1 100644
--- a/src/cmd/9p.c
+++ b/src/cmd/9p.c
@@ -25,26 +25,6 @@ usage(void)
threadexitsall("usage");
}
-int
-writen(int fd, void *buf, int n)
-{
- int m, tot;
-
- if(n < 0){
- werrstr("bad count");
- return -1;
- }
- if(n == 0)
- return 0;
-
- tot = 0;
- while((m = write(fd, (char*)buf+tot, n-tot)) > 0)
- tot += m;
- if(tot < n)
- return -1;
- return n;
-}
-
CFsys *(*nsmnt)(char*, char*) = nsamount;
CFsys *(*fsmnt)(int, char*) = fsamount;
@@ -183,7 +163,7 @@ xread(int argc, char **argv)
fid = xopen(argv[0], OREAD);
while((n = fsread(fid, buf, sizeof buf)) > 0)
- if(writen(1, buf, n) < 0)
+ if(write(1, buf, n) < 0)
sysfatal("write error: %r");
fsclose(fid);
if(n < 0)
@@ -208,7 +188,7 @@ xreadfd(int argc, char **argv)
fd = xopenfd(argv[0], OREAD);
while((n = read(fd, buf, sizeof buf)) > 0)
- if(writen(1, buf, n) < 0)
+ if(write(1, buf, n) < 0)
sysfatal("write error: %r");
if(n < 0)
sysfatal("read error: %r");
@@ -286,7 +266,7 @@ xwritefd(int argc, char **argv)
fd = xopenfd(argv[0], OWRITE|OTRUNC);
while((n = read(0, buf, sizeof buf)) > 0)
- if(writen(fd, buf, n) != n)
+ if(write(fd, buf, n) != n)
sysfatal("write error: %r");
if(n < 0)
sysfatal("read error: %r");
@@ -339,7 +319,7 @@ xrdwr(int argc, char **argv)
if((n = fsread(fid, buf, sizeof buf)) < 0)
fprint(2, "read: %r\n");
else{
- if(writen(1, buf, n) < 0 || writen(1, "\n", 1) < 0)
+ if(write(1, buf, n) < 0 || write(1, "\n", 1) < 0)
sysfatal("write error: %r");
}
n = read(0, buf, sizeof buf);