uss-fix-bogus-grammar-20021026
[openafs.git] / src / uss / grammar.y
1 %{
2 /*
3  * Copyright 2000, International Business Machines Corporation and others.
4  * All Rights Reserved.
5  * 
6  * This software has been released under the terms of the IBM Public
7  * License.  For details, see the LICENSE file in the top-level source
8  * directory or online at http://www.openafs.org/dl/license10.html
9  */
10
11 #include <afsconfig.h>
12 #include <afs/param.h>
13 #include <stdio.h>
14
15 #ifdef HAVE_STRING_H
16 #include <string.h>
17 #else
18 #ifdef HAVE_STRINGS_H
19 #include <strings.h>
20 #endif
21 #endif
22
23 extern int line;
24 extern int uss_perr;
25 %}
26
27 %union
28 {
29    int ival;
30   char chval;
31   char strval[1000];
32 }
33
34 %token  EOL_TKN
35 %token  DIR_TKN
36 %token FILE_TKN
37 %token ECHO_TKN
38 %token EXEC_TKN
39 %token LINK_TKN
40 %token SYMLINK_TKN
41 %token VOL_TKN
42 %token GROUP_TKN
43 %token AUTH_TKN
44 %token <strval> STRING_TKN
45 %token VOL1_TKN
46 %type <ival> input
47 %type <ival> entry
48 %type <strval> accesslist
49
50 %%      /* rules */
51
52 input   :       /* empty */
53                         { $$ = 0;}
54         |       input entry
55                         { $$ = ($1 == 0)? $2 : $1;}
56         ;
57
58 entry   :       DIR_TKN
59                 STRING_TKN      /*2-directory name*/
60                 STRING_TKN      /*3-mode*/
61                 STRING_TKN      /*4-owner*/
62                 accesslist      /*5-access list*/
63                         {$$ = uss_perr = uss_procs_BuildDir($2,$3,$4,$5);}
64         |       FILE_TKN
65                 STRING_TKN      /*2-filename*/
66                 STRING_TKN      /*3-mode*/
67                 STRING_TKN      /*4-owner*/
68                 STRING_TKN      /*5-rototype*/
69                         {$$ = uss_perr = uss_procs_CpFile($2, $3, $4, $5);}
70         |       ECHO_TKN
71                 STRING_TKN      /*2-filename*/
72                 STRING_TKN      /*3-mode*/
73                 STRING_TKN      /*4-owner*/
74                 STRING_TKN      /*5-file content*/
75                         {$$ = uss_perr = uss_procs_EchoToFile($2, $3, $4, $5);}
76         |       EXEC_TKN
77                 STRING_TKN      /*2-command string*/
78                         {$$ = uss_perr = uss_procs_Exec($2);}
79         |       LINK_TKN
80                 STRING_TKN      /*2-filename1*/
81                 STRING_TKN      /*3-filename2*/
82                         {$$ = uss_perr = uss_procs_SetLink($2, $3,'h');}
83
84         |       SYMLINK_TKN
85                 STRING_TKN      /*2-filename1*/
86                 STRING_TKN      /*3-filename2*/
87                         {$$ = uss_perr = uss_procs_SetLink($2, $3,'s');}
88         |       VOL_TKN
89                 STRING_TKN      /*2-vol name*/
90                 STRING_TKN      /*3-server*/
91                 STRING_TKN      /*4-partition*/
92                 STRING_TKN      /*5-quota*/
93                 STRING_TKN      /*6-Mount point*/
94                 STRING_TKN      /*7-Owner*/
95                 accesslist      /*8-access list*/
96                         {$$ = uss_perr = uss_vol_CreateVol($2, $3, $4, $5, $6, $7, $8);}
97         |       GROUP_TKN
98                 STRING_TKN      /*2-declared dir*/
99                         {$$ = uss_perr = uss_procs_AddToDirPool($2);}
100         |       AUTH_TKN
101                 STRING_TKN      /*2-user name*/
102                 STRING_TKN      /*3-password lifetime (days<255)*/
103                 STRING_TKN      /*4-reuse/noreuse */
104                 STRING_TKN      /*5-failed login attempts */
105                 STRING_TKN      /*6-lockout time */
106                         {$$ = uss_perr = uss_kauth_SetFields($2, $3, $4, $5, $6);}
107         |       VOL1_TKN
108                 STRING_TKN      /*2-vol name*/
109                 STRING_TKN      /*3-server*/
110                 STRING_TKN      /*4-partition*/
111                 STRING_TKN      /*5-quota*/
112                 STRING_TKN      /*6-Mount point*/
113                 STRING_TKN      /*7-Owner*/
114                 STRING_TKN      /*8-access list*/
115                         {$$ = uss_perr = uss_vol_CreateVol($2, $3, $4, $5, $6, $7, $8);}
116         |       EOL_TKN /*End of line */
117                         {$$=0;}
118         |       error entry
119                     {uss_procs_PrintErr(line-1, " near \"%s\"\n",yylval.strval);}
120         ;
121
122
123 accesslist :    /* empty */
124                         {strcpy($$," ");}
125         |       STRING_TKN
126                 STRING_TKN
127                 accesslist
128                         {strcat($1," "); strcat($2," ");strcat($1,strcat($2,$3));strcpy($$,$1);}
129                 
130         ;
131
132 %%
133 yyerror(s)
134 char *s;
135 {
136 fprintf(stderr,"%s. ",s);
137 }