After some experimentation, the best solution seems to be to use a separate scan to
remove the extension before finding the non-path section when deriving the table
name.
git-svn-id: http://svn.osgeo.org/postgis/trunk@11294
b70326c6-7e19-0410-871a-
916f4a2858ee
{
char *shp_file = strdup(config->shp_file);
char *ptr;
+
+ /* Remove the extension, if present */
for ( ptr = shp_file + strlen(shp_file); ptr > shp_file; ptr-- )
{
if ( *ptr == '.' )
{
*ptr = '\0';
+ break;
}
+ }
+
+ /* The remaining non-path section is the table name */
+ for ( ptr = shp_file + strlen(shp_file); ptr > shp_file; ptr-- )
+ {
if ( *ptr == '/' || *ptr == '\\' )
{
ptr++;