From 676558aa64e0a1f36163da2319e4fd2703fcbc08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julio=20S=C3=A1nchez=20Fern=C3=A1ndez?= Date: Wed, 26 May 1999 19:21:55 +0000 Subject: [PATCH] Provide human-readable syntax errors. --- libraries/libldap/schema.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 2e94d293f7..3a6eb417a3 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -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]; + } +} -- 2.39.5