[Pcsclite-cvs-commit] PCSC/src configfile.l,1.9,1.10

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv14335

Modified Files:
	configfile.l 
Log Message:
code reindentation


Index: configfile.l
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/configfile.l,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- configfile.l	16 Jan 2004 11:35:48 -0000	1.9
+++ configfile.l	30 Mar 2004 14:43:47 -0000	1.10
@@ -11,18 +11,18 @@
  */
 
 %{
-int evaluatetoken( char *pcToken );
+int evaluatetoken(char *pcToken);
 
-static int iLinenumber      = 1;
-static char *pcPrevious     = 0;
-static char *pcCurrent      = 0;
+static int iLinenumber = 1;
+static char *pcPrevious = 0;
+static char *pcCurrent = 0;
 static char *pcFriendlyname = 0;
-static char *pcDevicename   = 0;
-static char *pcLibpath      = 0;
-static char *pcChannelid    = 0;
-static int   badError       = 0;
+static char *pcDevicename = 0;                
+static char *pcLibpath = 0;
+static char *pcChannelid = 0;
+static int badError = 0;
 
-void tok_error ( char *pcToken_error );
+void tok_error(char *pcToken_error);
 
 %}
 
@@ -46,108 +46,154 @@
 #include "readerfactory.h"
 #include "debuglog.h"
 
-int evaluatetoken( char *pcToken ) {
+int evaluatetoken(char *pcToken)
+{
 
-  DWORD dwChannelId = 0;
-  int p             = 0;
-  int n             = 0;
-  
-  if ( pcPrevious == 0 ) {       /* This is the key */
-    pcPrevious = strdup( pcToken );
-  } else {
-    pcCurrent = pcToken;
-    if ( strcmp( pcPrevious, "FRIENDLYNAME" ) == 0 ) {
-       if ( pcFriendlyname == 0 ) {
-         pcFriendlyname = (char *)malloc(strlen(pcCurrent)-1);
-        for ( n = 0; n < strlen(pcCurrent); n++ ) {
-           if ( pcCurrent[n] != '"' ) { /* Strip off the quotes */
-             pcFriendlyname[p++] = pcCurrent[n];         
-           }
-         }
-         pcFriendlyname[p++] = 0;
-       } else {
-         tok_error( pcPrevious ); return 1;
-       }
-    } else if ( strcmp( pcPrevious, "DEVICENAME" ) == 0 ) {
-       if ( pcDevicename == 0 ) {
-         struct stat fStatBuf;
-         pcDevicename = strdup( pcCurrent );
-         if (SYS_Stat(pcDevicename, &fStatBuf) != 0) {
-           DebugLogB("The device %s doesn't exist", pcDevicename);
-           badError = 1;
-         }
-       } else {
-         tok_error( pcPrevious ); return 1;
-       }
-    } else if ( strcmp( pcPrevious, "LIBPATH" ) == 0 ) {
-       if ( pcLibpath == 0 ) {
-         struct stat fStatBuf;
-         pcLibpath = strdup( pcCurrent );
-         if (SYS_Stat(pcLibpath, &fStatBuf) != 0) {
-           DebugLogB("The library %s doesn't exist", pcLibpath);
-           badError = 1;
-         }
-       } else {
-         tok_error( pcPrevious ); return 1;
-       }
-    } else if ( strcmp( pcPrevious, "CHANNELID" ) == 0 ) {
-       if ( pcChannelid == 0 ) {
-         pcChannelid = strdup( pcCurrent );
-       } else {
-         tok_error( pcPrevious ); return 1;
-       }
-    } else {
-       tok_error( pcPrevious ); return 1;
-    }
+	DWORD dwChannelId = 0;
+	int p = 0;
+	int n = 0;
 
-    free( pcPrevious ); pcPrevious = 0;
-  }
+	if (pcPrevious == 0)
+	{							/* This is the key */
+		pcPrevious = strdup(pcToken);
+	}
+	else
+	{
+		pcCurrent = pcToken;
+		if (strcmp(pcPrevious, "FRIENDLYNAME") == 0)
+		{
+			if (pcFriendlyname == 0)
+			{
+				pcFriendlyname = (char *) malloc(strlen(pcCurrent) - 1);
+				for (n = 0; n < strlen(pcCurrent); n++)
+				{
+					if (pcCurrent[n] != '"')
+					{			/* Strip off the quotes */
+						pcFriendlyname[p++] = pcCurrent[n];
+					}
+				}
+				pcFriendlyname[p++] = 0;
+			}
+			else
+			{
+				tok_error(pcPrevious);
+				return 1;
+			}
+		}
+		else if (strcmp(pcPrevious, "DEVICENAME") == 0)
+		{
+			if (pcDevicename == 0)
+			{
+				struct stat fStatBuf;
+				pcDevicename = strdup(pcCurrent);
+				if (SYS_Stat(pcDevicename, &fStatBuf) != 0)
+				{
+					DebugLogB("The device %s doesn't exist", pcDevicename);
+					badError = 1;
+				}
+			}
+			else
+			{
+				tok_error(pcPrevious);
+				return 1;
+			}
+		}
+		else if (strcmp(pcPrevious, "LIBPATH") == 0)
+		{
+			if (pcLibpath == 0)
+			{
+				struct stat fStatBuf;
+				pcLibpath = strdup(pcCurrent);
+				if (SYS_Stat(pcLibpath, &fStatBuf) != 0)
+				{
+					DebugLogB("The library %s doesn't exist", pcLibpath);
+					badError = 1;
+				}
+			}
+			else
+			{
+				tok_error(pcPrevious);
+				return 1;
+			}
+		}
+		else if (strcmp(pcPrevious, "CHANNELID") == 0)
+		{
+			if (pcChannelid == 0)
+			{
+				pcChannelid = strdup(pcCurrent);
+			}
+			else
+			{
+				tok_error(pcPrevious);
+				return 1;
+			}
+		}
+		else
+		{
+			tok_error(pcPrevious);
+			return 1;
+		}
 
-  if ( pcFriendlyname != 0 && pcDevicename != 0 &&
-       pcLibpath      != 0 && pcChannelid != 0 &&
-       badError != 1) {
-     
-       dwChannelId = strtoul( pcChannelid, 0, 16 );
-       RFAddReader( pcFriendlyname, dwChannelId, pcLibpath, pcDevicename );
+		free(pcPrevious);
+		pcPrevious = 0;
+	}
 
-       free( pcFriendlyname ); free( pcDevicename );
-       free( pcLibpath);       free( pcChannelid );
-       pcFriendlyname = 0;     pcDevicename = 0;
-       pcLibpath      = 0;     pcChannelid  = 0;
-  }
+	if (pcFriendlyname != 0 && pcDevicename != 0 &&
+		pcLibpath != 0 && pcChannelid != 0 && badError != 1)
+	{
 
-  return 0;
+		dwChannelId = strtoul(pcChannelid, 0, 16);
+		RFAddReader(pcFriendlyname, dwChannelId, pcLibpath, pcDevicename);
+
+		free(pcFriendlyname);
+		free(pcDevicename);
+		free(pcLibpath);
+		free(pcChannelid);
+		pcFriendlyname = 0;
+		pcDevicename = 0;
+		pcLibpath = 0;
+		pcChannelid = 0;
+	}
+
+	return 0;
 }
 
-void tok_error ( char *token_error ) {
-  DebugLogB("tok_error: invalid value in reader.conf: %s", token_error);
-  badError = 1;
+void tok_error(char *token_error)
+{
+	DebugLogB("tok_error: invalid value in reader.conf: %s", token_error);
+	badError = 1;
 }
 
-int DBUpdateReaders ( char *readerconf ) {
+int DBUpdateReaders(char *readerconf)
+{
 
-  FILE *configFile;
-  configFile = 0;	
+	FILE *configFile;
+	configFile = 0;
 
-  configFile = fopen( readerconf, "r");
+	configFile = fopen(readerconf, "r");
 
-  if (configFile == 0) {
-    return 1;
-  }
+	if (configFile == 0)
+	{
+		return 1;
+	}
 
-  yyin = configFile;
+	yyin = configFile;
 
-  do {
-    yylex();
-  }
-  while (!feof(configFile));
+	do
+	{
+		yylex();
+	}
+	while (!feof(configFile));
 
-  fclose(configFile);
+	fclose(configFile);
 
-  if (badError == 1) {
-    return -1;
-  } else {
-    return 0;
-  }
-} /* End of configfile.c */
+	if (badError == 1)
+	{
+		return -1;
+	}
+	else
+	{
+		return 0;
+	}
+}								/* End of configfile.c */