diff options
author | rsc <devnull@localhost> | 2005-03-18 19:19:40 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-03-18 19:19:40 +0000 |
commit | 3880f0203b4413cdce29fe73952cad434b414627 (patch) | |
tree | c5f6126591c3cb4498f839fd3db5dd4b248bb054 | |
parent | 1d2f561222ffae64033f918b9f64d59db750b62f (diff) | |
download | plan9port-3880f0203b4413cdce29fe73952cad434b414627.tar.gz plan9port-3880f0203b4413cdce29fe73952cad434b414627.tar.bz2 plan9port-3880f0203b4413cdce29fe73952cad434b414627.zip |
new
-rw-r--r-- | src/cmd/srv.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/cmd/srv.c b/src/cmd/srv.c new file mode 100644 index 00000000..95dfef88 --- /dev/null +++ b/src/cmd/srv.c @@ -0,0 +1,41 @@ +#include <u.h> +#include <libc.h> +#include <auth.h> +#include <fcall.h> +#include <thread.h> + +void +usage(void) +{ + fprint(2, "usage: srv addr [srvname]\n"); + threadexitsall("usage"); +} + +void +threadmain(int argc, char **argv) +{ + int fd; + char *addr, *service; + + ARGBEGIN{ + default: + usage(); + }ARGEND + + if(argc != 1 && argc != 2) + usage(); + + addr = netmkaddr(argv[0], "tcp", "9fs"); + if((fd = dial(addr, nil, nil, nil)) < 0) + sysfatal("dial %s: %r", addr); + + if(argc == 2) + service = argv[1]; + else + service = argv[0]; + + if(post9pservice(fd, service) < 0) + sysfatal("post9pservice: %r"); + + threadexitsall(0); +} |