summaryrefslogtreecommitdiffstats
path: root/src/misc/extra/extraUtilFile.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-05-15 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-05-15 08:01:00 -0700
commit74ff01bfb54e9f0a68ac88b827521a422269a144 (patch)
tree240c07b87e355dba9caa1e6187d6673b92996eac /src/misc/extra/extraUtilFile.c
parent37b6c727f1276d9d97a79a8f40271aee446a4ba4 (diff)
downloadabc-74ff01bfb54e9f0a68ac88b827521a422269a144.tar.gz
abc-74ff01bfb54e9f0a68ac88b827521a422269a144.tar.bz2
abc-74ff01bfb54e9f0a68ac88b827521a422269a144.zip
Version abc80515
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;