1 /* schemaparse.c - routines to parse config file objectclass definitions */
12 struct objclass *global_oc;
13 int global_schemacheck = 1; /* schemacheck on is default */
15 static void oc_usage(void);
29 struct objclass **ocp;
31 oc = (struct objclass *) ch_calloc( 1, sizeof(struct objclass) );
32 oc->oc_name = ch_strdup( argv[1] );
33 for ( i = 2; i < argc; i++ ) {
34 /* required attributes */
35 if ( strcasecmp( argv[i], "requires" ) == 0 ) {
39 char **s = str2charray( argv[i], "," );
40 last = argv[i][strlen( argv[i] ) - 1];
41 charray_merge( &oc->oc_required, s );
44 } while ( i < argc && last == ',' );
46 /* optional attributes */
47 } else if ( strcasecmp( argv[i], "allows" ) == 0 ) {
51 char **s = str2charray( argv[i], "," );
52 last = argv[i][strlen( argv[i] ) - 1];
54 charray_merge( &oc->oc_allowed, s );
57 } while ( i < argc && last == ',' );
61 "%s: line %d: expecting \"requires\" or \"allows\" got \"%s\"\n",
62 fname, lineno, argv[i] );
68 while ( *ocp != NULL ) {
69 ocp = &(*ocp)->oc_next;
77 fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
78 fprintf( stderr, " [ requires <attrlist> ]\n" );
79 fprintf( stderr, " [ allows <attrlist> ]\n" );