aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/plumb/plumber.h
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-23 17:58:26 +0000
committerrsc <devnull@localhost>2003-11-23 17:58:26 +0000
commitb8c14089d8f4be73a908f82f62fce80ed2c14a8d (patch)
tree1d3db32a1ff576873d44d4bef60f13f020d5e10d /src/cmd/plumb/plumber.h
parent7763a61a3582ef330bca54f225e8ec5325fbd35e (diff)
downloadplan9port-b8c14089d8f4be73a908f82f62fce80ed2c14a8d.tar.gz
plan9port-b8c14089d8f4be73a908f82f62fce80ed2c14a8d.tar.bz2
plan9port-b8c14089d8f4be73a908f82f62fce80ed2c14a8d.zip
Plan 9 version, nothing tweaked yet.
Diffstat (limited to 'src/cmd/plumb/plumber.h')
-rw-r--r--src/cmd/plumb/plumber.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/cmd/plumb/plumber.h b/src/cmd/plumb/plumber.h
new file mode 100644
index 00000000..0d1205f9
--- /dev/null
+++ b/src/cmd/plumb/plumber.h
@@ -0,0 +1,93 @@
+typedef struct Exec Exec;
+typedef struct Rule Rule;
+typedef struct Ruleset Ruleset;
+
+/*
+ * Object
+ */
+enum
+{
+ OArg,
+ OAttr,
+ OData,
+ ODst,
+ OPlumb,
+ OSrc,
+ OType,
+ OWdir,
+};
+
+/*
+ * Verbs
+ */
+enum
+{
+ VAdd, /* apply to OAttr only */
+ VClient,
+ VDelete, /* apply to OAttr only */
+ VIs,
+ VIsdir,
+ VIsfile,
+ VMatches,
+ VSet,
+ VStart,
+ VTo,
+};
+
+struct Rule
+{
+ int obj;
+ int verb;
+ char *arg; /* unparsed string of all arguments */
+ char *qarg; /* quote-processed arg string */
+ Reprog *regex;
+};
+
+struct Ruleset
+{
+ int npat;
+ int nact;
+ Rule **pat;
+ Rule **act;
+ char *port;
+};
+
+struct Exec
+{
+ Plumbmsg *msg;
+ char *match[10];
+ int p0; /* begin and end of match */
+ int p1;
+ int clearclick; /* click was expanded; remove attribute */
+ int setdata; /* data should be set to $0 */
+ int holdforclient; /* exec'ing client; keep message until port is opened */
+ /* values of $variables */
+ char *file;
+ char *dir;
+};
+
+void parseerror(char*, ...);
+void error(char*, ...);
+void* emalloc(long);
+void* erealloc(void*, long);
+char* estrdup(char*);
+Ruleset** readrules(char*, int);
+void startfsys(void);
+Exec* matchruleset(Plumbmsg*, Ruleset*);
+void freeexec(Exec*);
+char* startup(Ruleset*, Exec*);
+char* printrules(void);
+void addport(char*);
+char* writerules(char*, int);
+char* expand(Exec*, char*, char**);
+void makeports(Ruleset*[]);
+void printinputstack(void);
+int popinput(void);
+
+Ruleset **rules;
+char *user;
+char *home;
+jmp_buf parsejmp;
+char *lasterror;
+char **ports;
+int nports;