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);
74 * Start all processes and threads from other proc
75 * so we (main pid) can return to user.
77 c = chancreate(sizeof(void*), 0);
78 proccreate(mainproc, c, 8192);
91 vseprint(buf, buf+sizeof buf, fmt, args);
94 fprint(2, "%s: %s\n", progname, buf);
95 threadexitsall("error");
99 parseerror(char *fmt, ...)
105 vseprint(buf, buf+sizeof buf, fmt, args);
110 fprint(2, "%s\n", buf);
112 do; while(popinput());
113 lasterror = estrdup(buf);
114 longjmp(parsejmp, 1);
124 error("malloc failed: %r");
125 setmalloctag(p, getcallerpc(&n));
131 erealloc(void *p, long n)
135 error("realloc failed: %r");
136 setrealloctag(p, getcallerpc(&p));
147 error("estrdup failed: %r");
148 setmalloctag(t, getcallerpc(&s));