openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/nss-pam-ldapd/0.9.8-r0/nss-pam-ldapd-0.9.8/nslcd/nsswitch.c
static int has_service(const char* services, const char* service,
                       const char* filename, int lnr)
{
    int i = 0, l;
    if (services == NULL)
        return 0;
    l = strlen(service);
    while (services[i] != '\0')
    {
        /* skip spaces */
        while (isspace(services[i]))
            i++;
        /* check if this is the service */
        if ((strncmp(services + i, service, l) == 0) &&
            (!isalnum(services[i + l])))
            return 1;
        /* skip service name and spaces */
        i++;
        while (isalnum(services[i]))
            i++;
        while (isspace(services[i]))
            i++;
        /* skip action mappings */
        if (services[i] == '[')
        {
            i++; /* skip [ */
            while ((services[i] != ']') && (services[i] != '\0'))
                i++;
            if (services[i] != ']')
            {
                log_log(LOG_WARNING, "%s: error parsing line %d", filename,
                        lnr);
                return 0; /* parse error */
            }
            i++; /* skip ] */
        }
    }
    return 0;
}
/* check to see if the list of services contains the specified service */
check to see if the list of services contains the specified service
check to see if the list of services contains the specified service
static int has_service(const char* services, const char* service,
                       const char* filename, int lnr)
{
    int i = 0, l;
    if (services == NULL)
        return 0;
    l = strlen(service);
    while (services[i] != '\0')
    {
        while (isspace(services[i]))
            i++;
        if ((strncmp(services + i, service, l) == 0) &&
            (!isalnum(services[i + l])))
            return 1;
        i++;
        while (isalnum(services[i]))
            i++;
        while (isspace(services[i]))
            i++;
        if (services[i] == '[')
        {
            i++; 
            while ((services[i] != ']') && (services[i] != '\0'))
                i++;
            if (services[i] != ']')
            {
                log_log(LOG_WARNING, "%s: error parsing line %d", filename,
                        lnr);
                return 0; 
            }
            i++; 
        }
    }
    return 0;
}
static int has_service ( const char * services , const char * service , const char * filename , int lnr ) { int i = 0 , l ; if ( services == NULL ) return 0 ; l = strlen ( service ) ; while ( services [ i ] != ' \0 ' ) { while ( isspace ( services [ i ] ) ) i ++ ; if ( ( strncmp ( services + i , service , l ) == 0 ) && ( ! isalnum ( services [ i + l ] ) ) ) return 1 ; i ++ ; while ( isalnum ( services [ i ] ) ) i ++ ; while ( isspace ( services [ i ] ) ) i ++ ; if ( services [ i ] == ' ' ) { i ++ ; while ( ( services [ i ] != ' ' ) && ( services [ i ] != ' \0 ' ) ) i ++ ; if ( services [ i ] != ' ' ) { log_log ( LOG_WARNING , " " , filename , lnr ) ; return 0 ; } i ++ ; } } return 0 ; }
check to see if the list of services contains the specified service
check to see if the list of services contains the specified service
/* skip spaces */ /* check if this is the service */ /* skip service name and spaces */ /* skip action mappings */ /* skip [ */ /* parse error */ /* skip ] */