4 * Copyright 2000, International Business Machines Corporation and others.
7 * This software has been released under the terms of the IBM Public
8 * License. For details, see the LICENSE file in the top-level source
9 * directory or online at http://www.openafs.org/dl/license10.html
12 * Special test version of the grammar defining the set of
13 * things recognized by package, the AFS workstation config-
17 #include <afs/param.h>
18 #include <sys/param.h>
20 #include <sys/types.h>
22 #if defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)
23 #include <sys/mkdev.h>
25 #ifdef AFS_LINUX20_ENV
26 #include <sys/sysmacros.h>
34 #if defined(AFS_AIX41_ENV) || defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV)
35 int test_linecounter; /*Line number currently being parsed*/
38 char *appendchtostr();
39 #endif /* AFS_AIX41_ENV */
66 %token <strval> PATHNAME
70 %type <usval> filetype
71 %type <usval> devicetype
72 %type <usval> updatespecs
73 %type <usval> updateflag
74 %type <strval> filename
75 %type <protoval> devprototype
76 %type <protoval> fileprototype
80 %type <ownval> ownershipinfo
81 %type <strval> username
82 %type <strval> groupname
85 %type <usval> octalnumber
91 { $$ = InitializeConfigTree();
92 test_linecounter = 1; }
94 { $$ = ($1 == 0)? $2 : $1; }
97 entry : COMMENT NEWLINE
98 { $$ = 0; test_linecounter++; }
100 { $$ = 0; test_linecounter++; }
101 | devicetype /*Specifies type of device to be updated
103 updatespecs /*Specifies actions during update, if
105 filename /*Name of device being updated*/
106 devprototype /*Device numbers for device being updated*/
107 ownershipinfo /*Ownership info for device being updated*/
108 mode /*Protection bits for file being updated*/
111 $$ = testAddEntry($1, $2, $3, $4, $5, $6);
119 ReleaseEntry($3, $4, $5);
123 | filetype /*Specifies type of file to be updated;
124 e.g. regular file, directory, special
126 updatespecs /*Specifies actions during update, if
128 filename /*Name of file being updated*/
129 fileprototype /*Prototype for file being updated, if
130 necessary - e.g., directory prefix,
131 master copy, device numbers etc.*/
132 ownershipinfo /*Ownership info for file being updated,
133 should default to info from prototype*/
134 mode /*Protection bits for file being updated;
135 should default to info from prototype*/
138 $$ = testAddEntry($1, $2, $3, $4, $5, $6);
146 ReleaseEntry($3, $4, $5);
151 devicetype: BLKTYPE /*Block device*/
153 | CHRTYPE /*Character device*/
155 | PIPETYPE /*Named pipe*/
163 filetype: REGTYPE /*Regular file*/
165 | DIRTYPE /*Directory*/
167 | LNKTYPE /* symbolic link */
173 #endif /* AFS_AIX_ENV */
178 updatespecs : /*empty */
180 | /*empty */ WHITESPACE
182 | updatespecs updateflag
184 | updatespecs updateflag WHITESPACE
190 * Throw this out later
197 /*Make this a lost+found directory*/
202 /*Extra files not configured to be removed*/
207 /*Update only if file not present*/
212 /*Rename old copy with a suffix of .old*/
217 /*Prototype specifies an absolute path
218 rather than the prefix*/
223 /*Exit with status=4 if file is updated,
224 indicating that a reboot is needed*/
232 filename : PATHNAME /*Pathname of the file to be
233 updated, may not have white-
236 | PATHNAME WHITESPACE /*Pathname of the file to be
241 fileprototype: /* empty */
242 { $$.flag = P_NONE; }
243 | filename /*Pathname of prototype file or directory
245 { $$.flag = P_FILE; $$.info.path = $1; }
248 devprototype: devmajor WHITESPACE devminor /*Major & minor device
250 { $$.flag = P_DEV; $$.info.rdev = makedev($1, $3); }
256 if ((0 > $1) || ($1 > 255))
257 fatal("%d; invalid device number", $1);
264 if ((0 > $1) || ($1 > 255))
265 fatal("%d; invalid device number", $1);
270 if ((0 > $1) || ($1 > 255))
271 fatal("%d; invalid device number", $1);
278 dbgprint((stderr, "digit %u\n", $$));
282 dbgprint((stderr, "10 * %u + %u = %u\n", $1,$2,$$));
286 ownershipinfo: /* empty */
287 { $$.username = NULL; $$.groupname = NULL; }
289 { $$.username = $1; $$.groupname = $2; }
298 groupname: /* empty */
307 { $$ = ch2str(yylval.chval); }
309 { $$ = ch2str('0'+$1); } */
311 { $$ = appendchtostr($1, $2); }
313 { $$ = appendchtostr($1, '0'+$2); }
317 { $$.inherit_flag = TRUE; }
319 { $$.inherit_flag = TRUE; }
320 | octalnumber /*Last field of entry, may not have
321 anything before newline*/
322 { $$.inherit_flag = FALSE; $$.modeval = (afs_uint32)$1; }
323 | octalnumber WHITESPACE /*Last field of entry, but may have
324 some whitespace before newline*/
325 { $$.inherit_flag = FALSE; $$.modeval = (afs_uint32)$1; }
326 | octalnumber COMMENT /*Last field of entry, but may have
327 a comment before newline*/
328 { $$.inherit_flag = FALSE; $$.modeval = (afs_uint32)$1; }
329 | octalnumber WHITESPACE COMMENT /*Last field of entry, but
330 may have some whitespace
331 and a comment before the
333 { $$.inherit_flag = FALSE; $$.modeval = (afs_uint32)$1; }
338 dbgprint((stderr, "digit %u\n", $$));
342 dbgprint((stderr, "8 * %u + %u = %u\n", $1,$2, $$));
349 #ifndef AFS_AIX41_ENV
350 int test_linecounter; /*Line number currently being parsed*/
351 #endif /* !AFS_AIX41_ENV */
356 * Returns the pointer to a string consisting of the character c
361 s = (char *)emalloc(2);
366 char *appendchtostr(s, c)
369 * Returns the pointer to a NULL terminated string containing the
370 * character c appended to the contents of the string s
374 str = (char *)emalloc((unsigned)(strlen(s) + 2));
375 sprintf(str, "%s%c", s, c);
380 ReleaseEntry(f, p, o)
385 * Release storage allocated for various data structures during the
386 * parsing of an entry.
389 if (f != NULL) free(f);
390 if ((p.flag == P_FILE) && (p.info.path != NULL)) free(p.info.path);
391 if (o.username != NULL) free(o.username);
392 if (o.groupname != NULL) free(o.groupname);