20 makeports(Ruleset *rules[])
24 for(i=0; rules[i]; i++)
25 addport(rules[i]->port);
41 threadmain(int argc, char *argv[])
55 user = getenv("user");
56 home = getenv("home");
57 if(user==nil || home==nil)
58 error("can't initialize $user or $home: %r");
60 sprint(buf, "%s/lib/plumbing", home);
61 plumbfile = estrdup(buf);
64 fd = open(plumbfile, OREAD);
66 error("can't open rules file %s: %r", plumbfile);
70 rules = readrules(plumbfile, fd);
73 * Start all processes and threads from other proc
74 * so we (main pid) can return to user.
76 c = chancreate(sizeof(void*), 0);
77 proccreate(mainproc, c, 8192);
90 vseprint(buf, buf+sizeof buf, fmt, args);
93 fprint(2, "%s: %s\n", progname, buf);
94 threadexitsall("error");
98 parseerror(char *fmt, ...)
104 vseprint(buf, buf+sizeof buf, fmt, args);
109 fprint(2, "%s\n", buf);
111 do; while(popinput());
112 lasterror = estrdup(buf);
113 longjmp(parsejmp, 1);
123 error("malloc failed: %r");
124 setmalloctag(p, getcallerpc(&n));
130 erealloc(void *p, long n)
134 error("realloc failed: %r");
135 setrealloctag(p, getcallerpc(&p));
146 error("estrdup failed: %r");
147 setmalloctag(t, getcallerpc(&s));