]> git.sur5r.net Git - openldap/commitdiff
Provide human-readable syntax errors.
authorJulio Sánchez Fernández <jsanchez@openldap.org>
Wed, 26 May 1999 19:21:55 +0000 (19:21 +0000)
committerJulio Sánchez Fernández <jsanchez@openldap.org>
Wed, 26 May 1999 19:21:55 +0000 (19:21 +0000)
libraries/libldap/schema.c

index 2e94d293f72c0fc20e57bcd44db996aeaa5f70a8..3a6eb417a34db670015a9d72599e1ccb5be80053 100644 (file)
@@ -1240,4 +1240,25 @@ ldap_str2objectclass( char * s, int * code, char ** errp )
        }
 }
 
+static char *err2text[] = {
+       "",
+       "Out of memory",
+       "Unexpected token",
+       "Missing opening parenthesis",
+       "Missing closing parenthesis",
+       "Expecting digit",
+       "Expecting a name",
+       "Bad description",
+       "Bad superiors",
+       "Duplicate option"
+};
 
+char *
+ldap_scherr2str(int code)
+{
+       if ( code < 1 || code >= (sizeof(err2text)/sizeof(char *)) ) {
+               return "Unknown error";
+       } else {
+               return err2text[code];
+       }
+}