1 /* schemaparse.c - routines to parse config file objectclass definitions */
12 struct objclass *global_oc;
13 int global_schemacheck;
15 static void oc_usage(void);
29 struct objclass **ocp;
31 oc = (struct objclass *) ch_calloc( 1, sizeof(struct objclass) );
32 oc->oc_name = strdup( argv[1] );
33 for ( i = 2; i < argc; i++ ) {
34 /* required attributes */
35 if ( strcasecmp( argv[i], "requires" ) == 0 ) {
39 last = argv[i][strlen( argv[i] ) - 1];
40 charray_merge( &oc->oc_required,
41 str2charray( argv[i], "," ) );
43 } while ( i < argc && last == ',' );
45 /* optional attributes */
46 } else if ( strcasecmp( argv[i], "allows" ) == 0 ) {
50 last = argv[i][strlen( argv[i] ) - 1];
51 charray_merge( &oc->oc_allowed,
52 str2charray( argv[i], "," ) );
54 } while ( i < argc && last == ',' );
58 "%s: line %d: expecting \"requires\" or \"allows\" got \"%s\"\n",
59 fname, lineno, argv[i] );
65 while ( *ocp != NULL ) {
66 ocp = &(*ocp)->oc_next;
74 fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
75 fprintf( stderr, " [ requires <attrlist> ]\n" );
76 fprintf( stderr, " [ allows <attrlist> ]\n" );