openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libmount/src/optstr.c
static int mnt_optstr_locate_option(char* optstr, const char* name,
                                    struct libmnt_optloc* ol)
{
    char* n;
    size_t namesz, nsz;
    int rc;

    if (!optstr)
        return 1;

    assert(name);

    namesz = strlen(name);

    do
    {
        rc = mnt_optstr_parse_next(&optstr, &n, &nsz, &ol->value, &ol->valsz);
        if (rc)
            break;

        if (namesz == nsz && strncmp(n, name, nsz) == 0)
        {
            ol->begin = n;
            ol->end = *(optstr - 1) == ',' ? optstr - 1 : optstr;
            ol->namesz = nsz;
            return 0;
        }
    } while (1);

    return rc;
}
/*
 * Locates the first option that matches @name. The @end is set to the
 * char behind the option (it means ',' or \0).
 *
 * Returns negative number on parse error, 1 when not found and 0 on success.
 */
Locates the first option that matches @name. The @end is set to the
char behind the option (it means ',' or \0).

Returns negative number on parse error, 1 when not found and 0 on success.
Locates the first option that matches @name . The @end is set to the char behind the option ( it means ' ' or \ 0 ) . Returns negative number on parse error 1 when not found and 0 on success .
static int mnt_optstr_locate_option(char* optstr, const char* name,
                                    struct libmnt_optloc* ol)
{
    char* n;
    size_t namesz, nsz;
    int rc;
    if (!optstr)
        return 1;
    assert(name);
    namesz = strlen(name);
    do
    {
        rc = mnt_optstr_parse_next(&optstr, &n, &nsz, &ol->value, &ol->valsz);
        if (rc)
            break;
        if (namesz == nsz && strncmp(n, name, nsz) == 0)
        {
            ol->begin = n;
            ol->end = *(optstr - 1) == ',' ? optstr - 1 : optstr;
            ol->namesz = nsz;
            return 0;
        }
    } while (1);
    return rc;
}
static int mnt_optstr_locate_option ( char * optstr , const char * name , struct libmnt_optloc * ol ) { char * n ; size_t namesz , nsz ; int rc ; if ( ! optstr ) return 1 ; assert ( name ) ; namesz = strlen ( name ) ; do { rc = mnt_optstr_parse_next ( & optstr , & n , & nsz , & ol -> value , & ol -> valsz ) ; if ( rc ) break ; if ( namesz == nsz && strncmp ( n , name , nsz ) == 0 ) { ol -> begin = n ; ol -> end = * ( optstr - 1 ) == ' ' ? optstr - 1 : optstr ; ol -> namesz = nsz ; return 0 ; } } while ( 1 ) ; return rc ; }
Locates the first option that matches @name.
Locates the first option that matches @name .