19 #include <mysql_com.h>
35 void parse_user(
const char *user_id_str,
size_t user_id_len,
36 char *user_name_str,
size_t *user_name_len,
37 char *host_name_str,
size_t *host_name_len)
39 char *p= strrchr(user_id_str,
'@');
48 *user_name_len= (uint) (p - user_id_str);
49 *host_name_len= (uint) (user_id_len - *user_name_len - 1);
51 if (*user_name_len > USERNAME_LENGTH)
52 *user_name_len= USERNAME_LENGTH;
54 if (*host_name_len > HOSTNAME_LENGTH)
55 *host_name_len= HOSTNAME_LENGTH;
57 memcpy(user_name_str, user_id_str, *user_name_len);
58 memcpy(host_name_str, p + 1, *host_name_len);
61 user_name_str[*user_name_len]= 0;
62 host_name_str[*host_name_len]= 0;