1 /* index.c - index utilities */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
15 slap_index2prefix( int indextype )
19 switch ( indextype ) {
20 case SLAP_INDEX_EQUALITY:
21 prefix = SLAP_INDEX_EQUALITY_PREFIX;
23 case SLAP_INDEX_APPROX:
24 prefix = SLAP_INDEX_APPROX_PREFIX;
26 case SLAP_INDEX_SUBSTR:
27 prefix = SLAP_INDEX_SUBSTR_PREFIX;
30 prefix = SLAP_INDEX_UNKNOWN_PREFIX;
37 int slap_str2index( const char *str, slap_index *idx )
39 if ( strcasecmp( str, "pres" ) == 0 ) {
40 *idx = SLAP_INDEX_PRESENT;
41 } else if ( strcasecmp( str, "eq" ) == 0 ) {
42 *idx = SLAP_INDEX_EQUALITY;
43 } else if ( strcasecmp( str, "approx" ) == 0 ) {
44 *idx = SLAP_INDEX_APPROX;
45 } else if ( strcasecmp( str, "subinitial" ) == 0 ) {
46 *idx = SLAP_INDEX_SUBSTR_INITIAL;
47 } else if ( strcasecmp( str, "subany" ) == 0 ) {
48 *idx = SLAP_INDEX_SUBSTR_ANY;
49 } else if ( strcasecmp( str, "subfinal" ) == 0 ) {
50 *idx = SLAP_INDEX_SUBSTR_FINAL;
51 } else if ( strcasecmp( str, "substr" ) == 0 ||
52 strcasecmp( str, "sub" ) == 0 )
54 *idx = SLAP_INDEX_SUBSTR_DEFAULT;
55 } else if ( strcasecmp( str, "lang" ) == 0 ) {
56 *idx = SLAP_INDEX_LANG;
57 } else if ( strcasecmp( str, "autolang" ) == 0 ) {
58 *idx = SLAP_INDEX_AUTO_LANG;
59 } else if ( strcasecmp( str, "subtypes" ) == 0 ) {
60 *idx = SLAP_INDEX_SUBTYPES;
61 } else if ( strcasecmp( str, "autosubtypes" ) == 0 ) {
62 *idx = SLAP_INDEX_AUTO_SUBTYPES;