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/port.c
static int portcmp(const char* pattern, const char* port)
{
    const char* orig = port;

    while (('\0' != *pattern) && (*pattern == *port))
    {
        pattern++;
        port++;
    }

    if (('\0' == *pattern) && ('\0' == *port))
    {
        return 0;
    }
    if (('S' == orig[0]) && ('U' == orig[1]) && ('\0' == orig[2]))
    {
        return 1;
    }

    return (*pattern == '*') ? 0 : 1;
}
/*
 * portcmp - compare the name of a port to a /etc/porttime entry
 *
 *	portcmp works like strcmp, except that if the last character
 *	in a failing match is a '*', the match is considered to have
 *	passed.  The "*" match is suppressed whenever the port is "SU",
 *	which is the token the "su" command uses to validate access.
 *	A match returns 0, failure returns non-zero.
 */
compare the name of a port to a /etc/porttime entry
portcmp works like strcmp, except that if the last character
in a failing match is a '*', the match is considered to have
passed.
compare the name of a port to a / etc / porttime entry portcmp works like strcmp except that if the last character in a failing match is a ' * ' the match is considered to have passed .
static int portcmp(const char* pattern, const char* port)
{
    const char* orig = port;
    while (('\0' != *pattern) && (*pattern == *port))
    {
        pattern++;
        port++;
    }
    if (('\0' == *pattern) && ('\0' == *port))
    {
        return 0;
    }
    if (('S' == orig[0]) && ('U' == orig[1]) && ('\0' == orig[2]))
    {
        return 1;
    }
    return (*pattern == '*') ? 0 : 1;
}
static int portcmp ( const char * pattern , const char * port ) { const char * orig = port ; while ( ( ' \0 ' != * pattern ) && ( * pattern == * port ) ) { pattern ++ ; port ++ ; } if ( ( ' \0 ' == * pattern ) && ( ' \0 ' == * port ) ) { return 0 ; } if ( ( ' ' == orig [ 0 ] ) && ( ' ' == orig [ 1 ] ) && ( ' \0 ' == orig [ 2 ] ) ) { return 1 ; } return ( * pattern == ' ' ) ? 0 : 1 ; }
portcmp - compare the name of a port to a /etc/porttime entry
      portcmp works like strcmp, except that if the last character
      in a failing match is a '*', the match is considered to have
      passed.
portcmp - compare the name of a port to a / etc / porttime entry portcmp works like strcmp except that if the last character in a failing match is a ' * ' the match is considered to have passed .