openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/shadow/4.6-r0/shadow-4.6/lib/fields.c
int valid_field(const char* field, const char* illegal)
{
    const char* cp;
    int err = 0;

    if (NULL == field)
    {
        return -1;
    }

    /* For each character of field, search if it appears in the list
     * of illegal characters. */
    for (cp = field; '\0' != *cp; cp++)
    {
        if (strchr(illegal, *cp) != NULL)
        {
            err = -1;
            break;
        }
    }

    if (0 == err)
    {
        /* Search if there are some non-printable characters */
        for (cp = field; '\0' != *cp; cp++)
        {
            if (!isprint(*cp))
            {
                err = 1;
                break;
            }
        }
    }

    return err;
}
/*
 * valid_field - insure that a field contains all legal characters
 *
 * The supplied field is scanned for non-printable and other illegal
 * characters.
 *  + -1 is returned if an illegal character is present.
 *  +  1 is returned if no illegal characters are present, but the field
 *       contains a non-printable character.
 *  +  0 is returned otherwise.
 */
insure that a field contains all legal characters
The supplied field is scanned for non-printable and other illegal
characters.
+ -1 is returned if an illegal character is present.
+  1 is returned if no illegal characters are present, but the field
contains a non-printable character.
+  0 is returned otherwise.
insure that a field contains all legal characters The supplied field is scanned for non - printable and other illegal characters . + - 1 is returned if an illegal character is present . + 1 is returned if no illegal characters are present but the field contains a non - printable character . + 0 is returned otherwise .
int valid_field(const char* field, const char* illegal)
{
    const char* cp;
    int err = 0;
    if (NULL == field)
    {
        return -1;
    }
    for (cp = field; '\0' != *cp; cp++)
    {
        if (strchr(illegal, *cp) != NULL)
        {
            err = -1;
            break;
        }
    }
    if (0 == err)
    {
        for (cp = field; '\0' != *cp; cp++)
        {
            if (!isprint(*cp))
            {
                err = 1;
                break;
            }
        }
    }
    return err;
}
int valid_field ( const char * field , const char * illegal ) { const char * cp ; int err = 0 ; if ( NULL == field ) { return -1 ; } for ( cp = field ; ' \0 ' != * cp ; cp ++ ) { if ( strchr ( illegal , * cp ) != NULL ) { err = -1 ; break ; } } if ( 0 == err ) { for ( cp = field ; ' \0 ' != * cp ; cp ++ ) { if ( ! isprint ( * cp ) ) { err = 1 ; break ; } } } return err ; }
valid_field - insure that a field contains all legal characters
 The supplied field is scanned for non-printable and other illegal
 characters.
valid_field - insure that a field contains all legal characters The supplied field is scanned for non - printable and other illegal characters .
/* For each character of field, search if it appears in the list
     * of illegal characters. */ /* Search if there are some non-printable characters */