aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pserve.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-06-11 06:40:54 -0700
committerRuss Cox <rsc@swtch.com>2008-06-11 06:40:54 -0700
commitef6606c7a7f22ae6cca150c6433748102640e130 (patch)
treeb661145f4737bec71f15e0869043fbe288add856 /src/cmd/9pserve.c
parente082105c33333969c3b3e29349801b5d9abf6932 (diff)
downloadplan9port-ef6606c7a7f22ae6cca150c6433748102640e130.tar.gz
plan9port-ef6606c7a7f22ae6cca150c6433748102640e130.tar.bz2
plan9port-ef6606c7a7f22ae6cca150c6433748102640e130.zip
9pserve: add -c option
Diffstat (limited to 'src/cmd/9pserve.c')
-rw-r--r--src/cmd/9pserve.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cmd/9pserve.c b/src/cmd/9pserve.c
index 88e0f6fb..8e03843a 100644
--- a/src/cmd/9pserve.c
+++ b/src/cmd/9pserve.c
@@ -136,7 +136,7 @@ int cvtustat(Fcall*, uchar**, int);
void
usage(void)
{
- fprint(2, "usage: 9pserve [-lnv] [-A aname afid] [-M msize] address\n");
+ fprint(2, "usage: 9pserve [-lnv] [-A aname afid] [-c addr] [-M msize] address\n");
fprint(2, "\treads/writes 9P messages on stdin/stdout\n");
threadexitsall("usage");
}
@@ -146,7 +146,7 @@ extern int _threaddebuglevel;
void
threadmain(int argc, char **argv)
{
- char *file, *x;
+ char *file, *x, *addr;
int fd;
x = getenv("verbose9pserve");
@@ -166,6 +166,15 @@ threadmain(int argc, char **argv)
versioned = 1;
msize = atoi(EARGF(usage()));
break;
+ case 'c':
+ addr = netmkaddr(EARGF(usage()), "net", "9fs");
+ if((fd = dial(addr, nil, nil, nil)) < 0)
+ sysfatal("dial %s: %r", addr);
+ dup(fd, 0);
+ dup(fd, 1);
+ if(fd > 1)
+ close(fd);
+ break;
case 'n':
noauth = 1;
break;