1 /* schemaparse.c - routines to parse config file objectclass definitions */
8 #include <sys/socket.h>
11 extern char **str2charray();
12 extern void charray_merge();
14 struct objclass *global_oc;
15 int global_schemacheck;
17 static void oc_usage();
31 struct objclass **ocp;
33 oc = (struct objclass *) ch_calloc( 1, sizeof(struct objclass) );
34 oc->oc_name = strdup( argv[1] );
35 for ( i = 2; i < argc; i++ ) {
36 /* required attributes */
37 if ( strcasecmp( argv[i], "requires" ) == 0 ) {
41 last = argv[i][strlen( argv[i] ) - 1];
42 charray_merge( &oc->oc_required,
43 str2charray( argv[i], "," ) );
45 } while ( i < argc && last == ',' );
47 /* optional attributes */
48 } else if ( strcasecmp( argv[i], "allows" ) == 0 ) {
52 last = argv[i][strlen( argv[i] ) - 1];
53 charray_merge( &oc->oc_allowed,
54 str2charray( argv[i], "," ) );
56 } while ( i < argc && last == ',' );
60 "%s: line %d: expecting \"requires\" or \"allows\" got \"%s\"\n",
61 fname, lineno, argv[i] );
67 while ( *ocp != NULL ) {
68 ocp = &(*ocp)->oc_next;
76 fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
77 fprintf( stderr, " [ requires <attrlist> ]\n" );
78 fprintf( stderr, " [ allows <attrlist> ]\n" );