Example #1
0
File: parse.c Project: CodeMonk/fio
static int check_range_bytes(const char *str, long *val, void *data)
{
	long long __val;

	if (!str_to_decimal(str, &__val, 1, data, 0, 0)) {
		*val = __val;
		return 0;
	}

	return 1;
}
int  get_next_pattern(void)
{
    int         line_num = 1;
    uint8_t     *p;

	_au8ShaData = (uint8_t *)((uint32_t)_au8ShaData_pool | 0x80000000);

    while (get_line() == 0) {
        //sysprintf("LINE %d = %s\n", line_num, _pi8LineBuff);
        line_num++;

        if (_pi8LineBuff[0] == '#')
            continue;

        if (strncmp(_pi8LineBuff ,"Len", 3) == 0) {
            p = (uint8_t *)&_pi8LineBuff[3];
            while ((*p < '0') || (*p > '9'))
                p++;

            _i32DataLen = str_to_decimal(p);
            continue;
        }

        if (strncmp(_pi8LineBuff ,"Msg", 3) == 0) {
            p = (uint8_t *)&_pi8LineBuff[3];
            while (!is_hex_char(*p)) p++;
            str_to_hex(p, &_au8ShaData[0], 0);
            continue;
        }

        if (strncmp(_pi8LineBuff ,"MD", 2) == 0) {
            p = (uint8_t *)&_pi8LineBuff[2];
            while (!is_hex_char(*p)) p++;
            str_to_hex(p, &_au8ShaDigest[0], 1);
            return 0;
        }
    }
    return -1;
}
Example #3
0
File: parse.c Project: CodeMonk/fio
int check_str_time(const char *p, long long *val, int is_seconds)
{
	return str_to_decimal(p, val, 0, NULL, is_seconds, 1);
}
Example #4
0
File: parse.c Project: CodeMonk/fio
int check_str_bytes(const char *p, long long *val, void *data)
{
	return str_to_decimal(p, val, 1, data, 0, 0);
}
Example #5
0
File: parse.c Project: martin21/fio
static int check_str_time(const char *p, long long *val)
{
	return str_to_decimal(p, val, 0, NULL);
}