7 fprint(2, "usage: %s [-dR] [-p perm] [-P patternfile] [-e exportfs] srvname path\n", argv0);
12 main(int argc, char **argv)
14 char *ename, *arglist[16], **argp;
20 ename = "/bin/exportfs";
29 ename = EARGF(usage());
32 perm = strtol(EARGF(usage()), 0, 8);
36 *argp++ = EARGF(usage());
47 fprint(2, "can't pipe: %r\n");
51 switch(rfork(RFPROC|RFNOWAIT|RFNOTEG|RFFDG)){
53 fprint(2, "can't rfork: %r\n");
61 fprint(2, "can't exec exportfs: %r\n");
67 if(fprint(pipefd[1], "%s", argv[1]) < 0){
68 fprint(2, "can't write pipe: %r\n");
71 n = read(pipefd[1], buf, sizeof buf-1);
73 fprint(2, "can't read pipe: %r\n");
77 if(n != 2 || strcmp(buf, "OK") != 0){
78 fprint(2, "not OK (%d): %s\n", n, buf);
82 strecpy(buf, buf+sizeof buf, argv[0]);
84 snprint(buf, sizeof buf, "/srv/%s", argv[0]);
85 fd = create(buf, OWRITE, perm);
87 fprint(2, "can't create %s: %r\n", buf);
90 fprint(fd, "%d", pipefd[1]);