#include <ctype.h>
#include <string.h>
Go to the source code of this file.
Functions | |
char * | G_basename (char *filename, const char *desired_ext) |
Truncates filename to the base part (before the last .) if it matches the extension, otherwise leaves it unchanged. |
char* G_basename | ( | char * | filename, | |
const char * | desired_ext | |||
) |
Truncates filename to the base part (before the last .) if it matches the extension, otherwise leaves it unchanged.
Checks if a filename matches a certain file extension (case insensitive) and if so, truncates the string to the base file name (cf. basename Unix command)
filename | String containing filename | |
ext | String containing extension to look for (case insensitive and as long as needs to be, e.g. tif will match .tif and .tiff, sh will match .shp and .shx, htm will match .htm and .html) |
Definition at line 22 of file basename.c.