util/path.c
char *path_get_filename(char *filename, char *fullpath)
{
    size_t pos = 0;
    assert(filename != NULL && fullpath != NULL);

    pos = str_find_last_of(fullpath, PATH_SEPARATOR);
    if(pos == -1)
    {
        strncpy(filename, fullpath, strlen(fullpath));
    }
    else
    {
        str_substr(filename, fullpath, 
                pos + 1, strlen(fullpath) - pos - 1);
    }

    return filename;
}
/* Beware of buffer overflow, if the length of buffer filename
 * is not long enough(because of strncpy or str_substr used). 
 */
Beware of buffer overflow, if the length of buffer filename
is not long enough(because of strncpy or str_substr used).
Beware of buffer overflow if the length of buffer filename is not long enough ( because of strncpy or str_substr used ) .
char *path_get_filename(char *filename, char *fullpath)
{
    size_t pos = 0;
    assert(filename != NULL && fullpath != NULL);
    pos = str_find_last_of(fullpath, PATH_SEPARATOR);
    if(pos == -1)
    {
        strncpy(filename, fullpath, strlen(fullpath));
    }
    else
    {
        str_substr(filename, fullpath, 
                pos + 1, strlen(fullpath) - pos - 1);
    }
    return filename;
}
char * path_get_filename ( char * filename , char * fullpath ) { size_t pos = 0 ; assert ( filename != NULL && fullpath != NULL ) ; pos = str_find_last_of ( fullpath , PATH_SEPARATOR ) ; if ( pos == -1 ) { strncpy ( filename , fullpath , strlen ( fullpath ) ) ; } else { str_substr ( filename , fullpath , pos + 1 , strlen ( fullpath ) - pos - 1 ) ; } return filename ; }
Beware of buffer overflow, if the length of buffer filename
 is not long enough(because of strncpy or str_substr used).
Beware of buffer overflow if the length of buffer filename is not long enough ( because of strncpy or str_substr used ) .