summaryrefslogtreecommitdiffstats
path: root/src/misc/extra/extraUtilFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/extra/extraUtilFile.c')
-rw-r--r--src/misc/extra/extraUtilFile.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c
index 243f3457..44dff1e0 100644
--- a/src/misc/extra/extraUtilFile.c
+++ b/src/misc/extra/extraUtilFile.c
@@ -160,20 +160,10 @@ char * Extra_FileNameAppend( char * pBase, char * pSuffix )
***********************************************************************/
char * Extra_FileNameGeneric( char * FileName )
{
- char * pDot;
- char * pUnd;
- char * pRes;
-
- // find the generic name of the file
+ char * pDot, * pRes;
pRes = Extra_UtilStrsav( FileName );
- // find the pointer to the "." symbol in the file name
-// pUnd = strstr( FileName, "_" );
- pUnd = NULL;
- pDot = strstr( FileName, "." );
- if ( pUnd )
- pRes[pUnd - FileName] = 0;
- else if ( pDot )
- pRes[pDot - FileName] = 0;
+ if ( (pDot = strrchr( pRes, '.' )) )
+ *pDot = 0;
return pRes;
}
@@ -193,8 +183,7 @@ char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix )
static char Buffer[1000];
char * pDot;
strcpy( Buffer, pBase );
- pDot = strstr( Buffer, "." );
- if ( pDot )
+ if ( (pDot = strrchr( Buffer, '.' )) )
*pDot = 0;
strcat( Buffer, pSuffix );
return Buffer;