- /*
- * substrings index entry
- */
- if ( indexmask & INDEX_SUB ) {
- /* leading and trailing */
- if ( len > SUBLEN - 2 ) {
- buf[0] = '^';
- for ( j = 0; j < SUBLEN - 1; j++ ) {
- buf[j + 1] = val[j];
- }
- buf[SUBLEN] = '\0';
-
- add_value( be, db, type, INDEX_SUB, buf, id );
-
- p = val + len - SUBLEN + 1;
- for ( j = 0; j < SUBLEN - 1; j++ ) {
- buf[j] = p[j];
- }
- buf[SUBLEN - 1] = '$';
- buf[SUBLEN] = '\0';
-
- add_value( be, db, type, INDEX_SUB, buf, id );
- }
-
- /* any */
- for ( p = val; p < (val + len - SUBLEN + 1); p++ ) {
- for ( j = 0; j < SUBLEN; j++ ) {
- buf[j] = p[j];
- }
- buf[SUBLEN] = '\0';
-
- add_value( be, db, type, INDEX_SUB, buf, id );
- }
- }