Logo Search packages:      
Sourcecode: uaputl version File versions  Download package

int string2raw ( char *  str,
unsigned char *  raw 
)

Converts a string to hex value.

Parameters:
strA pointer to the string
rawA pointer to the raw data buffer
Returns:
Number of bytes read

Definition at line 4908 of file uaputl.c.

References CHAR2INT.

Referenced by apcmd_sys_cfg_custom_ie(), apcmd_sys_cfg_wep_key(), and apcmd_sys_config_profile().

{
    int len = (strlen(str) + 1) / 2;

    do {
        if (!isxdigit(*str)) {
            return -1;
        }
        *str = toupper(*str);
        *raw = CHAR2INT(*str) << 4;
        ++str;
        *str = toupper(*str);
        if (*str == '\0')
            break;
        *raw |= CHAR2INT(*str);
        ++raw;
    } while (*++str != '\0');
    return len;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index