basename.c File Reference

#include <ctype.h>
#include <string.h>

Include dependency graph for basename.c:

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.


Function Documentation

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)

Parameters:
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)
Returns:
Pointer to filename

Definition at line 22 of file basename.c.


Generated on Sun Apr 6 17:32:15 2008 for GRASS by  doxygen 1.5.5