Filename/RB_Get_Extension [ Functions ]

NAME

RB_Get_Extension --

FUNCTION

Give the extension of this file. That is the part after the last '.' if there is any.

SYNOPSIS

char* RB_Get_Extension( struct RB_Filename *arg_rb_filename )

RESULT

pointer to the extension pointer to a '\0' if no extension was found.

NOTE

The string returned is owned by this function so don't change it.

SOURCE

{
    char               *c = arg_rb_filename->name;
    int                 i = strlen( c );

    for ( c += i; c != arg_rb_filename->name && ( *c != '.' ); --c )
    {
        /* Empty */
    }
    if ( *c == '.' )
    {
        ++c;
    }
    else
    {
        c = arg_rb_filename->name;
        c += i;
    }
    return c;
}