escape = 0;
escape = firstdigit = 0;
unescape_filterval( char *val ){	int	escape, firstdigit, ival; 	char	*s, *d;	escape = 0;	for ( s = d = val; *s; s++ ) {		if ( escape ) {			/*			 * first try LDAPv3 escape (hexadecimal) sequence			 */			if (( ival = hexchar2int( *s )) < 0 ) {				if ( firstdigit ) {					/*					 * LDAPv2 (RFC1960) escape sequence					 */					*d++ = *s;					escape = 0;				} else {					return(-1);				}			}			if ( firstdigit ) {			    *d = ( ival<<4 );			    firstdigit = 0;			} else {			    *d++ |= ival;			    escape = 0;			}		} else if ( *s != '\\' ) {			*d++ = *s;			escape = 0;		} else {			escape = 1;			firstdigit = 1;		}	}	return( d - val );}