1 /*
2  * The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
3  *
4  * This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
5  * in April-May 1998
6  *
7  * Copyright (C) 1998, 1999 by Angelos D. Keromytis.
8  *
9  * Permission to use, copy, and modify this software without fee
10  * is hereby granted, provided that this entire notice is included in
11  * all copies of any software which is or includes a copy or
12  * modification of this software.
13  *
14  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
15  * IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
16  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
17  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
18  * PURPOSE.
19  */
20 %union {
21 	struct s {
22 		char   *string;
23 	} s;
24 };
25 %type <s.string> STRING VSTRING
26 %token STRING VSTRING EQ
27 %nonassoc EQ
28 %start program
29 %{
30 #if HAVE_CONFIG_H
31 #include "config.h"
32 #endif /* HAVE_CONFIG_H */
33 
34 #include <sys/types.h>
35 #include <stdlib.h>
36 #include <stdio.h>
37 
38 #if STDC_HEADERS
39 #include <string.h>
40 #endif /* STDC_HEADERS */
41 
42 #include "header.h"
43 #include "keynote.h"
44 %}
45 %%
46 
47 program: expr
48        | STRING              { if (kn_add_authorizer(sessid, $1) != 0)
49 				 return keynote_errno;
50                                free($1);
51                              };
52 
53 expr: VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0);
54 
55                                if (i != 0)
56 				 return i;
57 			       free($1);
58 			       free($3);
59                              }
60     | VSTRING EQ STRING      { int i = kn_add_action(sessid, $1, $3, 0);
61 
62                                if (i != 0)
63 				 return i;
64 			       free($1);
65 			       free($3);
66                              } expr ;
67 %%
68 void
69 kverror(char *s)
70 {}
71