GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
basename.c File Reference

GIS Library - Program basename routines. More...

#include <grass/gis.h>
#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. More...
 

Detailed Description

GIS Library - Program basename routines.

(C) 2001-2008 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
GRASS GIS Development Team
Date
1999-2007

Definition in file basename.c.

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
[in]filenamestring containing filename
[in]desired_extstring containing extension to look for (case insensitive)
Returns
Pointer to filename

Definition at line 37 of file basename.c.

References G_strcasecmp().

Referenced by G_parser(), and G_set_program_name().