+static void
+at_usage( void )
+{
+ fprintf( stderr, "AttributeTypeDescription = \"(\" whsp\n");
+ fprintf( stderr, " numericoid whsp ; AttributeType identifier\n");
+ fprintf( stderr, " [ \"NAME\" qdescrs ] ; name used in AttributeType\n");
+ fprintf( stderr, " [ \"DESC\" qdstring ] ; description\n");
+ fprintf( stderr, " [ \"OBSOLETE\" whsp ]\n");
+ fprintf( stderr, " [ \"SUP\" woid ] ; derived from this other\n");
+ fprintf( stderr, " ; AttributeType\n");
+ fprintf( stderr, " [ \"EQUALITY\" woid ] ; Matching Rule name\n");
+ fprintf( stderr, " [ \"ORDERING\" woid ] ; Matching Rule name\n");
+ fprintf( stderr, " [ \"SUBSTR\" woid ] ; Matching Rule name\n");
+ fprintf( stderr, " [ \"SYNTAX\" whsp noidlen whsp ] ; see section 4.3\n");
+ fprintf( stderr, " [ \"SINGLE-VALUE\" whsp ] ; default multi-valued\n");
+ fprintf( stderr, " [ \"COLLECTIVE\" whsp ] ; default not collective\n");
+ fprintf( stderr, " [ \"NO-USER-MODIFICATION\" whsp ]; default user modifiable\n");
+ fprintf( stderr, " [ \"USAGE\" whsp AttributeUsage ]; default userApplications\n");
+ fprintf( stderr, " ; userApplications\n");
+ fprintf( stderr, " ; directoryOperation\n");
+ fprintf( stderr, " ; distributedOperation\n");
+ fprintf( stderr, " ; dSAOperation\n");
+ fprintf( stderr, "whsp \")\"\n");
+ exit( 1 );
+}
+
+void
+parse_at(
+ char *fname,
+ int lineno,
+ char *line
+)
+{
+ LDAP_ATTRIBUTE_TYPE *at;
+ int code;
+ const char *err;
+
+ at = ldap_str2attributetype(line,&code,&err);
+ if ( !at ) {
+ fprintf( stderr, "%s: line %d: %s before %s\n",
+ fname, lineno, ldap_scherr2str(code), err );
+ at_usage();
+ }
+ code = at_add(at,&err);
+ if ( code ) {
+ fprintf( stderr, "%s: line %d: %s %s\n",
+ fname, lineno, scherr2str(code), err);
+ exit( 1 );
+ }
+ ldap_memfree(at);
+}