]> git.sur5r.net Git - openldap/blob - servers/slapd/index.c
s/forms/form in PADL copyright
[openldap] / servers / slapd / index.c
1 /* index.c - index utilities */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11 #include <ac/string.h>
12
13 #include "slap.h"
14
15 int slap_str2index( const char *str, slap_mask_t *idx )
16 {
17         if ( strcasecmp( str, "pres" ) == 0 ) {
18                 *idx = SLAP_INDEX_PRESENT;
19         } else if ( strcasecmp( str, "eq" ) == 0 ) {
20                 *idx = SLAP_INDEX_EQUALITY;
21         } else if ( strcasecmp( str, "approx" ) == 0 ) {
22                 *idx = SLAP_INDEX_APPROX;
23         } else if ( strcasecmp( str, "subinitial" ) == 0 ) {
24                 *idx = SLAP_INDEX_SUBSTR_INITIAL;
25         } else if ( strcasecmp( str, "subany" ) == 0 ) {
26                 *idx = SLAP_INDEX_SUBSTR_ANY;
27         } else if ( strcasecmp( str, "subfinal" ) == 0 ) {
28                 *idx = SLAP_INDEX_SUBSTR_FINAL;
29         } else if ( strcasecmp( str, "substr" ) == 0 ||
30                 strcasecmp( str, "sub" ) == 0 )
31         {
32                 *idx = SLAP_INDEX_SUBSTR_DEFAULT;
33         } else if ( strcasecmp( str, "nolang" ) == 0 || /* backwards compat */
34                     strcasecmp( str, "notags" ) == 0 ) {
35                 *idx = SLAP_INDEX_NOTAGS;
36         } else if ( strcasecmp( str, "nosubtypes" ) == 0 ) {
37                 *idx = SLAP_INDEX_NOSUBTYPES;
38         } else {
39                 return LDAP_OTHER;
40         }
41
42         return LDAP_SUCCESS;
43 }