Blob


1 typedef struct Exec Exec;
2 typedef struct Rule Rule;
3 typedef struct Ruleset Ruleset;
5 /*
6 * Object
7 */
8 enum
9 {
10 OArg,
11 OAttr,
12 OData,
13 ODst,
14 OPlumb,
15 OSrc,
16 OType,
17 OWdir
18 };
20 /*
21 * Verbs
22 */
23 enum
24 {
25 VAdd, /* apply to OAttr only */
26 VClient,
27 VDelete, /* apply to OAttr only */
28 VIs,
29 VIsdir,
30 VIsfile,
31 VMatches,
32 VSet,
33 VStart,
34 VTo
35 };
37 struct Rule
38 {
39 int obj;
40 int verb;
41 char *arg; /* unparsed string of all arguments */
42 char *qarg; /* quote-processed arg string */
43 Reprog *regex;
44 };
46 struct Ruleset
47 {
48 int npat;
49 int nact;
50 Rule **pat;
51 Rule **act;
52 char *port;
53 };
55 struct Exec
56 {
57 Plumbmsg *msg;
58 char *match[10];
59 int p0; /* begin and end of match */
60 int p1;
61 int clearclick; /* click was expanded; remove attribute */
62 int setdata; /* data should be set to $0 */
63 int holdforclient; /* exec'ing client; keep message until port is opened */
64 /* values of $variables */
65 char *file;
66 char *dir;
67 };
69 void parseerror(char*, ...);
70 void error(char*, ...);
71 void* emalloc(long);
72 void* erealloc(void*, long);
73 char* estrdup(char*);
74 Ruleset** readrules(char*, int);
75 void startfsys(int);
76 Exec* matchruleset(Plumbmsg*, Ruleset*);
77 void freeexec(Exec*);
78 char* startup(Ruleset*, Exec*);
79 char* printrules(void);
80 void addport(char*);
81 char* writerules(char*, int);
82 char* expand(Exec*, char*, char**);
83 void makeports(Ruleset*[]);
84 void printinputstack(void);
85 int popinput(void);
87 Ruleset **rules;
88 char *user;
89 char *home;
90 jmp_buf parsejmp;
91 char *lasterror;
92 char **ports;
93 int nports;
94 int debug;