mco_lews_startswith

Prototype

    int mco_lews_startswith(const char *buf, mco_uint2 start_pos, mco_uint2 buf_size, const char *str);

Arguments

buf
Pointer to the data buffer to be examined.
start_pos
Starting offset within buf where the check begins.
buf_size
Total size (in bytes) of the buffer pointed to by buf.
str
Null-terminated string to check for as a prefix at the specified position.

Description

This function checks whether the null-terminated string str matches the contents of the buffer buf starting at offset start_pos. The comparison is performed without exceeding the bounds defined by buf_size.

    while (i < in_buf_size) {
        if (mco_lews_startswith(in_buffer, i, in_buf_size, param_name)) {
            i += param_size;
            if (in_buffer[i] == '=') {
                i++;
                /* Process value... */
                ...

Return Value

1
The string str is found as a prefix at position start_pos.
0
The string str is not found at the specified position, or the buffer is too short to contain it.

Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a