diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-29 14:36:26 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-29 14:36:26 -0800 |
commit | 24f1ca07030c1246280dea98bb0975cfec8d5ea4 (patch) | |
tree | 464415cd3f653f22860e4ff4e3f108299ab70f5b /src/misc/extra | |
parent | c30a0ca0b973faf136b309600f03b32b78d0a733 (diff) | |
download | abc-24f1ca07030c1246280dea98bb0975cfec8d5ea4.tar.gz abc-24f1ca07030c1246280dea98bb0975cfec8d5ea4.tar.bz2 abc-24f1ca07030c1246280dea98bb0975cfec8d5ea4.zip |
New parser and framework.
Diffstat (limited to 'src/misc/extra')
-rw-r--r-- | src/misc/extra/extra.h | 1 | ||||
-rw-r--r-- | src/misc/extra/extraUtilFile.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index 5d9c405f..3dee5f4e 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -106,6 +106,7 @@ extern char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix ); extern void Extra_FileNameCorrectPath( char * FileName ); extern char * Extra_FileNameWithoutPath( char * FileName ); extern char * Extra_FilePathWithoutName( char * FileName ); +extern char * Extra_FileDesignName( char * pFileName ); extern int Extra_FileCheck( char * pFileName ); extern int Extra_FileSize( char * pFileName ); extern char * Extra_FileRead( FILE * pFile ); diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index ee9168f6..6b4453a5 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -247,6 +247,25 @@ char * Extra_FilePathWithoutName( char * FileName ) ABC_FREE( FileName ); return NULL; } +char * Extra_FileDesignName( char * pFileName ) +{ + char * pBeg, * pEnd, * pStore, * pCur; + // find the first dot + for ( pEnd = pFileName; *pEnd; pEnd++ ) + if ( *pEnd == '.' ) + break; + // find the first char + for ( pBeg = pEnd - 1; pBeg >= pFileName; pBeg-- ) + if ( !((*pBeg >= 'a' && *pBeg <= 'z') || (*pBeg >= 'A' && *pBeg <= 'Z') || (*pBeg >= '0' && *pBeg <= '9') || *pBeg == '_') ) + break; + pBeg++; + // fill up storage + pStore = ABC_ALLOC( char, pEnd - pBeg + 1 ); + for ( pCur = pStore; pBeg < pEnd; pBeg++, pCur++ ) + *pCur = *pBeg; + *pCur = 0; + return pStore; +} /**Function************************************************************* |