contrib/ldns/str2host.c
static int
parse_escape(uint8_t *s, uint8_t *q) {
	uint8_t val;
	if (strlen((char *)s) > 3 &&
	    isdigit((int) s[1]) &&
	    isdigit((int) s[2]) &&
	    isdigit((int) s[3])) {
		/* cast this so it fits */
		val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 +
		                ldns_hexdigit_to_int((char) s[2]) * 10 +
		                ldns_hexdigit_to_int((char) s[3]);
		*q = val;
		return 3;
	} else {
		s++;
		if (*s == '\0' || isdigit((int) *s)) {
			/* apparently the string terminator
			 * or a digit has been escaped...
		         */
			return 0;
		}
		*q = *s;
		return 1;
	}
}
/*
 * Checks whether the escaped value at **s is an octal value or
 * a 'normally' escaped character (and not eos)
 *
 * The string pointer at *s is increased by either 0 (on error), 1 (on
 * normal escapes), or 3 (on octals)
 *
 * Returns the number of bytes read from the escaped string, or
 * 0 on error
 */
Checks whether the escaped value at **s is an octal value or
a 'normally' escaped character (and not eos)

The string pointer at *s is increased by either 0 (on error), 1 (on
normal escapes), or 3 (on octals)

Returns the number of bytes read from the escaped string, or
0 on error
Checks whether the escaped value at ** s is an octal value or a ' normally ' escaped character ( and not eos ) The string pointer at * s is increased by either 0 ( on error ) 1 ( on normal escapes ) or 3 ( on octals ) Returns the number of bytes read from the escaped string or 0 on error
static int
parse_escape(uint8_t *s, uint8_t *q) {
	uint8_t val;
	if (strlen((char *)s) > 3 &&
	    isdigit((int) s[1]) &&
	    isdigit((int) s[2]) &&
	    isdigit((int) s[3])) {
		val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 +
		                ldns_hexdigit_to_int((char) s[2]) * 10 +
		                ldns_hexdigit_to_int((char) s[3]);
		*q = val;
		return 3;
	} else {
		s++;
		if (*s == '\0' || isdigit((int) *s)) {
			return 0;
		}
		*q = *s;
		return 1;
	}
}
static int parse_escape ( uint8_t * s , uint8_t * q ) { uint8_t val ; if ( strlen ( ( char * ) s ) > 3 && isdigit ( ( int ) s [ 1 ] ) && isdigit ( ( int ) s [ 2 ] ) && isdigit ( ( int ) s [ 3 ] ) ) { val = ( uint8_t ) ldns_hexdigit_to_int ( ( char ) s [ 1 ] ) * 100 + ldns_hexdigit_to_int ( ( char ) s [ 2 ] ) * 10 + ldns_hexdigit_to_int ( ( char ) s [ 3 ] ) ; * q = val ; return 3 ; } else { s ++ ; if ( * s == ' \0 ' || isdigit ( ( int ) * s ) ) { return 0 ; } * q = * s ; return 1 ; } }
Checks whether the escaped value at **s is an octal value or
 a 'normally' escaped character (and not eos)
Checks whether the escaped value at ** s is an octal value or a ' normally ' escaped character ( and not eos )
/* cast this so it fits */ /* apparently the string terminator
			 * or a digit has been escaped...
		         */