1 /* index.c - index utilities */
4 * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
15 int slap_str2index( const char *str, slap_mask_t *idx )
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 )
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;