software/drivers/sd8887/src/bluetooth/bt/bt_proc.c
/**
 *  @brief convert string to number
 *
 *  @param s	pointer to numbered string
 *  @return	converted number from string s
 */
@brief convert string to number
@param s    pointer to numbered string
@return     converted number from string s
@brief convert string to number @param s pointer to numbered string @return converted number from string s
int
string_to_number(char *s)
{
	int r = 0;
	int base = 0;
	int pn = 1;
	if (strncmp(s, "-", 1) == 0) {
		pn = -1;
		s++;
	}
	if ((strncmp(s, "0x", 2) == 0) || (strncmp(s, "0X", 2) == 0)) {
		base = 16;
		s += 2;
	} else
		base = 10;
	for (s = s; *s != 0; s++) {
		if ((*s >= '0') && (*s <= '9'))
			r = (r * base) + (*s - '0');
		else if ((*s >= 'A') && (*s <= 'F'))
			r = (r * base) + (*s - 'A' + 10);
		else if ((*s >= 'a') && (*s <= 'f'))
			r = (r * base) + (*s - 'a' + 10);
		else
			break;
	}
	return r * pn;
}
int string_to_number ( char * s ) { int r = 0 ; int base = 0 ; int pn = 1 ; if ( strncmp ( s , " " , 1 ) == 0 ) { pn = -1 ; s ++ ; } if ( ( strncmp ( s , " " , 2 ) == 0 ) || ( strncmp ( s , " " , 2 ) == 0 ) ) { base = 16 ; s += 2 ; } else base = 10 ; for ( s = s ; * s != 0 ; s ++ ) { if ( ( * s >= ' ' ) && ( * s <= ' ' ) ) r = ( r * base ) + ( * s - ' ' ) ; else if ( ( * s >= ' ' ) && ( * s <= ' ' ) ) r = ( r * base ) + ( * s - ' ' + 10 ) ; else if ( ( * s >= ' ' ) && ( * s <= ' ' ) ) r = ( r * base ) + ( * s - ' ' + 10 ) ; else break ; } return r * pn ; }
@brief convert string to number
  @param s    pointer to numbered string
  @return     converted number from string s
@brief convert string to number @param s pointer to numbered string @return converted number from string s