summaryrefslogtreecommitdiffstats
path: root/src/misc/extra/extraUtilFile.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2010-11-01 01:35:04 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2010-11-01 01:35:04 -0700
commit6130e39b18b5f53902e4eab14f6d5cdde5219563 (patch)
tree0db0628479a1b750e9af1f66cb8379ebd0913d31 /src/misc/extra/extraUtilFile.c
parentf0e77f6797c0504b0da25a56152b707d3357f386 (diff)
downloadabc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.gz
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.tar.bz2
abc-6130e39b18b5f53902e4eab14f6d5cdde5219563.zip
initial commit of public abc
Diffstat (limited to 'src/misc/extra/extraUtilFile.c')
-rw-r--r--src/misc/extra/extraUtilFile.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c
index 96cf8601..2ddec21e 100644
--- a/src/misc/extra/extraUtilFile.c
+++ b/src/misc/extra/extraUtilFile.c
@@ -20,6 +20,9 @@
#include "extra.h"
+ABC_NAMESPACE_IMPL_START
+
+
/*---------------------------------------------------------------------------*/
/* Constant declarations */
/*---------------------------------------------------------------------------*/
@@ -248,6 +251,32 @@ char * Extra_FileRead( FILE * pFile )
/**Function*************************************************************
+ Synopsis [Returns one if the file has a given extension.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Extra_FileIsType( char * pFileName, char * pS1, char * pS2, char * pS3 )
+{
+ int lenS, lenF = strlen(pFileName);
+ lenS = pS1 ? strlen(pS1) : 0;
+ if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS1, lenS ) )
+ return 1;
+ lenS = pS2 ? strlen(pS2) : 0;
+ if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS2, lenS ) )
+ return 1;
+ lenS = pS3 ? strlen(pS3) : 0;
+ if ( lenS && lenF > lenS && !strncmp( pFileName+lenF-lenS, pS3, lenS ) )
+ return 1;
+ return 0;
+}
+
+/**Function*************************************************************
+
Synopsis [Returns the time stamp.]
Description [The file should be closed.]
@@ -425,7 +454,7 @@ void Extra_PrintHexadecimalString( char * pString, unsigned Sign[], int nVars )
SeeAlso []
***********************************************************************/
-void Extra_PrintHex( FILE * pFile, unsigned uTruth, int nVars )
+void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars )
{
int nMints, nDigits, Digit, k;
@@ -435,11 +464,11 @@ void Extra_PrintHex( FILE * pFile, unsigned uTruth, int nVars )
nDigits = nMints / 4;
for ( k = nDigits - 1; k >= 0; k-- )
{
- Digit = ((uTruth >> (k * 4)) & 15);
+ Digit = ((pTruth[k/8] >> (k * 4)) & 15);
if ( Digit < 10 )
fprintf( pFile, "%d", Digit );
else
- fprintf( pFile, "%c", 'a' + Digit-10 );
+ fprintf( pFile, "%c", 'A' + Digit-10 );
}
// fprintf( pFile, "\n" );
}
@@ -505,3 +534,5 @@ char * Extra_StringAppend( char * pStrGiven, char * pStrAdd )
////////////////////////////////////////////////////////////////////////
+ABC_NAMESPACE_IMPL_END
+