2 #include <sys/socket.h>
3 #include <netinet/in.h>
10 fprint(2, "usage: vmount [-v] [-h handle] address mountpoint\n");
20 main(int argc, char **argv)
24 int n, port, proto, verbose;
25 struct sockaddr_in sa;
33 sysfatal("bad handle '%s'", p);
34 if(n > 2*sizeof handle)
35 sysfatal("handle too long '%s'", p);
37 if(dec16(handle, n/2, p, n) != n/2)
38 sysfatal("bad hex in handle '%s'", p);
52 p = p9netmkaddr(argv[0], "udp", "nfs");
53 if(p9dialparse(strdup(p), &net, &unx, &host, &port) < 0)
54 sysfatal("bad address '%s'", p);
57 print("nfs server is net=%s addr=%d.%d.%d.%d port=%d\n",
58 net, host&0xFF, (host>>8)&0xFF, (host>>16)&0xFF, host>>24, port);
61 if(strcmp(net, "tcp") == 0)
63 else if(strcmp(net, "udp") == 0)
66 sysfatal("bad proto %s: can only handle tcp and udp", net);
68 memset(&sa, 0, sizeof sa);
69 memmove(&sa.sin_addr, &host, 4);
70 sa.sin_family = AF_INET;
71 sa.sin_port = htons(port);
73 mountnfs(proto, &sa, handle, handlelen, argv[1]);