1 /* Copyright (c) 2014 The Regents of the University of California
2 * Barret Rhoden <brho@cs.berkeley.edu>
3 * See LICENSE for details.
5 * srv DIALSTRING SRVNAME
7 * Opens DIALSTRING and drops its chan in #s at SRVNAME */
14 #include <parlib/net.h>
15 #include <iplib/iplib.h>
17 #include <sys/types.h>
21 int main(int argc, char *argv[])
23 char *dialstring, *srvname;
30 printf("Usage: %s DIALSTRING SRVNAME\n", argv[0]);
36 dfd = dial9(dialstring, 0, 0, 0, 0);
38 perror("Unable to dial!");
41 ret = snprintf(buf, buf_len, "#srv/%s", srvname);
42 if (snprintf_overflow(ret, buf, buf_len)) {
43 printf("srvname too long\n");
46 srvfd = open(buf, O_RDWR | O_EXCL | O_CREAT, 0666);
48 perror("Can't create srvvile");
52 ret = snprintf(buf, buf_len, "%d", dfd);
53 ret = write(srvfd, buf, ret);
55 perror("Failed to post fd");