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/sys-utils/dmesg.c
static const char* parse_faclev(const char* str, int* fac, int* lev)
{
    long num;
    char* end = NULL;

    if (!str)
        return str;

    errno = 0;
    num = strtol(str, &end, 10);

    if (!errno && end && end > str)
    {
        *fac = LOG_FAC(num);
        *lev = LOG_PRI(num);

        if (*lev < 0 || (size_t)*lev > ARRAY_SIZE(level_names))
            *lev = -1;
        if (*fac < 0 || (size_t)*fac > ARRAY_SIZE(facility_names))
            *fac = -1;
        return end + 1; /* skip '<' or ',' */
    }

    return str;
}
/*
 * Parses numerical prefix used for all messages in kernel ring buffer.
 *
 * Priorities/facilities are encoded into a single 32-bit quantity, where the
 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
 * (0-big number).
 *
 * Note that the number has to end with '>' or ',' char.
 */
Parses numerical prefix used for all messages in kernel ring buffer.
Priorities/facilities are encoded into a single 32-bit quantity, where the
bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
(0-big number).

Note that the number has to end with '>' or ',' char.
Parses numerical prefix used for all messages in kernel ring buffer . Priorities / facilities are encoded into a single 32 - bit quantity where the bottom 3 bits are the priority ( 0 - 7 ) and the top 28 bits are the facility ( 0 - big number ) . Note that the number has to end with ' > ' or ' ' char .
static const char* parse_faclev(const char* str, int* fac, int* lev)
{
    long num;
    char* end = NULL;
    if (!str)
        return str;
    errno = 0;
    num = strtol(str, &end, 10);
    if (!errno && end && end > str)
    {
        *fac = LOG_FAC(num);
        *lev = LOG_PRI(num);
        if (*lev < 0 || (size_t)*lev > ARRAY_SIZE(level_names))
            *lev = -1;
        if (*fac < 0 || (size_t)*fac > ARRAY_SIZE(facility_names))
            *fac = -1;
        return end + 1; 
    }
    return str;
}
static const char * parse_faclev ( const char * str , int * fac , int * lev ) { long num ; char * end = NULL ; if ( ! str ) return str ; errno = 0 ; num = strtol ( str , & end , 10 ) ; if ( ! errno && end && end > str ) { * fac = LOG_FAC ( num ) ; * lev = LOG_PRI ( num ) ; if ( * lev < 0 || ( size_t ) * lev > ARRAY_SIZE ( level_names ) ) * lev = -1 ; if ( * fac < 0 || ( size_t ) * fac > ARRAY_SIZE ( facility_names ) ) * fac = -1 ; return end + 1 ; } return str ; }
Parses numerical prefix used for all messages in kernel ring buffer.
Parses numerical prefix used for all messages in kernel ring buffer .
/* skip '<' or ',' */