1 /* index.c - index utilities */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2004 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <ac/string.h>
24 int slap_str2index( const char *str, slap_mask_t *idx )
26 if ( strcasecmp( str, "pres" ) == 0 ) {
27 *idx = SLAP_INDEX_PRESENT;
28 } else if ( strcasecmp( str, "eq" ) == 0 ) {
29 *idx = SLAP_INDEX_EQUALITY;
30 } else if ( strcasecmp( str, "approx" ) == 0 ) {
31 *idx = SLAP_INDEX_APPROX;
32 } else if ( strcasecmp( str, "subinitial" ) == 0 ) {
33 *idx = SLAP_INDEX_SUBSTR_INITIAL;
34 } else if ( strcasecmp( str, "subany" ) == 0 ) {
35 *idx = SLAP_INDEX_SUBSTR_ANY;
36 } else if ( strcasecmp( str, "subfinal" ) == 0 ) {
37 *idx = SLAP_INDEX_SUBSTR_FINAL;
38 } else if ( strcasecmp( str, "substr" ) == 0 ||
39 strcasecmp( str, "sub" ) == 0 )
41 *idx = SLAP_INDEX_SUBSTR_DEFAULT;
42 } else if ( strcasecmp( str, "nolang" ) == 0 || /* backwards compat */
43 strcasecmp( str, "notags" ) == 0 ) {
44 *idx = SLAP_INDEX_NOTAGS;
45 } else if ( strcasecmp( str, "nosubtypes" ) == 0 ) {
46 *idx = SLAP_INDEX_NOSUBTYPES;